Skip to content

Commit

Permalink
Piranha plant is small if placed on a flower pot
Browse files Browse the repository at this point in the history
  • Loading branch information
WenXin20 committed Jan 9, 2025
1 parent 1a708c2 commit 4c10cdc
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.FlowerPotBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
Expand Down Expand Up @@ -239,8 +240,11 @@ public void hideInBlock() {
float targetScale = this.isHiding() ? 0.3F : 1.0F;
currentScale = Mth.lerp(SCALING_SPEED, currentScale, targetScale);

if (scale != null && scale.getBaseValue() != currentScale)
scale.setBaseValue(currentScale);
if (scale != null) {
if (world.getBlockState(pos).getBlock() instanceof FlowerPotBlock)
scale.setBaseValue(0.4F);
else if (scale.getBaseValue() != currentScale) scale.setBaseValue(currentScale);
}

if (this.isHiding() && !world.getBlockState(pos).is(TagRegistry.PIRANHA_PLANTS_CAN_HIDE)
&& !world.getBlockState(posBelow).is(TagRegistry.PIRANHA_PLANTS_CAN_HIDE)) {
Expand Down

0 comments on commit 4c10cdc

Please sign in to comment.