mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 03:26:44 +01:00
Fixed sea plants breaking when using the hydrophobic spell
This commit is contained in:
parent
a068b5cc03
commit
06de83981e
1 changed files with 21 additions and 0 deletions
|
@ -9,6 +9,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.enums.DoubleBlockHalf;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.state.State;
|
||||
|
@ -16,6 +17,9 @@ import net.minecraft.state.StateManager;
|
|||
import net.minecraft.state.StateManager.Factory;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.state.property.Property;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
|
||||
@Mixin(StateManager.class)
|
||||
abstract class MixinStateManager<O, S extends State<O, S>> {
|
||||
|
@ -75,4 +79,21 @@ abstract class MixinBlockState extends AbstractBlock.AbstractBlockState {
|
|||
}
|
||||
return super.getFluidState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateForNeighborUpdate(Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
|
||||
BlockState newState = super.getStateForNeighborUpdate(direction, neighborState, world, pos, neighborPos);
|
||||
if (newState.isAir()
|
||||
&& contains(Properties.WATERLOGGED)
|
||||
&& getBlock() instanceof TallSeagrassBlock
|
||||
&& contains(TallPlantBlock.HALF)
|
||||
&& get(TallPlantBlock.HALF) == DoubleBlockHalf.LOWER) {
|
||||
|
||||
BlockState above = world.getBlockState(pos.up());
|
||||
if (above.isOf(getBlock())) {
|
||||
return asBlockState();
|
||||
}
|
||||
}
|
||||
return newState;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue