Converted to 1.16 appropriate ways - builds

This commit is contained in:
Bob Dole 2020-10-30 03:11:07 -04:00
parent c739fdbb09
commit 16ab29be1d
7 changed files with 27 additions and 29 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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<Context> 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);
}));

View File

@ -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

View File

@ -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);
}