diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidFX.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidFX.java index 8cf78dbd7..f6554fbc7 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidFX.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidFX.java @@ -6,13 +6,13 @@ import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.client.Minecraft; import net.minecraft.fluid.Fluid; +import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; -import net.minecraft.fluid.IFluidState; import net.minecraft.particles.BlockParticleData; import net.minecraft.particles.IParticleData; import net.minecraft.particles.ParticleTypes; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; @@ -25,22 +25,22 @@ public class FluidFX { if (fluid == Fluids.EMPTY) return; - IFluidState defaultState = fluid.getDefaultState(); + FluidState defaultState = fluid.getDefaultState(); if (defaultState == null || defaultState.isEmpty()) { return; } BlockParticleData blockParticleData = new BlockParticleData(ParticleTypes.BLOCK, defaultState.getBlockState()); - Vec3d center = VecHelper.getCenterOf(pos); + Vector3d center = VecHelper.getCenterOf(pos); for (int i = 0; i < 20; i++) { - Vec3d v = VecHelper.offsetRandomly(Vec3d.ZERO, r, .25f); + Vector3d v = VecHelper.offsetRandomly(Vector3d.ZERO, r, .25f); particle(blockParticleData, center.add(v), v); } } - private static void particle(IParticleData data, Vec3d pos, Vec3d motion) { + private static void particle(IParticleData data, Vector3d pos, Vector3d motion) { world().addParticle(data, pos.x, pos.y, pos.z, motion.x, motion.y, motion.z); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidDrainingBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidDrainingBehaviour.java index 6a44ca97a..e129f52f6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidDrainingBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidDrainingBehaviour.java @@ -84,7 +84,7 @@ public class FluidDrainingBehaviour extends FluidManipulationBehaviour { BlockState emptied = blockState; Fluid fluid = Fluids.EMPTY; - if (blockState.has(BlockStateProperties.WATERLOGGED) && blockState.get(BlockStateProperties.WATERLOGGED)) { + if (blockState.contains(BlockStateProperties.WATERLOGGED) && blockState.get(BlockStateProperties.WATERLOGGED)) { emptied = blockState.with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(false)); fluid = Fluids.WATER; } else if (blockState.getBlock() instanceof FlowingFluidBlock) { @@ -192,7 +192,7 @@ public class FluidDrainingBehaviour extends FluidManipulationBehaviour { } protected FluidBlockType canPullFluidsFrom(BlockState blockState, BlockPos pos) { - if (blockState.has(BlockStateProperties.WATERLOGGED) && blockState.get(BlockStateProperties.WATERLOGGED)) + if (blockState.contains(BlockStateProperties.WATERLOGGED) && blockState.get(BlockStateProperties.WATERLOGGED)) return FluidBlockType.SOURCE; if (blockState.getBlock() instanceof FlowingFluidBlock) return blockState.get(FlowingFluidBlock.LEVEL) == 0 ? FluidBlockType.SOURCE : FluidBlockType.FLOWING; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidFillingBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidFillingBehaviour.java index 7764001a0..c046edf3e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidFillingBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidFillingBehaviour.java @@ -15,8 +15,8 @@ import it.unimi.dsi.fastutil.objects.ObjectHeapPriorityQueue; import net.minecraft.block.BlockState; import net.minecraft.block.FlowingFluidBlock; import net.minecraft.fluid.Fluid; +import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; -import net.minecraft.fluid.IFluidState; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; @@ -113,7 +113,7 @@ public class FluidFillingBehaviour extends FluidManipulationBehaviour { int maxBlocks = maxBlocks(); if (infinite) { - IFluidState fluidState = world.getFluidState(rootPos); + FluidState fluidState = world.getFluidState(rootPos); boolean equivalentTo = fluidState.getFluid() .isEquivalentTo(fluid); if (!equivalentTo) @@ -153,7 +153,7 @@ public class FluidFillingBehaviour extends FluidManipulationBehaviour { playEffect(world, currentPos, fluid, false); BlockState blockState = world.getBlockState(currentPos); - if (blockState.has(BlockStateProperties.WATERLOGGED) && fluid.isEquivalentTo(Fluids.WATER)) { + if (blockState.contains(BlockStateProperties.WATERLOGGED) && fluid.isEquivalentTo(Fluids.WATER)) { world.setBlockState(currentPos, blockState.with(BlockStateProperties.WATERLOGGED, true), 2 | 16); } else { @@ -220,9 +220,9 @@ public class FluidFillingBehaviour extends FluidManipulationBehaviour { protected SpaceType getAtPos(World world, BlockPos pos, Fluid toFill) { BlockState blockState = world.getBlockState(pos); - IFluidState fluidState = blockState.getFluidState(); + FluidState fluidState = blockState.getFluidState(); - if (blockState.has(BlockStateProperties.WATERLOGGED)) + if (blockState.contains(BlockStateProperties.WATERLOGGED)) return toFill.isEquivalentTo(Fluids.WATER) ? blockState.get(BlockStateProperties.WATERLOGGED) ? SpaceType.FILLED : SpaceType.FILLABLE : SpaceType.BLOCKING; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidManipulationBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidManipulationBehaviour.java index 3150c6011..8f93da9b6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidManipulationBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidManipulationBehaviour.java @@ -14,7 +14,7 @@ import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.IFluidState; +import net.minecraft.fluid.FluidState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.NBTUtil; import net.minecraft.tags.FluidTags; @@ -25,7 +25,7 @@ import net.minecraft.util.SoundEvent; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MutableBoundingBox; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.fluids.FluidStack; @@ -101,11 +101,9 @@ public abstract class FluidManipulationBehaviour extends TileEntityBehaviour { protected void scheduleUpdatesInAffectedArea() { World world = getWorld(); - affectedArea = new MutableBoundingBox(affectedArea.minX - 1, affectedArea.minY - 1, affectedArea.minZ - 1, - affectedArea.maxX + 1, affectedArea.maxY + 1, affectedArea.maxZ + 1); - BlockPos.func_229383_a_(affectedArea) + BlockPos.getAllInBox(new BlockPos(affectedArea.minX - 1, affectedArea.minY - 1, affectedArea.minZ - 1), new BlockPos(affectedArea.maxX + 1, affectedArea.maxY + 1, affectedArea.maxZ + 1)) .forEach(pos -> { - IFluidState nextFluidState = world.getFluidState(pos); + FluidState nextFluidState = world.getFluidState(pos); if (nextFluidState.isEmpty()) return; world.getPendingFluidTicks() @@ -115,7 +113,7 @@ public abstract class FluidManipulationBehaviour extends TileEntityBehaviour { } protected int comparePositions(BlockPosEntry e1, BlockPosEntry e2) { - Vec3d centerOfRoot = VecHelper.getCenterOf(rootPos); + Vector3d centerOfRoot = VecHelper.getCenterOf(rootPos); BlockPos pos2 = e2.pos; BlockPos pos1 = e1.pos; if (pos1.getY() != pos2.getY()) @@ -144,7 +142,7 @@ public abstract class FluidManipulationBehaviour extends TileEntityBehaviour { continue; visited.add(currentPos); - IFluidState fluidState = world.getFluidState(currentPos); + FluidState fluidState = world.getFluidState(currentPos); if (fluidState.isEmpty()) continue; @@ -166,7 +164,7 @@ public abstract class FluidManipulationBehaviour extends TileEntityBehaviour { if (offsetPos.distanceSq(rootPos) > maxRangeSq) continue; - IFluidState nextFluidState = world.getFluidState(offsetPos); + FluidState nextFluidState = world.getFluidState(offsetPos); if (nextFluidState.isEmpty()) continue; Fluid nextFluid = nextFluidState.getFluid(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidSplashPacket.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidSplashPacket.java index 1489e52b7..3e46f91ce 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidSplashPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidSplashPacket.java @@ -8,7 +8,7 @@ import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.client.Minecraft; import net.minecraft.network.PacketBuffer; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.DistExecutor; @@ -37,8 +37,8 @@ public class FluidSplashPacket extends SimplePacketBase { public void handle(Supplier ctx) { ctx.get() .enqueueWork(() -> DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { - if (Minecraft.getInstance().player.getPositionVector() - .distanceTo(new Vec3d(pos)) > 100) + if (Minecraft.getInstance().player.getPositionVec() + .distanceTo(new Vector3d(pos.getX(), pos.getY(), pos.getZ())) > 100) return; FluidFX.splash(pos, fluid); })); diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/HosePulleyTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/HosePulleyTileEntity.java index b53a36bff..3b3129494 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/HosePulleyTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/HosePulleyTileEntity.java @@ -8,6 +8,7 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.utility.LerpedFloat; import com.simibubi.create.foundation.utility.ServerSpeedProvider; +import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; @@ -137,10 +138,10 @@ public class HosePulleyTileEntity extends KineticTileEntity { } @Override - protected void read(CompoundNBT compound, boolean clientPacket) { + protected void fromTag(BlockState state, CompoundNBT compound, boolean clientPacket) { offset.readNBT(compound.getCompound("Offset"), clientPacket); internalTank.readFromNBT(compound.getCompound("Tank")); - super.read(compound, clientPacket); + super.fromTag(state, compound, clientPacket); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java b/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java index f1dad8e0e..d6fefa8a8 100644 --- a/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java +++ b/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java @@ -97,8 +97,7 @@ public enum AllPackets { public static void sendToNear(World world, BlockPos pos, int range, Object message) { channel.send( - PacketDistributor.NEAR.with(TargetPoint.p(pos.getX(), pos.getY(), pos.getZ(), range, world.getDimension() - .getType())), + PacketDistributor.NEAR.with(TargetPoint.p(pos.getX(), pos.getY(), pos.getZ(), range, world.getRegistryKey())), message); }