From 83c64121ebdd8e068df3ddb8b262016eda53e7e7 Mon Sep 17 00:00:00 2001 From: grimmauld Date: Tue, 22 Sep 2020 17:44:22 +0200 Subject: [PATCH] Do some porty stuff --- .../contraptions/base/KineticTileEntity.java | 30 ++++---- .../components/actors/AttachedActorBlock.java | 3 +- .../actors/BellMovementBehaviour.java | 4 +- .../BlockBreakingKineticTileEntity.java | 8 +-- .../actors/HarvesterTileEntity.java | 5 -- .../actors/PloughMovementBehaviour.java | 4 +- .../components/actors/SeatBlock.java | 2 +- .../components/actors/SeatEntity.java | 10 +-- .../actors/SeatMovementBehaviour.java | 4 +- .../actors/StorageInterfaceMovement.java | 8 +-- .../dispenser/ContraptionBlockSource.java | 7 +- .../dispenser/DispenserMovementBehaviour.java | 4 +- .../dispenser/DropperMovementBehaviour.java | 3 +- .../IMovedDispenseItemBehaviour.java | 22 +++--- .../MovedDefaultDispenseItemBehaviour.java | 14 ++-- .../MovedProjectileDispenserBehaviour.java | 22 +++--- .../clock/CuckooClockTileEntity.java | 2 +- .../crafter/ConnectedInputHandler.java | 27 +++----- .../crafter/MechanicalCrafterTileEntity.java | 4 +- .../crusher/CrushingWheelBlock.java | 2 +- .../crusher/CrushingWheelControllerBlock.java | 6 +- .../CrushingWheelControllerTileEntity.java | 2 +- .../deployer/DeployerFakePlayer.java | 6 +- .../components/fan/AirCurrent.java | 20 +++--- .../components/fan/EncasedFanTileEntity.java | 5 +- .../flywheel/FlywheelGenerator.java | 3 +- .../flywheel/engine/EngineTileEntity.java | 5 -- .../engine/FurnaceEngineTileEntity.java | 3 +- .../components/millstone/MillstoneBlock.java | 2 +- .../mixer/MechanicalMixerTileEntity.java | 3 +- .../contraptions/components/saw/SawBlock.java | 2 +- .../BlockMovementTraits.java | 5 +- .../structureMovement/Contraption.java | 23 +++---- .../ContraptionCollider.java | 4 +- .../structureMovement/ContraptionEntity.java | 19 +++--- .../structureMovement/ContraptionHandler.java | 4 +- .../ContraptionInteractionHandler.java | 10 +-- .../structureMovement/MovementBehaviour.java | 2 +- .../structureMovement/MovementContext.java | 1 + .../structureMovement/StructureTransform.java | 19 +++--- .../bearing/MechanicalBearingTileEntity.java | 3 +- .../chassis/ChassisRangeDisplay.java | 2 +- .../glue/SuperGlueEntity.java | 7 +- .../glue/SuperGlueHandler.java | 8 ++- .../mounted/CartAssemblerBlock.java | 13 ++-- .../mounted/MountedContraption.java | 3 +- .../piston/MechanicalPistonGenerator.java | 4 +- .../piston/MechanicalPistonHeadBlock.java | 4 +- .../piston/PistonExtensionPoleBlock.java | 4 +- .../structureMovement/pulley/PulleyBlock.java | 7 +- .../pulley/PulleyTileEntity.java | 11 +-- .../sync/ClientMotionPacket.java | 10 +-- .../train/ClientMinecartCouplingHandler.java | 6 +- .../train/MinecartCouplingRenderer.java | 28 ++++---- .../train/MinecartCouplingSerializer.java | 2 +- .../train/MinecartSim2020.java | 68 +++++++++---------- .../train/MinecartTrain.java | 52 +++++++------- .../tracks/ReinforcedRailBlock.java | 3 +- .../components/turntable/TurntableBlock.java | 4 +- .../turntable/TurntableHandler.java | 4 +- .../waterwheel/WaterWheelBlock.java | 14 ++-- .../waterwheel/WaterWheelTileEntity.java | 4 +- .../fluids/FluidPipeAttachmentBehaviour.java | 4 +- .../fluids/FluidPipeBehaviour.java | 26 +++---- .../contraptions/fluids/FluidPropagator.java | 13 ++-- .../contraptions/fluids/FluidReactions.java | 4 +- .../contraptions/fluids/OpenEndedPipe.java | 11 +-- .../fluids/PipeAttachmentModel.java | 4 +- .../contraptions/fluids/PumpBlock.java | 4 +- .../contraptions/fluids/PumpTileEntity.java | 4 +- .../fluids/actors/SpoutTileEntity.java | 10 +-- .../fluids/pipes/FluidPipeBlock.java | 20 +++--- .../fluids/pipes/FluidPipeTileEntity.java | 4 +- .../fluids/pipes/StraightPipeTileEntity.java | 4 +- .../fluids/tank/FluidTankBlock.java | 10 +-- .../fluids/tank/FluidTankCTBehaviour.java | 4 +- .../fluids/tank/FluidTankGenerator.java | 2 +- .../fluids/tank/FluidTankModel.java | 4 +- .../goggles/GoggleConfigScreen.java | 35 +++++----- .../goggles/GoggleOverlayRenderer.java | 12 ++-- .../goggles/IHaveGoggleInformation.java | 4 +- .../goggles/IHaveHoveringInformation.java | 4 +- .../particle/AirFlowParticle.java | 7 +- .../contraptions/particle/AirParticle.java | 13 ++-- .../contraptions/particle/CubeParticle.java | 9 +-- .../contraptions/particle/HeaterParticle.java | 7 +- .../particle/RotationIndicatorParticle.java | 7 +- .../contraptions/processing/BasinBlock.java | 6 +- .../processing/BasinTileEntity.java | 6 +- .../burner/BlazeBurnerBlockItem.java | 18 ++--- .../burner/BlazeBurnerTileEntity.java | 16 ++--- .../advanced/SpeedControllerTileEntity.java | 5 -- .../sequencer/SequencedGearshiftScreen.java | 17 ++--- .../contraptions/relays/belt/BeltBlock.java | 7 +- .../relays/belt/BeltGenerator.java | 4 +- .../contraptions/relays/belt/BeltModel.java | 2 +- .../relays/belt/BeltRenderer.java | 9 +-- .../relays/belt/BeltTileEntity.java | 5 -- .../belt/item/BeltConnectorHandler.java | 4 +- .../BeltFunnelInteractionHandler.java | 3 +- .../relays/belt/transport/BeltInventory.java | 3 +- .../belt/transport/BeltMovementHandler.java | 6 +- .../relays/elementary/CogWheelBlock.java | 8 +-- .../relays/elementary/ShaftBlock.java | 4 +- .../contraptions/relays/gauge/GaugeBlock.java | 6 +- .../relays/gauge/GaugeTileEntity.java | 5 +- .../relays/gauge/SpeedGaugeTileEntity.java | 10 +-- .../relays/gauge/StressGaugeTileEntity.java | 22 +++--- .../contraptions/wrench/IWrenchable.java | 15 ++-- .../symmetry/SymmetryEffectPacket.java | 2 +- .../symmetry/SymmetryWandScreen.java | 10 +-- .../curiosities/tools/DeforesterItem.java | 16 ++--- .../curiosities/tools/ExtendoGripItem.java | 14 ++-- .../curiosities/zapper/ZapperBeamPacket.java | 2 +- .../zapper/ZapperInteractionHandler.java | 16 ++--- .../curiosities/zapper/ZapperItem.java | 2 +- .../zapper/ZapperRenderHandler.java | 2 +- .../curiosities/zapper/ZapperScreen.java | 16 +++-- .../zapper/blockzapper/BlockzapperItem.java | 4 +- .../zapper/blockzapper/BlockzapperScreen.java | 9 +-- .../terrainzapper/WorldshaperScreen.java | 16 +++-- .../belts/tunnel/BrassTunnelTileEntity.java | 7 +- .../block/chute/ChuteTileEntity.java | 8 +-- .../logistics/block/depot/DepotRenderer.java | 10 +-- .../block/depot/DepotTileEntity.java | 2 +- .../inventories/AdjustableCrateContainer.java | 2 +- .../block/mechanicalArm/ArmTileEntity.java | 6 +- .../item/filter/AbstractFilterScreen.java | 18 ++--- .../block/SchematicTableContainer.java | 2 +- .../block/SchematicannonContainer.java | 2 +- .../block/SchematicannonTileEntity.java | 4 +- .../simibubi/create/events/ClientEvents.java | 4 +- .../foundation/advancement/AllTriggers.java | 9 +-- .../simibubi/create/foundation/block/ITE.java | 8 +-- .../collision/CollisionDebugger.java | 12 ++-- .../collision/ContinuousOBBCollider.java | 57 ++++++++-------- .../foundation/collision/OBBCollider.java | 38 ++++++----- .../foundation/collision/OrientedBB.java | 30 ++++---- .../gui/AbstractSimiContainerScreen.java | 9 +-- .../foundation/gui/AbstractSimiScreen.java | 19 +++--- .../gui/widgets/AbstractSimiWidget.java | 10 +-- .../foundation/gui/widgets/IconButton.java | 12 ++-- .../tileEntity/SyncedTileEntity.java | 22 ++++-- .../foundation/utility/BlockHelper.java | 51 ++++++++------ .../foundation/utility/RaycastHelper.java | 8 +-- .../foundation/utility/outliner/Outline.java | 8 +-- .../utility/worldWrappers/WrappedWorld.java | 2 +- 147 files changed, 757 insertions(+), 709 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java index e376fe488..ad803fe88 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java @@ -31,6 +31,7 @@ import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; @@ -371,31 +372,26 @@ public abstract class KineticTileEntity extends SmartTileEntity public void addBehaviours(List behaviours) {} @Override - public boolean hasFastRenderer() { - return true; - } - - @Override - public boolean addToTooltip(List tooltip, boolean isPlayerSneaking) { + public boolean addToTooltip(List tooltip, boolean isPlayerSneaking) { boolean notFastEnough = !isSpeedRequirementFulfilled() && getSpeed() != 0; if (overStressed && AllConfigs.CLIENT.enableOverstressedTooltip.get()) { - tooltip.add(spacing + GOLD + Lang.translate("gui.stressometer.overstressed")); + tooltip.add(ITextComponent.of(spacing + GOLD + Lang.translate("gui.stressometer.overstressed"))); String hint = Lang.translate("gui.contraptions.network_overstressed", I18n.format(getBlockState().getBlock() .getTranslationKey())); List cutString = TooltipHelper.cutString(spacing + hint, GRAY, TextFormatting.WHITE); for (int i = 0; i < cutString.size(); i++) - tooltip.add((i == 0 ? "" : spacing) + cutString.get(i)); + tooltip.add(ITextComponent.of((i == 0 ? "" : spacing) + cutString.get(i))); return true; } if (notFastEnough) { - tooltip.add(spacing + GOLD + Lang.translate("tooltip.speedRequirement")); + tooltip.add(ITextComponent.of(spacing + GOLD + Lang.translate("tooltip.speedRequirement"))); String hint = Lang.translate("gui.contraptions.not_fast_enough", I18n.format(getBlockState().getBlock() .getTranslationKey())); List cutString = TooltipHelper.cutString(spacing + hint, GRAY, TextFormatting.WHITE); for (int i = 0; i < cutString.size(); i++) - tooltip.add((i == 0 ? "" : spacing) + cutString.get(i)); + tooltip.add(ITextComponent.of((i == 0 ? "" : spacing) + cutString.get(i))); return true; } @@ -403,23 +399,23 @@ public abstract class KineticTileEntity extends SmartTileEntity } @Override - public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { + public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { boolean added = false; float stressAtBase = calculateStressApplied(); if (calculateStressApplied() != 0 && StressImpact.isEnabled()) { - tooltip.add(spacing + Lang.translate("gui.goggles.kinetic_stats")); - tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("tooltip.stressImpact")); + tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.goggles.kinetic_stats"))); + tooltip.add(ITextComponent.of(spacing + TextFormatting.GRAY + Lang.translate("tooltip.stressImpact"))); float stressTotal = stressAtBase * Math.abs(getSpeed()); String stressString = spacing + "%s%s" + Lang.translate("generic.unit.stress") + " " + TextFormatting.DARK_GRAY + "%s"; - tooltip.add(String.format(stressString, TextFormatting.AQUA, IHaveGoggleInformation.format(stressAtBase), - Lang.translate("gui.goggles.base_value"))); - tooltip.add(String.format(stressString, TextFormatting.GRAY, IHaveGoggleInformation.format(stressTotal), - Lang.translate("gui.goggles.at_current_speed"))); + tooltip.add(ITextComponent.of(String.format(stressString, TextFormatting.AQUA, IHaveGoggleInformation.format(stressAtBase), + Lang.translate("gui.goggles.base_value")))); + tooltip.add(ITextComponent.of(String.format(stressString, TextFormatting.GRAY, IHaveGoggleInformation.format(stressTotal), + Lang.translate("gui.goggles.at_current_speed")))); added = true; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/AttachedActorBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/AttachedActorBlock.java index 161d1828f..80c00a60d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/AttachedActorBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/AttachedActorBlock.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.actors; import com.simibubi.create.AllShapes; import com.simibubi.create.content.contraptions.wrench.IWrenchable; +import com.simibubi.create.foundation.utility.BlockHelper; import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -49,7 +50,7 @@ public abstract class AttachedActorBlock extends HorizontalBlock implements IWre public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) { Direction direction = state.get(HORIZONTAL_FACING); BlockPos offset = pos.offset(direction.getOpposite()); - return Block.hasSolidSide(worldIn.getBlockState(offset), worldIn, offset, direction); + return BlockHelper.hasBlockSolidSide(worldIn.getBlockState(offset), worldIn, offset, direction); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/BellMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/BellMovementBehaviour.java index 6b93996d4..000280891 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/BellMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/BellMovementBehaviour.java @@ -6,7 +6,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; public class BellMovementBehaviour extends MovementBehaviour { @Override @@ -15,7 +15,7 @@ public class BellMovementBehaviour extends MovementBehaviour { } @Override - public void onSpeedChanged(MovementContext context, Vec3d oldMotion, Vec3d motion) { + public void onSpeedChanged(MovementContext context, Vector3d oldMotion, Vector3d motion) { double dotProduct = oldMotion.dotProduct(motion); if (dotProduct <= 0 && (context.relativeMotion.length() != 0 || context.rotation.length() == 0) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/BlockBreakingKineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/BlockBreakingKineticTileEntity.java index bc651d78f..c41298383 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/BlockBreakingKineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/BlockBreakingKineticTileEntity.java @@ -135,7 +135,7 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity { } public void onBlockBroken(BlockState stateToBreak) { - FluidState ifluidstate = world.getFluidState(breakingPos); + FluidState FluidState = world.getFluidState(breakingPos); world.playEvent(2001, breakingPos, Block.getStateId(stateToBreak)); TileEntity tileentity = stateToBreak.hasTileEntity() ? world.getTileEntity(breakingPos) : null; Vector3d vec = VecHelper.offsetRandomly(VecHelper.getCenterOf(breakingPos), world.rand, .125f); @@ -149,9 +149,9 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity { world.addEntity(itementity); } }); - - stateToBreak.spawnAdditionalDrops(world, breakingPos, ItemStack.EMPTY); - world.setBlockState(breakingPos, ifluidstate.getBlockState(), 3); + if (world instanceof ServerWorld) + stateToBreak.spawnAdditionalDrops((ServerWorld) world, breakingPos, ItemStack.EMPTY); + world.setBlockState(breakingPos, FluidState.getBlockState(), 3); } protected float getBreakSpeed() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterTileEntity.java index 5f40441f2..be2b04022 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterTileEntity.java @@ -9,10 +9,5 @@ public class HarvesterTileEntity extends SyncedTileEntity { public HarvesterTileEntity(TileEntityType type) { super(type); } - - @Override - public boolean hasFastRenderer() { - return true; - } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PloughMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PloughMovementBehaviour.java index 8ba35b937..87b283c09 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PloughMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PloughMovementBehaviour.java @@ -49,7 +49,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour { BlockRayTraceResult ray = world .rayTraceBlocks(new RayTraceContext(vec, vec.add(0, -1, 0), BlockMode.OUTLINE, FluidMode.NONE, player)); - if (ray == null || ray.getType() != Type.BLOCK) + if (ray.getType() != Type.BLOCK) return; ItemUseContext ctx = new ItemUseContext(player, Hand.MAIN_HAND, ray); @@ -83,7 +83,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour { } private PloughFakePlayer getPlayer(MovementContext context) { - if (!(context.temporaryData instanceof PloughFakePlayer) && context.world instanceof ServerWorld) { + if (!(context.temporaryData instanceof PloughFakePlayer) && context.world != null) { PloughFakePlayer player = new PloughFakePlayer((ServerWorld) context.world); player.setHeldItem(Hand.MAIN_HAND, new ItemStack(Items.DIAMOND_HOE)); context.temporaryData = player; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatBlock.java index 584df561a..17fb5bae5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatBlock.java @@ -55,7 +55,7 @@ public class SeatBlock extends Block { @Override public void onLanded(IBlockReader reader, Entity entity) { - BlockPos pos = entity.getPosition(); + BlockPos pos = entity.getBlockPos(); if (entity instanceof PlayerEntity || !(entity instanceof LivingEntity) || isSeatOccupied(entity.world, pos)) { Blocks.PINK_BED.onLanded(reader, entity); return; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatEntity.java index 18e8cd48f..ff049d3a1 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatEntity.java @@ -13,7 +13,7 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; 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.fml.common.registry.IEntityAdditionalSpawnData; import net.minecraftforge.fml.network.NetworkHooks; @@ -44,18 +44,18 @@ public class SeatEntity extends Entity implements IEntityAdditionalSpawnData { public void setPos(double x, double y, double z) { super.setPos(x, y, z); AxisAlignedBB bb = getBoundingBox(); - Vec3d diff = new Vec3d(x, y, z).subtract(bb.getCenter()); + Vector3d diff = new Vector3d(x, y, z).subtract(bb.getCenter()); setBoundingBox(bb.offset(diff)); } @Override - public void setMotion(Vec3d p_213317_1_) {} + public void setMotion(Vector3d p_213317_1_) {} @Override public void tick() { if (world.isRemote) return; - boolean blockPresent = world.getBlockState(getPosition()) + boolean blockPresent = world.getBlockState(getBlockPos()) .getBlock() instanceof SeatBlock; if (isBeingRidden() && blockPresent) return; @@ -70,7 +70,7 @@ public class SeatEntity extends Entity implements IEntityAdditionalSpawnData { @Override protected void removePassenger(Entity entity) { super.removePassenger(entity); - Vec3d pos = entity.getPositionVec(); + Vector3d pos = entity.getPositionVec(); entity.setPosition(pos.x, pos.y + 0.85f, pos.z); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatMovementBehaviour.java index e400628cd..26e8d17f3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatMovementBehaviour.java @@ -17,7 +17,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.state.properties.SlabType; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; public class SeatMovementBehaviour extends MovementBehaviour { @@ -61,7 +61,7 @@ public class SeatMovementBehaviour extends MovementBehaviour { } if (toDismount != null) { toDismount.stopRiding(); - Vec3d position = VecHelper.getCenterOf(pos) + Vector3d position = VecHelper.getCenterOf(pos) .add(0, slab ? .5f : 1f, 0); toDismount.setPositionAndUpdate(position.x, position.y, position.z); toDismount.getPersistentData() diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/StorageInterfaceMovement.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/StorageInterfaceMovement.java index c6442a00f..c4d4b606e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/StorageInterfaceMovement.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/StorageInterfaceMovement.java @@ -19,7 +19,7 @@ //import net.minecraft.util.Direction; //import net.minecraft.util.Direction.Axis; //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.items.IItemHandlerModifiable; //import net.minecraftforge.items.ItemHandlerHelper; @@ -31,8 +31,8 @@ // private static final String _workingPos_ = "WorkingPos"; // // @Override -// public Vec3d getActiveAreaOffset(MovementContext context) { -// return new Vec3d(context.state.get(PortableStorageInterfaceBlock.FACING).getDirectionVec()).scale(.85f); +// public Vector3d getActiveAreaOffset(MovementContext context) { +// return new Vector3d(context.state.get(PortableStorageInterfaceBlock.FACING).getDirectionVec()).scale(.85f); // } // // @Override @@ -149,7 +149,7 @@ // } // // private Direction getCurrentFacing(MovementContext context) { -// Vec3d directionVec = new Vec3d(context.state.get(PortableStorageInterfaceBlock.FACING).getDirectionVec()); +// Vector3d directionVec = new Vector3d(context.state.get(PortableStorageInterfaceBlock.FACING).getDirectionVec()); // directionVec = VecHelper.rotate(directionVec, context.rotation.x, context.rotation.y, context.rotation.z); // return Direction.getFacingFromVector(directionVec.x, directionVec.y, directionVec.z); // } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/ContraptionBlockSource.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/ContraptionBlockSource.java index 9ff2f2d53..fb5501ad6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/ContraptionBlockSource.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/ContraptionBlockSource.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.contraptions.components.actors.dispenser; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; +import com.simibubi.create.foundation.utility.BlockHelper; import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.BlockState; import net.minecraft.dispenser.IBlockSource; @@ -8,7 +9,7 @@ import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.server.ServerWorld; import javax.annotation.Nullable; @@ -50,7 +51,7 @@ public class ContraptionBlockSource implements IBlockSource { @Override public BlockState getBlockState() { - if(context.state.has(BlockStateProperties.FACING) && overrideFacing != null) + if(BlockHelper.hasBlockStateProperty(context.state, BlockStateProperties.FACING) && overrideFacing != null) return context.state.with(BlockStateProperties.FACING, overrideFacing); return context.state; } @@ -62,7 +63,7 @@ public class ContraptionBlockSource implements IBlockSource { } @Override - public World getWorld() { + public ServerWorld getWorld() { return context.world; } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/DispenserMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/DispenserMovementBehaviour.java index 19674c065..1cafd550d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/DispenserMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/DispenserMovementBehaviour.java @@ -13,7 +13,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import javax.annotation.ParametersAreNonnullByDefault; import java.util.HashMap; @@ -60,7 +60,7 @@ public class DispenserMovementBehaviour extends DropperMovementBehaviour { return; } - Vec3d facingVec = new Vec3d(context.state.get(DispenserBlock.FACING).getDirectionVec()); + Vector3d facingVec = Vector3d.of(context.state.get(DispenserBlock.FACING).getDirectionVec()); facingVec = VecHelper.rotate(facingVec, context.rotation.x, context.rotation.y, context.rotation.z); facingVec.normalize(); Direction clostestFacing = Direction.getFacingFromVector(facingVec.x, facingVec.y, facingVec.z); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/DropperMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/DropperMovementBehaviour.java index 29ddec09b..b8f5d1c82 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/DropperMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/DropperMovementBehaviour.java @@ -8,7 +8,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.server.ServerWorld; import java.util.ArrayList; import java.util.List; @@ -41,7 +40,7 @@ public class DropperMovementBehaviour extends MovementBehaviour { } private void updateTemporaryData(MovementContext context) { - if (!(context.temporaryData instanceof NonNullList) && context.world instanceof ServerWorld) { + if (!(context.temporaryData instanceof NonNullList) && context.world != null) { NonNullList stacks = NonNullList.withSize(getInvSize(), ItemStack.EMPTY); ItemStackHelper.loadAllItems(context.tileData, stacks); context.temporaryData = stacks; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/IMovedDispenseItemBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/IMovedDispenseItemBehaviour.java index fba60a901..31b7611b0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/IMovedDispenseItemBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/IMovedDispenseItemBehaviour.java @@ -7,9 +7,7 @@ import net.minecraft.block.BlockState; import net.minecraft.block.IBucketPickupHandler; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; -import net.minecraft.entity.IProjectile; import net.minecraft.entity.SpawnReason; -import net.minecraft.entity.item.FireworkRocketEntity; import net.minecraft.entity.item.TNTEntity; import net.minecraft.entity.projectile.*; import net.minecraft.fluid.FlowingFluid; @@ -26,7 +24,7 @@ import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; import net.minecraft.util.Util; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.IWorld; import net.minecraft.world.World; @@ -36,7 +34,7 @@ public interface IMovedDispenseItemBehaviour { static void init() { MovedProjectileDispenserBehaviour movedPotionDispenseItemBehaviour = new MovedProjectileDispenserBehaviour() { @Override - protected IProjectile getProjectileEntity(World world, double x, double y, double z, ItemStack itemStack) { + protected ProjectileEntity getProjectileEntity(World world, double x, double y, double z, ItemStack itemStack) { return Util.make(new PotionEntity(world, x, y, z), (p_218411_1_) -> p_218411_1_.setItem(itemStack)); } @@ -54,7 +52,7 @@ public interface IMovedDispenseItemBehaviour { DispenserMovementBehaviour.registerMovedDispenseItemBehaviour(Items.TNT, new MovedDefaultDispenseItemBehaviour() { @Override - protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3d facing) { + protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vector3d facing) { double x = pos.getX() + facing.x * .7 + .5; double y = pos.getY() + facing.y * .7 + .5; double z = pos.getZ() + facing.z * .7 + .5; @@ -70,7 +68,7 @@ public interface IMovedDispenseItemBehaviour { DispenserMovementBehaviour.registerMovedDispenseItemBehaviour(Items.FIREWORK_ROCKET, new MovedDefaultDispenseItemBehaviour() { @Override - protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3d facing) { + protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vector3d facing) { double x = pos.getX() + facing.x * .7 + .5; double y = pos.getY() + facing.y * .7 + .5; double z = pos.getZ() + facing.z * .7 + .5; @@ -95,7 +93,7 @@ public interface IMovedDispenseItemBehaviour { } @Override - protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3d facing) { + protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vector3d facing) { Random random = context.world.rand; double x = pos.getX() + facing.x * .7 + .5; double y = pos.getY() + facing.y * .7 + .5; @@ -110,16 +108,16 @@ public interface IMovedDispenseItemBehaviour { DispenserMovementBehaviour.registerMovedDispenseItemBehaviour(Items.GLASS_BOTTLE, new MovedOptionalDispenseBehaviour() { @Override - protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3d facing) { + protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vector3d facing) { this.successful = false; BlockPos interactAt = pos.offset(getClosestFacingDirection(facing)); BlockState state = context.world.getBlockState(interactAt); Block block = state.getBlock(); - if (block.isIn(BlockTags.field_226151_aa_) && state.get(BeehiveBlock.HONEY_LEVEL) >= 5) { // Beehive -> honey bottles + if (state.method_27851(BlockTags.BEEHIVES, (p_239787_0_) -> p_239787_0_.contains(BeehiveBlock.HONEY_LEVEL)) && state.get(BeehiveBlock.HONEY_LEVEL) >= 5) { // Beehive -> honey bottles ((BeehiveBlock) block).takeHoney(context.world, state, interactAt, null, BeehiveTileEntity.State.BEE_RELEASED); this.successful = true; - return placeItemInInventory(itemStack, new ItemStack(Items.field_226638_pX_), context, pos, facing); + return placeItemInInventory(itemStack, new ItemStack(Items.HONEY_BOTTLE), context, pos, facing); } else if (context.world.getFluidState(interactAt).isTagged(FluidTags.WATER)) { this.successful = true; return placeItemInInventory(itemStack, PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.WATER), context, pos, facing); @@ -131,7 +129,7 @@ public interface IMovedDispenseItemBehaviour { DispenserMovementBehaviour.registerMovedDispenseItemBehaviour(Items.BUCKET, new MovedDefaultDispenseItemBehaviour() { @Override - protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3d facing) { + protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vector3d facing) { BlockPos interactAt = pos.offset(getClosestFacingDirection(facing)); BlockState state = context.world.getBlockState(interactAt); Block block = state.getBlock(); @@ -146,7 +144,7 @@ public interface IMovedDispenseItemBehaviour { final IMovedDispenseItemBehaviour spawnEggDispenseBehaviour = new MovedDefaultDispenseItemBehaviour() { @Override - protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3d facing) { + protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vector3d facing) { if (!(itemStack.getItem() instanceof SpawnEggItem)) return super.dispenseStack(itemStack, context, pos, facing); EntityType entityType = ((SpawnEggItem) itemStack.getItem()).getType(itemStack.getTag()); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/MovedDefaultDispenseItemBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/MovedDefaultDispenseItemBehaviour.java index 6318da0f4..dc95e1144 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/MovedDefaultDispenseItemBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/MovedDefaultDispenseItemBehaviour.java @@ -9,7 +9,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.HopperTileEntity; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraftforge.items.ItemHandlerHelper; @@ -17,7 +17,7 @@ import net.minecraftforge.items.ItemHandlerHelper; public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBehaviour { private static final MovedDefaultDispenseItemBehaviour defaultInstance = new MovedDefaultDispenseItemBehaviour(); - public static void doDispense(World p_82486_0_, ItemStack p_82486_1_, int p_82486_2_, Vec3d facing, BlockPos p_82486_4_, MovementContext context) { + public static void doDispense(World p_82486_0_, ItemStack p_82486_1_, int p_82486_2_, Vector3d facing, BlockPos p_82486_4_, MovementContext context) { double d0 = p_82486_4_.getX() + facing.x + .5; double d1 = p_82486_4_.getY() + facing.y + .5; double d2 = p_82486_4_.getZ() + facing.z + .5; @@ -35,7 +35,7 @@ public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBeha @Override public ItemStack dispense(ItemStack itemStack, MovementContext context, BlockPos pos) { - Vec3d facingVec = new Vec3d(context.state.get(DispenserBlock.FACING).getDirectionVec()); + Vector3d facingVec = Vector3d.of(context.state.get(DispenserBlock.FACING).getDirectionVec()); facingVec = VecHelper.rotate(facingVec, context.rotation.x, context.rotation.y, context.rotation.z); facingVec.normalize(); @@ -55,7 +55,7 @@ public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBeha /** * Dispense the specified stack, play the dispense sound and spawn particles. */ - protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3d facing) { + protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vector3d facing) { ItemStack itemstack = itemStack.split(1); doDispense(context.world, itemstack, 6, facing, pos, context); return itemStack; @@ -71,7 +71,7 @@ public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBeha /** * Order clients to display dispense particles from the specified block and facing. */ - protected void spawnDispenseParticles(IWorld world, BlockPos pos, Vec3d facing) { + protected void spawnDispenseParticles(IWorld world, BlockPos pos, Vector3d facing) { spawnDispenseParticles(world, pos, getClosestFacingDirection(facing)); } @@ -79,11 +79,11 @@ public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBeha world.playEvent(2000, pos, direction.getIndex()); } - protected Direction getClosestFacingDirection(Vec3d exactFacing) { + protected Direction getClosestFacingDirection(Vector3d exactFacing) { return Direction.getFacingFromVector(exactFacing.x, exactFacing.y, exactFacing.z); } - protected ItemStack placeItemInInventory(ItemStack consumedFrom, ItemStack output, MovementContext context, BlockPos pos, Vec3d facing) { + protected ItemStack placeItemInInventory(ItemStack consumedFrom, ItemStack output, MovementContext context, BlockPos pos, Vector3d facing) { consumedFrom.shrink(1); ItemStack remainder = ItemHandlerHelper.insertItem(context.contraption.inventory, output.copy(), false); if (!remainder.isEmpty()) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/MovedProjectileDispenserBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/MovedProjectileDispenserBehaviour.java index aa332a1f6..4d88a7dfd 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/MovedProjectileDispenserBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/MovedProjectileDispenserBehaviour.java @@ -4,10 +4,10 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov import net.minecraft.dispenser.IPosition; import net.minecraft.dispenser.ProjectileDispenseBehavior; import net.minecraft.entity.Entity; -import net.minecraft.entity.IProjectile; +import net.minecraft.entity.projectile.ProjectileEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; @@ -18,16 +18,16 @@ import java.lang.reflect.Method; public abstract class MovedProjectileDispenserBehaviour extends MovedDefaultDispenseItemBehaviour { @Override - protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3d facing) { + protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vector3d facing) { double x = pos.getX() + facing.x * .7 + .5; double y = pos.getY() + facing.y * .7 + .5; double z = pos.getZ() + facing.z * .7 + .5; - IProjectile iprojectile = this.getProjectileEntity(context.world, x, y, z, itemStack.copy()); - if (iprojectile == null) + ProjectileEntity ProjectileEntity = this.getProjectileEntity(context.world, x, y, z, itemStack.copy()); + if (ProjectileEntity == null) return itemStack; - Vec3d effectiveMovementVec = facing.scale(getProjectileVelocity()).add(context.motion); - iprojectile.shoot(effectiveMovementVec.x, effectiveMovementVec.y, effectiveMovementVec.z, (float) effectiveMovementVec.length(), this.getProjectileInaccuracy()); - context.world.addEntity((Entity) iprojectile); + Vector3d effectiveMovementVec = facing.scale(getProjectileVelocity()).add(context.motion); + ProjectileEntity.shoot(effectiveMovementVec.x, effectiveMovementVec.y, effectiveMovementVec.z, (float) effectiveMovementVec.length(), this.getProjectileInaccuracy()); + context.world.addEntity(ProjectileEntity); itemStack.shrink(1); return itemStack; } @@ -38,7 +38,7 @@ public abstract class MovedProjectileDispenserBehaviour extends MovedDefaultDisp } @Nullable - protected abstract IProjectile getProjectileEntity(World world, double x, double y, double z, ItemStack itemStack); + protected abstract ProjectileEntity getProjectileEntity(World world, double x, double y, double z, ItemStack itemStack); protected float getProjectileInaccuracy() { return 6.0F; @@ -51,9 +51,9 @@ public abstract class MovedProjectileDispenserBehaviour extends MovedDefaultDisp public static MovedProjectileDispenserBehaviour of(ProjectileDispenseBehavior vanillaBehaviour) { return new MovedProjectileDispenserBehaviour() { @Override - protected IProjectile getProjectileEntity(World world, double x, double y, double z, ItemStack itemStack) { + protected ProjectileEntity getProjectileEntity(World world, double x, double y, double z, ItemStack itemStack) { try { - return (IProjectile) MovedProjectileDispenserBehaviour.getProjectileEntityLookup().invoke(vanillaBehaviour, world, new SimplePos(x, y, z) , itemStack); + return (ProjectileEntity) MovedProjectileDispenserBehaviour.getProjectileEntityLookup().invoke(vanillaBehaviour, world, new SimplePos(x, y, z) , itemStack); } catch (Throwable ignored) { } return null; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/clock/CuckooClockTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/clock/CuckooClockTileEntity.java index 67d7bcde6..d8292a4e8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/clock/CuckooClockTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/clock/CuckooClockTileEntity.java @@ -83,7 +83,7 @@ public class CuckooClockTileEntity extends KineticTileEntity { if (animationType == Animation.SURPRISE && animationProgress.value == 50) { Vector3d center = VecHelper.getCenterOf(pos); world.destroyBlock(pos, false); - world.createExplosion(null, CUCKOO_SURPRISE, center.x, center.y, center.z, 3, false, + world.createExplosion(null, CUCKOO_SURPRISE, null, center.x, center.y, center.z, 3, false, Explosion.Mode.BREAK); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/ConnectedInputHandler.java b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/ConnectedInputHandler.java index 186b1bd1f..080b29baf 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/ConnectedInputHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/ConnectedInputHandler.java @@ -1,20 +1,7 @@ package com.simibubi.create.content.contraptions.components.crafter; -import static com.simibubi.create.content.contraptions.base.HorizontalKineticBlock.HORIZONTAL_FACING; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; - -import com.google.common.base.Predicates; import com.simibubi.create.AllBlocks; - +import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; @@ -29,11 +16,17 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.wrapper.CombinedInvWrapper; +import java.util.*; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import static com.simibubi.create.content.contraptions.base.HorizontalKineticBlock.HORIZONTAL_FACING; + public class ConnectedInputHandler { public static boolean shouldConnect(World world, BlockPos pos, Direction face, Direction direction) { BlockState refState = world.getBlockState(pos); - if (!refState.has(HORIZONTAL_FACING)) + if (!BlockHelper.hasBlockStateProperty(refState, HORIZONTAL_FACING)) return false; Direction refDirection = refState.get(HORIZONTAL_FACING); if (direction.getAxis() == refDirection.getAxis()) @@ -64,7 +57,7 @@ public class ConnectedInputHandler { MechanicalCrafterTileEntity controller = CrafterHelper.getCrafter(world, controllerPos1); Set positions = controller.input.data.stream() - .map(l -> controllerPos1.add(l)) + .map(controllerPos1::add) .collect(Collectors.toSet()); List frontier = new LinkedList<>(); List splitGroup = new ArrayList<>(); @@ -182,7 +175,7 @@ public class ConnectedInputHandler { List list = data.stream() .map(l -> CrafterHelper.getCrafter(world, pos.add(l))) - .filter(Predicates.notNull()) + .filter(Objects::nonNull) .map(crafter -> crafter.inventory) .collect(Collectors.toList()); return new CombinedInvWrapper(Arrays.copyOf(list.toArray(), list.size(), IItemHandlerModifiable[].class)); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterTileEntity.java index ff04715ea..c2b23a85d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterTileEntity.java @@ -177,10 +177,10 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity { groupedItemsBeforeCraft = before; if (phaseBefore == Phase.EXPORTING && phase == Phase.WAITING) { Direction facing = getBlockState().get(MechanicalCrafterBlock.HORIZONTAL_FACING); - Vec3d vec = new Vec3d(facing.getDirectionVec()).scale(.75) + Vector3d vec = Vector3d.of(facing.getDirectionVec()).scale(.75) .add(VecHelper.getCenterOf(pos)); Direction targetDirection = MechanicalCrafterBlock.getTargetDirection(getBlockState()); - vec = vec.add(new Vec3d(targetDirection.getDirectionVec()).scale(1)); + vec = vec.add(Vector3d.of(targetDirection.getDirectionVec()).scale(1)); world.addParticle(ParticleTypes.CRIT, vec.x, vec.y, vec.z, 0, 0, 0); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelBlock.java index cd9c17187..e4b30f2e6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelBlock.java @@ -130,7 +130,7 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock implements ITE public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) { try { CrushingWheelTileEntity te = getTileEntity(worldIn, pos); - if (entityIn.getY() < pos.getY() + 1.25f || !entityIn.onGround) + if (entityIn.getY() < pos.getY() + 1.25f || !entityIn.isOnGround()) return; double x = 0; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerBlock.java index 474e93e1d..37d55f9d8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerBlock.java @@ -84,7 +84,7 @@ public class CrushingWheelControllerBlock extends Block return; try { - CrushingWheelControllerTileEntity te = getTileEntity(worldIn, entityIn.getPosition().down()); + CrushingWheelControllerTileEntity te = getTileEntity(worldIn, entityIn.getBlockPos().down()); if (te.crushingspeed == 0) return; if (entityIn instanceof ItemEntity) @@ -116,11 +116,11 @@ public class CrushingWheelControllerBlock extends Block @Override public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) { - updateSpeed(stateIn, worldIn.getWorld(), currentPos); + updateSpeed(stateIn, worldIn, currentPos); return stateIn; } - public void updateSpeed(BlockState state, World world, BlockPos pos) { + public void updateSpeed(BlockState state, IWorld world, BlockPos pos) { withTileEntityDo(world, pos, te -> { if (!state.get(VALID) || CrushingWheelControllerTileEntity.isFrozen()) { if (te.crushingspeed != 0) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java index 556501767..3ca60c4e2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java @@ -217,7 +217,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity { @Override public void write(CompoundNBT compound, boolean clientPacket) { if (hasEntity()) - compound.put("Entity", NBTUtil.writeUniqueId(entityUUID)); + compound.put("Entity", NBTUtil.fromUuid(entityUUID)); compound.put("Inventory", inventory.serializeNBT()); compound.putFloat("Speed", crushingspeed); super.write(compound, clientPacket); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerFakePlayer.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerFakePlayer.java index a2ee81d99..1d7a8f9c5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerFakePlayer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerFakePlayer.java @@ -74,7 +74,7 @@ public class DeployerFakePlayer extends FakePlayer { } @Override - public Vector3d getPositionVector() { + public Vector3d getPositionVec() { return new Vector3d(getX(), getY(), getZ()); } @@ -94,9 +94,9 @@ public class DeployerFakePlayer extends FakePlayer { } @SubscribeEvent - public static void deployerHasEyesOnHisFeet(EntityEvent.EyeHeight event) { + public static void deployerHasEyesOnHisFeet(EntityEvent.Size event) { if (event.getEntity() instanceof DeployerFakePlayer) - event.setNewHeight(0); + event.setNewEyeHeight(0); } @SubscribeEvent(priority = EventPriority.LOWEST) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/fan/AirCurrent.java b/src/main/java/com/simibubi/create/content/contraptions/components/fan/AirCurrent.java index af56cb136..1e32f3189 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/fan/AirCurrent.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/fan/AirCurrent.java @@ -117,13 +117,13 @@ public class AirCurrent { } else { switch (processingType) { case BLASTING: - if (!entity.isImmuneToFire()) { + if (!entity.isFireImmune()) { entity.setFire(10); entity.attackEntityFrom(damageSourceLava, 4); } break; case SMOKING: - if (!entity.isImmuneToFire()) { + if (!entity.isFireImmune()) { entity.setFire(2); entity.attackEntityFrom(damageSourceFire, 2); } @@ -136,7 +136,7 @@ public class AirCurrent { if (!entity.isBurning()) break; entity.extinguish(); - world.playSound(null, entity.getPosition(), SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE, + world.playSound(null, entity.getBlockPos(), SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE, SoundCategory.NEUTRAL, 0.7F, 1.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.4F); break; @@ -168,7 +168,7 @@ public class AirCurrent { BlockPos start = source.getPos(); float max = this.maxDistance; Direction facing = direction; - Vec3d directionVec = new Vec3d(facing.getDirectionVec()); + Vector3d directionVec = Vector3d.of(facing.getDirectionVec()); maxDistance = getFlowLimit(world, start, max, facing); // Determine segments with transported fluids/gases @@ -216,12 +216,12 @@ public class AirCurrent { } public static float getFlowLimit(World world, BlockPos start, float max, Direction facing) { - Vec3d directionVec = new Vec3d(facing.getDirectionVec()); - Vec3d planeVec = VecHelper.axisAlingedPlaneOf(directionVec); + Vector3d directionVec = Vector3d.of(facing.getDirectionVec()); + Vector3d planeVec = VecHelper.axisAlingedPlaneOf(directionVec); // 4 Rays test for holes in the shapes blocking the flow float offsetDistance = .25f; - Vec3d[] offsets = new Vec3d[] { planeVec.mul(offsetDistance, offsetDistance, offsetDistance), + Vector3d[] offsets = new Vector3d[] { planeVec.mul(offsetDistance, offsetDistance, offsetDistance), planeVec.mul(-offsetDistance, -offsetDistance, offsetDistance), planeVec.mul(offsetDistance, -offsetDistance, -offsetDistance), planeVec.mul(-offsetDistance, offsetDistance, -offsetDistance), }; @@ -244,11 +244,11 @@ public class AirCurrent { break; } - for (Vec3d offset : offsets) { - Vec3d rayStart = VecHelper.getCenterOf(currentPos) + for (Vector3d offset : offsets) { + Vector3d rayStart = VecHelper.getCenterOf(currentPos) .subtract(directionVec.scale(.5f + 1 / 32f)) .add(offset); - Vec3d rayEnd = rayStart.add(directionVec.scale(1 + 1 / 32f)); + Vector3d rayEnd = rayStart.add(directionVec.scale(1 + 1 / 32f)); BlockRayTraceResult blockraytraceresult = world.rayTraceBlocks(rayStart, rayEnd, currentPos, voxelshape, state); if (blockraytraceresult == null) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanTileEntity.java index 6a881f464..277d08693 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanTileEntity.java @@ -7,6 +7,7 @@ import com.simibubi.create.content.logistics.block.chute.ChuteTileEntity; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.config.CKinetics; +import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.state.properties.BlockStateProperties; @@ -78,11 +79,11 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity { .isIn(AllBlockTags.FAN_HEATERS.tag)) return false; - if (checkState.has(BlazeBurnerBlock.HEAT_LEVEL) && !checkState.get(BlazeBurnerBlock.HEAT_LEVEL) + if (BlockHelper.hasBlockStateProperty(checkState, BlazeBurnerBlock.HEAT_LEVEL) && !checkState.get(BlazeBurnerBlock.HEAT_LEVEL) .isAtLeast(BlazeBurnerBlock.HeatLevel.FADING)) return false; - if (checkState.has(BlockStateProperties.LIT) && !checkState.get(BlockStateProperties.LIT)) + if (BlockHelper.hasBlockStateProperty(checkState, BlockStateProperties.LIT) && !checkState.get(BlockStateProperties.LIT)) return false; return true; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelGenerator.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelGenerator.java index 746e22676..13dc7759d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelGenerator.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelGenerator.java @@ -25,7 +25,6 @@ public class FlywheelGenerator extends SpecialBlockStateGen { BlockState state) { return prov.models() .getExistingFile(prov.modLoc("block/" + ctx.getName() + "/casing_" + state.get(FlywheelBlock.CONNECTION) - .getName())); + .getString())); } - } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineTileEntity.java index a0869af09..5212b98ed 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineTileEntity.java @@ -29,11 +29,6 @@ public class EngineTileEntity extends SmartTileEntity { public void addBehaviours(List behaviours) { } - @Override - public boolean hasFastRenderer() { - return true; - } - @Override public AxisAlignedBB getRenderBoundingBox() { return super.getRenderBoundingBox().grow(1.5f); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/FurnaceEngineTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/FurnaceEngineTileEntity.java index 725cb3364..f35b87823 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/FurnaceEngineTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/FurnaceEngineTileEntity.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.flywheel.engine; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.config.AllConfigs; +import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.block.AbstractFurnaceBlock; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -26,7 +27,7 @@ public class FurnaceEngineTileEntity extends EngineTileEntity { return; float modifier = state.getBlock() == Blocks.BLAST_FURNACE ? 2 : 1; - boolean active = state.has(AbstractFurnaceBlock.LIT) && state.get(AbstractFurnaceBlock.LIT); + boolean active = BlockHelper.hasBlockStateProperty(state, AbstractFurnaceBlock.LIT) && state.get(AbstractFurnaceBlock.LIT); float speed = active ? 16 * modifier : 0; float capacity = (float) (active ? AllConfigs.SERVER.kinetics.stressValues.getCapacityOf(AllBlocks.FURNACE_ENGINE.get()) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillstoneBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillstoneBlock.java index 8ff4a1dfd..2c6c3630a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillstoneBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillstoneBlock.java @@ -95,7 +95,7 @@ public class MillstoneBlock extends KineticBlock implements ITE { if (te.getSpeed() == 0) return; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java index 880017bec..1f44316bb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java @@ -20,6 +20,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pul import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyTileEntity; import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkBlock; +import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.block.AbstractPressurePlateBlock; import net.minecraft.block.AbstractRailBlock; import net.minecraft.block.BellBlock; @@ -101,7 +102,7 @@ public class BlockMovementTraits { */ public static boolean isBrittle(BlockState state) { Block block = state.getBlock(); - if (state.has(BlockStateProperties.HANGING)) + if (BlockHelper.hasBlockStateProperty(state, BlockStateProperties.HANGING)) return true; if (block instanceof LadderBlock) @@ -161,7 +162,7 @@ public class BlockMovementTraits { if (attachFace == AttachFace.WALL) return direction.getOpposite() == state.get(HorizontalFaceBlock.HORIZONTAL_FACING); } - if (state.has(BlockStateProperties.HANGING)) + if (BlockHelper.hasBlockStateProperty(state, BlockStateProperties.HANGING)) return direction == (state.get(BlockStateProperties.HANGING) ? Direction.UP : Direction.DOWN); if (block instanceof AbstractRailBlock) return direction == Direction.DOWN; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java index 890777321..985c73685 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java @@ -17,6 +17,7 @@ import java.util.stream.Collectors; import javax.annotation.Nullable; +import com.simibubi.create.foundation.utility.BlockHelper; import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.Pair; @@ -472,7 +473,7 @@ public abstract class Contraption { tag.putInt("y", info.pos.getY()); tag.putInt("z", info.pos.getZ()); - TileEntity te = TileEntity.create(tag); + TileEntity te = TileEntity.createFromTag(info.state, tag); if (te == null) return; te.setLocation(new WrappedWorld(world) { @@ -575,7 +576,7 @@ public abstract class Contraption { nbt.put("Seats", NBTHelper.writeCompoundList(getSeats(), NBTUtil::writeBlockPos)); nbt.put("Passengers", NBTHelper.writeCompoundList(getSeatMapping().entrySet(), e -> { CompoundNBT tag = new CompoundNBT(); - tag.put("Id", NBTUtil.writeUniqueId(e.getKey())); + tag.put("Id", NBTUtil.fromUuid(e.getKey())); tag.putInt("Seat", e.getValue()); return tag; })); @@ -603,7 +604,7 @@ public abstract class Contraption { return false; } - public void removeBlocksFromWorld(IWorld world, BlockPos offset) { + public void removeBlocksFromWorld(World world, BlockPos offset) { storage.values() .forEach(MountedStorage::removeStorageFromWorld); glueToRemove.forEach(SuperGlueEntity::remove); @@ -623,14 +624,12 @@ public abstract class Contraption { Block blockIn = oldState.getBlock(); if (block.state.getBlock() != blockIn) iterator.remove(); - world.getWorld() - .removeTileEntity(add); + world.removeTileEntity(add); int flags = 67; if (blockIn instanceof DoorBlock) flags = flags | 32 | 16; - if (blockIn instanceof IWaterLoggable && oldState.has(BlockStateProperties.WATERLOGGED) - && oldState.get(BlockStateProperties.WATERLOGGED) - .booleanValue()) { + if (blockIn instanceof IWaterLoggable && BlockHelper.hasBlockStateProperty(oldState, BlockStateProperties.WATERLOGGED) + && oldState.get(BlockStateProperties.WATERLOGGED)) { world.setBlockState(add, Blocks.WATER.getDefaultState(), flags); continue; } @@ -671,10 +670,10 @@ public abstract class Contraption { Block.spawnDrops(state, world, targetPos, null); continue; } - if (state.getBlock() instanceof IWaterLoggable && state.has(BlockStateProperties.WATERLOGGED)) { - IFluidState ifluidstate = world.getFluidState(targetPos); + if (state.getBlock() instanceof IWaterLoggable && BlockHelper.hasBlockStateProperty(state, BlockStateProperties.WATERLOGGED)) { + FluidState FluidState = world.getFluidState(targetPos); state = state.with(BlockStateProperties.WATERLOGGED, - Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER)); + FluidState.getFluid() == Fluids.WATER); } world.destroyBlock(targetPos, true); @@ -699,7 +698,7 @@ public abstract class Contraption { tag.remove("InitialOffset"); } - tileEntity.read(tag); + tileEntity.fromTag(tileEntity.getBlockState(), tag); if (storage.containsKey(block.pos)) { MountedStorage mountedStorage = storage.get(block.pos); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java index 6b213271c..8a6e01a9f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java @@ -210,7 +210,7 @@ public class ContraptionCollider { Vector3d contactPointMotion = Vector3d.ZERO; if (surfaceCollision.isTrue()) { entity.fallDistance = 0; - entity.onGround = true; + entity.setOnGround(true); contraptionEntity.collidingEntities.add(entity); if (!serverPlayer) contactPointMotion = contraptionEntity.getContactPointMotion(entityPosition); @@ -273,7 +273,7 @@ public class ContraptionCollider { boolean flag = movement.x != Vector3d.x; boolean flag1 = movement.y != Vector3d.y; boolean flag2 = movement.z != Vector3d.z; - boolean flag3 = e.onGround || flag1 && movement.y < 0.0D; + boolean flag3 = e.isOnGround() || flag1 && movement.y < 0.0D; if (e.stepHeight > 0.0F && flag3 && (flag || flag2)) { Vector3d Vector3d1 = collideBoundingBoxHeuristically(e, new Vector3d(movement.x, (double) e.stepHeight, movement.z), bb, world, ctx, reuseablestream); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionEntity.java index 61289a5e2..071eef5be 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionEntity.java @@ -11,6 +11,7 @@ import java.util.UUID; import javax.annotation.Nullable; +import net.minecraft.entity.projectile.ProjectileEntity; import org.apache.commons.lang3.tuple.MutablePair; import com.simibubi.create.AllEntityTypes; @@ -32,7 +33,7 @@ import net.minecraft.block.material.PushReaction; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; -import net.minecraft.entity.IProjectile; +import net.minecraft.entity.ProjectileEntity; import net.minecraft.entity.item.BoatEntity; import net.minecraft.entity.item.HangingEntity; import net.minecraft.entity.item.minecart.AbstractMinecartEntity; @@ -344,7 +345,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD if (coupling != null && coupling.areBothEndsPresent()) { boolean notOnMainCart = !coupling.getId() .equals(riding.getUniqueID()); - Vec3d positionVec = coupling.asCouple() + Vector3d positionVec = coupling.asCouple() .get(notOnMainCart) .getPositionVec(); prevYaw = yaw; @@ -365,11 +366,11 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD pauseWhileRotating = mountedContraption.rotationMode == CartMovementMode.ROTATE_PAUSED; } - Vec3d movementVector = riding.getMotion(); + Vector3d movementVector = riding.getMotion(); if (!isOnCoupling) { if (riding instanceof BoatEntity) movementVector = getPositionVec().subtract(prevPosX, prevPosY, prevPosZ); - Vec3d motion = movementVector.normalize(); + Vector3d motion = movementVector.normalize(); if (!rotationLock) { if (motion.length() > 0) { @@ -469,7 +470,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD boolean newPosVisited = false; BlockPos gridPosition = new BlockPos(actorPosition); - Vec3d oldMotion = context.motion; + Vector3d oldMotion = context.motion; if (!context.stall) { Vector3d previousPosition = context.position; @@ -486,7 +487,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD BearingContraption bc = (BearingContraption) getContraption(); Direction facing = bc.getFacing(); Vector3d activeAreaOffset = actor.getActiveAreaOffset(context); - if (activeAreaOffset.mul(VecHelper.axisAlingedPlaneOf(new Vec3d(facing.getDirectionVec()))) + if (activeAreaOffset.mul(VecHelper.axisAlingedPlaneOf(Vector3d.of(facing.getDirectionVec()))) .equals(Vector3d.ZERO)) { if (VecHelper.onSameAxis(blockInfo.pos, BlockPos.ZERO, facing.getAxis())) { context.motion = Vector3d.of(facing.getDirectionVec()).scale(facing.getAxis() @@ -676,8 +677,8 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD compound.putBoolean("Initialized", initialized); if (getCouplingId() != null) { - compound.put("OnCoupling", NBTUtil.writeUniqueId(getCouplingId())); - compound.put("CoupledCart", NBTUtil.writeUniqueId(getCoupledCart())); + compound.put("OnCoupling", NBTUtil.fromUuid(getCouplingId())); + compound.put("CoupledCart", NBTUtil.fromUuid(getCoupledCart())); } } @@ -876,7 +877,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD return false; if (e instanceof SeatEntity) return false; - if (e instanceof IProjectile) + if (e instanceof ProjectileEntity) return false; if (e.getRidingEntity() != null) return false; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionHandler.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionHandler.java index ff63f6662..ecba01568 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionHandler.java @@ -14,7 +14,7 @@ import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants.NBT; @@ -42,7 +42,7 @@ public class ContraptionHandler { CompoundNBT data = entityLiving.getPersistentData(); if (!data.contains("ContraptionDismountLocation")) return; - Vec3d position = VecHelper.readNBT(data.getList("ContraptionDismountLocation", NBT.TAG_DOUBLE)); + Vector3d position = VecHelper.readNBT(data.getList("ContraptionDismountLocation", NBT.TAG_DOUBLE)); if (entityLiving.getRidingEntity() == null) entityLiving.setPositionAndUpdate(position.x, position.y, position.z); data.remove("ContraptionDismountLocation"); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionInteractionHandler.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionInteractionHandler.java index 36ada9e88..c8c5bcc08 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionInteractionHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionInteractionHandler.java @@ -14,7 +14,7 @@ import net.minecraft.util.Hand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.gen.feature.template.Template.BlockInfo; import net.minecraftforge.api.distmarker.Dist; @@ -37,18 +37,18 @@ public class ContraptionInteractionHandler { return; if (!event.isUseItem()) return; - Vec3d origin = RaycastHelper.getTraceOrigin(player); + Vector3d origin = RaycastHelper.getTraceOrigin(player); double reach = mc.playerController.getBlockReachDistance(); if (mc.objectMouseOver != null && mc.objectMouseOver.getHitVec() != null) reach = Math.min(mc.objectMouseOver.getHitVec().distanceTo(origin), reach); - Vec3d target = RaycastHelper.getTraceTarget(player, reach, origin); + Vector3d target = RaycastHelper.getTraceTarget(player, reach, origin); for (ContraptionEntity contraptionEntity : mc.world.getEntitiesWithinAABB(ContraptionEntity.class, new AxisAlignedBB(origin, target))) { - Vec3d localOrigin = contraptionEntity.toLocalVector(origin); - Vec3d localTarget = contraptionEntity.toLocalVector(target); + Vector3d localOrigin = contraptionEntity.toLocalVector(origin); + Vector3d localTarget = contraptionEntity.toLocalVector(target); Contraption contraption = contraptionEntity.getContraption(); MutableObject mutableResult = new MutableObject<>(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementBehaviour.java index c2eacc244..3a921a392 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementBehaviour.java @@ -55,7 +55,7 @@ public abstract class MovementBehaviour { public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal, IRenderTypeBuffer buffer) {} - public void onSpeedChanged(MovementContext context, Vec3d oldMotion, Vec3d motion) { + public void onSpeedChanged(MovementContext context, Vector3d oldMotion, Vector3d motion) { } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementContext.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementContext.java index a869c5ead..fd60631e6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementContext.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementContext.java @@ -8,6 +8,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraft.world.gen.feature.template.Template.BlockInfo; +import net.minecraft.world.server.ServerWorld; import net.minecraftforge.common.util.Constants.NBT; public class MovementContext { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/StructureTransform.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/StructureTransform.java index 4f885887b..d8b35d596 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/StructureTransform.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/StructureTransform.java @@ -10,6 +10,7 @@ import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock import com.simibubi.create.content.contraptions.components.structureMovement.chassis.AbstractChassisBlock; import com.simibubi.create.content.contraptions.relays.belt.BeltBlock; import com.simibubi.create.content.contraptions.relays.belt.BeltSlope; +import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.DirectionHelper; import com.simibubi.create.foundation.utility.VecHelper; @@ -69,10 +70,10 @@ public class StructureTransform { } - public Vec3d apply(Vec3d localVec) { - Vec3d vec = localVec; + public Vector3d apply(Vector3d localVec) { + Vector3d vec = localVec; vec = VecHelper.rotateCentered(vec, angle, rotationAxis); - vec = vec.add(new Vec3d(offset)); + vec = vec.add(Vector3d.of(offset)); return vec; } @@ -146,33 +147,33 @@ public class StructureTransform { return state; } - if (state.has(FACING)) { + if (BlockHelper.hasBlockStateProperty(state, FACING)) { Direction newFacing = transformFacing(state.get(FACING)); - if (state.has(DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE)) { + if (BlockHelper.hasBlockStateProperty(state, DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE)) { if (rotationAxis == newFacing.getAxis() && rotation.ordinal() % 2 == 1) state = state.cycle(DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE); } state = state.with(FACING, newFacing); - } else if (state.has(AXIS)) { + } else if (BlockHelper.hasBlockStateProperty(state, AXIS)) { state = state.with(AXIS, transformAxis(state.get(AXIS))); } else if (halfTurn) { - if (state.has(FACING)) { + if (BlockHelper.hasBlockStateProperty(state, FACING)) { Direction stateFacing = state.get(FACING); if (stateFacing.getAxis() == rotationAxis) return state; } - if (state.has(HORIZONTAL_FACING)) { + if (BlockHelper.hasBlockStateProperty(state, HORIZONTAL_FACING)) { Direction stateFacing = state.get(HORIZONTAL_FACING); if (stateFacing.getAxis() == rotationAxis) return state; } state = state.rotate(rotation); - if (state.has(SlabBlock.TYPE) && state.get(SlabBlock.TYPE) != SlabType.DOUBLE) + if (BlockHelper.hasBlockStateProperty(state, SlabBlock.TYPE) && state.get(SlabBlock.TYPE) != SlabType.DOUBLE) state = state.with(SlabBlock.TYPE, state.get(SlabBlock.TYPE) == SlabType.BOTTOM ? SlabType.TOP : SlabType.BOTTOM); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/MechanicalBearingTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/MechanicalBearingTileEntity.java index 5c63ba8b7..594c49e0d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/MechanicalBearingTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/MechanicalBearingTileEntity.java @@ -12,6 +12,7 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOptionBehaviour; import com.simibubi.create.foundation.utility.AngleHelper; +import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.ServerSpeedProvider; @@ -269,7 +270,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp BlockState blockState = getBlockState(); if (!(contraption.getContraption() instanceof BearingContraption)) return; - if (!blockState.has(FACING)) + if (!BlockHelper.hasBlockStateProperty(blockState, FACING)) return; this.movedContraption = contraption; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/ChassisRangeDisplay.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/ChassisRangeDisplay.java index 796c5793e..b8784ba92 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/ChassisRangeDisplay.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/ChassisRangeDisplay.java @@ -43,7 +43,7 @@ public class ChassisRangeDisplay { } protected Object getOutlineKey() { - return Pair.of(te.getPos(), new Integer(1)); + return Pair.of(te.getPos(), 1); } protected Set createSelection(ChassisTileEntity chassis) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java index 6728d4906..296dc0d18 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.gl import javax.annotation.Nullable; +import net.minecraft.world.server.ServerWorld; import org.apache.commons.lang3.Validate; import com.simibubi.create.AllEntityTypes; @@ -247,11 +248,11 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat } @Override - public boolean processInitialInteract(PlayerEntity player, Hand hand) { + public ActionResultType processInitialInteract(PlayerEntity player, Hand hand) { DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { triggerPlaceBlock(player, hand); }); - return true; + return ActionResultType.CONSUME; } @OnlyIn(Dist.CLIENT) @@ -367,7 +368,7 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat } @Override - public void onStruckByLightning(LightningBoltEntity lightningBolt) {} + public void onStruckByLightning(ServerWorld world, LightningBoltEntity lightningBolt) {} @Override public void recalculateSize() {} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueHandler.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueHandler.java index 35d2f5ffb..f9ba42fa5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueHandler.java @@ -11,6 +11,7 @@ import com.simibubi.create.foundation.utility.worldWrappers.RayTraceWorld; import net.minecraft.block.Blocks; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; +import net.minecraft.entity.ai.attributes.ModifiableAttributeInstance; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; @@ -23,6 +24,7 @@ import net.minecraft.util.math.RayTraceResult.Type; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.IWorld; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeMod; import net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @@ -63,11 +65,11 @@ public class SuperGlueHandler { public static void glueInOffHandAppliesOnBlockPlace(EntityPlaceEvent event, BlockPos pos, PlayerEntity placer) { ItemStack itemstack = placer.getHeldItemOffhand(); - if (!AllItems.SUPER_GLUE.isIn(itemstack)) + ModifiableAttributeInstance reachAttribute = placer.getAttribute(ForgeMod.REACH_DISTANCE.get()); + if (!AllItems.SUPER_GLUE.isIn(itemstack) || reachAttribute == null) return; - double distance = placer.getAttribute(PlayerEntity.REACH_DISTANCE) - .getValue(); + double distance = reachAttribute.getValue(); Vector3d start = placer.getEyePosition(1); Vector3d look = placer.getLook(1); Vector3d end = start.add(look.x * distance, look.y * distance, look.z * distance); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java index 805437c2c..4624ca2f9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java @@ -219,7 +219,7 @@ public class CartAssemblerBlock extends AbstractRailBlock if (couplingFound) { MinecartCouplingHandler.connectCarts(null, world, cart.getEntityId(), contraption.connectedCart.getEntityId()); - Vec3d diff = contraption.connectedCart.getPositionVec() + Vector3d diff = contraption.connectedCart.getPositionVec() .subtract(cart.getPositionVec()); initialAngle = Direction.fromAngle(MathHelper.atan2(diff.z, diff.x) * 180 / Math.PI) .getHorizontalAngle(); @@ -304,10 +304,12 @@ public class CartAssemblerBlock extends AbstractRailBlock return PushReaction.BLOCK; } + /* FIXME: Is there a 1.16 equivalent to be used? Or is this just removed? @Override public boolean isNormalCube(@Nonnull BlockState state, @Nonnull IBlockReader worldIn, @Nonnull BlockPos pos) { return false; } + */ @Override public Class getTileEntityClass() { @@ -338,10 +340,10 @@ public class CartAssemblerBlock extends AbstractRailBlock } @SuppressWarnings("deprecation") - public List getDropedAssembler(BlockState p_220077_0_, ServerWorld p_220077_1_, BlockPos p_220077_2_, + public List getDropedAssembler(BlockState state, ServerWorld world, BlockPos pos, @Nullable TileEntity p_220077_3_, @Nullable Entity p_220077_4_, ItemStack p_220077_5_) { - return super.getDrops(p_220077_0_, (new LootContext.Builder(p_220077_1_)).withRandom(p_220077_1_.rand) - .withParameter(LootParameters.POSITION, p_220077_2_) + return super.getDrops(state, (new LootContext.Builder(world)).withRandom(world.rand) + .withParameter(LootParameters.ORIGIN, Vector3d.of(pos)) .withParameter(LootParameters.TOOL, p_220077_5_) .withNullableParameter(LootParameters.THIS_ENTITY, p_220077_4_) .withNullableParameter(LootParameters.BLOCK_ENTITY, p_220077_3_)); @@ -360,7 +362,8 @@ public class CartAssemblerBlock extends AbstractRailBlock .forEach(itemStack -> { player.inventory.placeItemBackInInventory(world, itemStack); }); - state.spawnAdditionalDrops(world, pos, ItemStack.EMPTY); + if(world instanceof ServerWorld) + state.spawnAdditionalDrops((ServerWorld) world, pos, ItemStack.EMPTY); world.setBlockState(pos, getRailBlock(state)); return ActionResultType.SUCCESS; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MountedContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MountedContraption.java index f8bd4aeb0..29dee066e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MountedContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MountedContraption.java @@ -4,6 +4,7 @@ import static com.simibubi.create.content.contraptions.components.structureMovem import java.util.List; +import com.simibubi.create.foundation.utility.BlockHelper; import org.apache.commons.lang3.tuple.Pair; import com.simibubi.create.AllBlocks; @@ -51,7 +52,7 @@ public class MountedContraption extends Contraption { return null; BlockState state = world.getBlockState(pos); - if (!state.has(RAIL_SHAPE)) + if (!BlockHelper.hasBlockStateProperty(state, RAIL_SHAPE)) return null; MountedContraption contraption = new MountedContraption(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonGenerator.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonGenerator.java index 888c39119..34e30c52c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonGenerator.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonGenerator.java @@ -15,7 +15,7 @@ import net.minecraftforge.client.model.generators.ModelFile; public class MechanicalPistonGenerator extends SpecialBlockStateGen { - private PistonType type; + private final PistonType type; public MechanicalPistonGenerator(PistonType type) { this.type = type; @@ -43,7 +43,7 @@ public class MechanicalPistonGenerator extends SpecialBlockStateGen { PistonState pistonState = state.get(MechanicalPistonBlock.STATE); String path = "block/mechanical_piston"; - String folder = pistonState == PistonState.RETRACTED ? type.getName() : pistonState.getName(); + String folder = pistonState == PistonState.RETRACTED ? type.getString() : pistonState.getString(); String partial = facing.getAxis() == Axis.X ^ axisAlongFirst ? "block_rotated" : "block"; return prov.models() diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonHeadBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonHeadBlock.java index 42f5aac91..f0e1545ec 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonHeadBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonHeadBlock.java @@ -107,7 +107,7 @@ public class MechanicalPistonHeadBlock extends ProperDirectionalBlock implements @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - FluidState ifluidstate = context.getWorld().getFluidState(context.getPos()); - return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER)); + FluidState FluidState = context.getWorld().getFluidState(context.getPos()); + return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(FluidState.getFluid() == Fluids.WATER)); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonExtensionPoleBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonExtensionPoleBlock.java index c7c1b9146..b5c005a73 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonExtensionPoleBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonExtensionPoleBlock.java @@ -91,9 +91,9 @@ public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - FluidState ifluidstate = context.getWorld().getFluidState(context.getPos()); + FluidState FluidState = context.getWorld().getFluidState(context.getPos()); return getDefaultState().with(FACING, context.getFace().getOpposite()) - .with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER)); + .with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(FluidState.getFluid() == Fluids.WATER)); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyBlock.java index fd63be6da..aa342f454 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyBlock.java @@ -5,6 +5,7 @@ import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock; import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.IWaterLoggable; @@ -110,7 +111,7 @@ public class PulleyBlock extends HorizontalAxisKineticBlock implements ITE 0; i--) { BlockPos offset = pos.down(i); BlockState oldState = world.getBlockState(offset); - if (oldState.getBlock() instanceof IWaterLoggable && oldState.has(BlockStateProperties.WATERLOGGED) && oldState.get(BlockStateProperties.WATERLOGGED)) { + if (oldState.getBlock() instanceof IWaterLoggable && BlockHelper.hasBlockStateProperty(oldState, BlockStateProperties.WATERLOGGED) && oldState.get(BlockStateProperties.WATERLOGGED)) { world.setBlockState(offset, Blocks.WATER.getDefaultState(), 66); continue; } @@ -105,19 +106,19 @@ public class PulleyTileEntity extends LinearActuatorTileEntity { if (!removed) { if (offset > 0) { BlockPos magnetPos = pos.down((int) offset); - FluidState ifluidstate = world.getFluidState(magnetPos); + FluidState FluidState = world.getFluidState(magnetPos); world.destroyBlock(magnetPos, world.getBlockState(magnetPos) .getCollisionShape(world, magnetPos) .isEmpty()); - world.setBlockState(magnetPos, AllBlocks.PULLEY_MAGNET.getDefaultState().with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER)), 66); + world.setBlockState(magnetPos, AllBlocks.PULLEY_MAGNET.getDefaultState().with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(FluidState.getFluid() == Fluids.WATER)), 66); } boolean[] waterlog = new boolean[(int) offset]; for (int i = 1; i <= ((int) offset) - 1; i++) { BlockPos ropePos = pos.down(i); - FluidState ifluidstate = world.getFluidState(ropePos); - waterlog[i] = ifluidstate.getFluid() == Fluids.WATER; + FluidState FluidState = world.getFluidState(ropePos); + waterlog[i] = FluidState.getFluid() == Fluids.WATER; world.destroyBlock(ropePos, world.getBlockState(ropePos) .getCollisionShape(world, ropePos) .isEmpty()); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ClientMotionPacket.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ClientMotionPacket.java index a80351080..772a548c9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ClientMotionPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ClientMotionPacket.java @@ -6,21 +6,21 @@ import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.network.PacketBuffer; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.fml.network.NetworkEvent.Context; public class ClientMotionPacket extends SimplePacketBase { - private Vec3d motion; + private Vector3d motion; private boolean onGround; - public ClientMotionPacket(Vec3d motion, boolean onGround) { + public ClientMotionPacket(Vector3d motion, boolean onGround) { this.motion = motion; this.onGround = onGround; } public ClientMotionPacket(PacketBuffer buffer) { - motion = new Vec3d(buffer.readFloat(), buffer.readFloat(), buffer.readFloat()); + motion = new Vector3d(buffer.readFloat(), buffer.readFloat(), buffer.readFloat()); onGround = buffer.readBoolean(); } @@ -41,7 +41,7 @@ public class ClientMotionPacket extends SimplePacketBase { if (sender == null) return; sender.setMotion(motion); - sender.onGround = onGround; + sender.setOnGround(onGround); if (onGround) { sender.handleFallDamage(sender.fallDistance, 1); sender.fallDistance = 0; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/ClientMinecartCouplingHandler.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/ClientMinecartCouplingHandler.java index 30a4fe4ee..e88859cdf 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/ClientMinecartCouplingHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/ClientMinecartCouplingHandler.java @@ -16,7 +16,7 @@ import net.minecraft.particles.IParticleData; import net.minecraft.particles.ParticleTypes; import net.minecraft.particles.RedstoneParticleData; import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; public class ClientMinecartCouplingHandler { @@ -54,11 +54,11 @@ public class ClientMinecartCouplingHandler { private static void spawnSelectionParticles(AxisAlignedBB axisAlignedBB, boolean highlight) { ClientWorld world = Minecraft.getInstance().world; - Vec3d center = axisAlignedBB.getCenter(); + Vector3d center = axisAlignedBB.getCenter(); int amount = highlight ? 100 : 2; IParticleData particleData = highlight ? ParticleTypes.END_ROD : new RedstoneParticleData(1, 1, 1, 1); for (int i = 0; i < amount; i++) { - Vec3d v = VecHelper.offsetRandomly(Vec3d.ZERO, r, 1); + Vector3d v = VecHelper.offsetRandomly(Vector3d.ZERO, r, 1); double yOffset = v.y; v = v.mul(1, 0, 1) .normalize() diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartCouplingRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartCouplingRenderer.java index 90fe48243..1f4238252 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartCouplingRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartCouplingRenderer.java @@ -15,14 +15,14 @@ import net.minecraft.block.Blocks; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.item.minecart.AbstractMinecartEntity; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.math.vector.Vector3f; public class MinecartCouplingRenderer { @@ -35,7 +35,7 @@ public class MinecartCouplingRenderer { carts.map(c -> WorldRenderer.getLightmapCoordinates(world, new BlockPos(c.getBoundingBox() .getCenter()))); - Vec3d center = carts.getFirst() + Vector3d center = carts.getFirst() .getPositionVec() .add(carts.getSecond() .getPositionVec()) @@ -49,12 +49,12 @@ public class MinecartCouplingRenderer { SuperByteBuffer ring = AllBlockPartials.COUPLING_RING.renderOn(renderState); SuperByteBuffer connector = AllBlockPartials.COUPLING_CONNECTOR.renderOn(renderState); - Vec3d zero = Vec3d.ZERO; - Vec3d firstEndpoint = transforms.getFirst() + Vector3d zero = Vector3d.ZERO; + Vector3d firstEndpoint = transforms.getFirst() .apply(zero); - Vec3d secondEndpoint = transforms.getSecond() + Vector3d secondEndpoint = transforms.getSecond() .apply(zero); - Vec3d endPointDiff = secondEndpoint.subtract(firstEndpoint); + Vector3d endPointDiff = secondEndpoint.subtract(firstEndpoint); double connectorYaw = -Math.atan2(endPointDiff.z, endPointDiff.x) * 180.0D / Math.PI; double connectorPitch = Math.atan2(endPointDiff.y, endPointDiff.mul(1, 0, 1) .length()) * 180 / Math.PI; @@ -89,7 +89,7 @@ public class MinecartCouplingRenderer { ms.pop(); } - private static CartEndpoint getSuitableCartEndpoint(AbstractMinecartEntity cart, Vec3d centerOfCoupling) { + private static CartEndpoint getSuitableCartEndpoint(AbstractMinecartEntity cart, Vector3d centerOfCoupling) { long i = cart.getEntityId() * 493286711L; i = i * i * 4392167121L + i * 98761L; float x = (((float) (i >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; @@ -112,11 +112,11 @@ public class MinecartCouplingRenderer { rollAmplifier = 0.0F; roll = roll > 0 ? MathHelper.sin(roll) * roll * rollAmplifier / 10.0F * cart.getRollingDirection() : 0; - Vec3d positionVec = new Vec3d(xIn, yIn, zIn); - Vec3d frontVec = positionVec.add(VecHelper.rotate(new Vec3d(.5, 0, 0), 180 - yaw, Axis.Y)); - Vec3d backVec = positionVec.add(VecHelper.rotate(new Vec3d(-.5, 0, 0), 180 - yaw, Axis.Y)); + Vector3d positionVec = new Vector3d(xIn, yIn, zIn); + Vector3d frontVec = positionVec.add(VecHelper.rotate(new Vector3d(.5, 0, 0), 180 - yaw, Axis.Y)); + Vector3d backVec = positionVec.add(VecHelper.rotate(new Vector3d(-.5, 0, 0), 180 - yaw, Axis.Y)); - Vec3d railVecOfPos = cart.getPos(xIn, yIn, zIn); + Vector3d railVecOfPos = cart.getPos(xIn, yIn, zIn); boolean flip = false; if (railVecOfPos != null) { @@ -131,7 +131,7 @@ public class MinecartCouplingRenderer { y += (frontVec.y + backVec.y) / 2; z += railVecOfPos.z; - Vec3d endPointDiff = backVec.add(-frontVec.x, -frontVec.y, -frontVec.z); + Vector3d endPointDiff = backVec.add(-frontVec.x, -frontVec.y, -frontVec.z); if (endPointDiff.length() != 0.0D) { endPointDiff = endPointDiff.normalize(); yaw = (float) (Math.atan2(endPointDiff.z, endPointDiff.x) * 180.0D / Math.PI); @@ -174,7 +174,7 @@ public class MinecartCouplingRenderer { this.flip = flip; } - public Vec3d apply(Vec3d vec) { + public Vector3d apply(Vector3d vec) { vec = vec.add(offset, 0, 0); vec = VecHelper.rotate(vec, roll, Axis.X); vec = VecHelper.rotate(vec, pitch, Axis.Z); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartCouplingSerializer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartCouplingSerializer.java index 1743a5de8..55e5e672d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartCouplingSerializer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartCouplingSerializer.java @@ -32,7 +32,7 @@ public class MinecartCouplingSerializer { private static CompoundNBT createCouplingTag(boolean main, MinecartCoupling coupling) { CompoundNBT nbt = new CompoundNBT(); - nbt.put("Id", NBTUtil.writeUniqueId(coupling.getId())); + nbt.put("Id", NBTUtil.fromUuid(coupling.getId())); nbt.putBoolean("Main", main); nbt.putDouble("Length", coupling.length); return nbt; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartSim2020.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartSim2020.java index b3f4d5b01..6e9cab053 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartSim2020.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartSim2020.java @@ -19,21 +19,21 @@ import net.minecraft.util.Direction; import net.minecraft.util.Util; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3i; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.math.vector.Vector3i; public class MinecartSim2020 { - private static final Map> MATRIX = + private static final Map> MATRIX = Util.make(Maps.newEnumMap(RailShape.class), (p_226574_0_) -> { - Vec3i vec3i = Direction.WEST.getDirectionVec(); - Vec3i vec3i1 = Direction.EAST.getDirectionVec(); - Vec3i vec3i2 = Direction.NORTH.getDirectionVec(); - Vec3i vec3i3 = Direction.SOUTH.getDirectionVec(); - Vec3i vec3i4 = vec3i.down(); - Vec3i vec3i5 = vec3i1.down(); - Vec3i vec3i6 = vec3i2.down(); - Vec3i vec3i7 = vec3i3.down(); + Vector3i vec3i = Direction.WEST.getDirectionVec(); + Vector3i vec3i1 = Direction.EAST.getDirectionVec(); + Vector3i vec3i2 = Direction.NORTH.getDirectionVec(); + Vector3i vec3i3 = Direction.SOUTH.getDirectionVec(); + Vector3i vec3i4 = vec3i.down(); + Vector3i vec3i5 = vec3i1.down(); + Vector3i vec3i6 = vec3i2.down(); + Vector3i vec3i7 = vec3i3.down(); p_226574_0_.put(RailShape.NORTH_SOUTH, Pair.of(vec3i2, vec3i3)); p_226574_0_.put(RailShape.EAST_WEST, Pair.of(vec3i, vec3i1)); p_226574_0_.put(RailShape.ASCENDING_EAST, Pair.of(vec3i4, vec3i1)); @@ -46,7 +46,7 @@ public class MinecartSim2020 { p_226574_0_.put(RailShape.NORTH_EAST, Pair.of(vec3i2, vec3i1)); }); - public static Vec3d predictMotionOf(AbstractMinecartEntity cart) { + public static Vector3d predictMotionOf(AbstractMinecartEntity cart) { if (cart instanceof FurnaceMinecartEntity) { return cart.getPositionVec() .subtract(cart.lastTickPosX, cart.lastTickPosY, cart.lastTickPosZ); @@ -83,13 +83,13 @@ public class MinecartSim2020 { return true; } - public static void moveCartAlongTrack(AbstractMinecartEntity cart, Vec3d forcedMovement, BlockPos cartPos, + public static void moveCartAlongTrack(AbstractMinecartEntity cart, Vector3d forcedMovement, BlockPos cartPos, BlockState trackState) { - if (forcedMovement.equals(Vec3d.ZERO)) + if (forcedMovement.equals(Vector3d.ZERO)) return; - Vec3d previousMotion = cart.getMotion(); + Vector3d previousMotion = cart.getMotion(); cart.fallDistance = 0.0F; double x = cart.getX(); @@ -100,7 +100,7 @@ public class MinecartSim2020 { double actualY = y; double actualZ = z; - Vec3d actualVec = cart.getPos(actualX, actualY, actualZ); + Vector3d actualVec = cart.getPos(actualX, actualY, actualZ); actualY = cartPos.getY() + 1; AbstractRailBlock abstractrailblock = (AbstractRailBlock) trackState.getBlock(); @@ -125,9 +125,9 @@ public class MinecartSim2020 { break; } - Pair pair = MATRIX.get(railshape); - Vec3i vec3i = pair.getFirst(); - Vec3i vec3i1 = pair.getSecond(); + Pair pair = MATRIX.get(railshape); + Vector3i vec3i = pair.getFirst(); + Vector3i vec3i1 = pair.getSecond(); double d4 = (double) (vec3i1.getX() - vec3i.getX()); double d5 = (double) (vec3i1.getZ() - vec3i.getZ()); // double d6 = Math.sqrt(d4 * d4 + d5 * d5); @@ -177,16 +177,16 @@ public class MinecartSim2020 { y = cart.getY(); z = cart.getZ(); - Vec3d vec3d3 = cart.getPos(x, y, z); - if (vec3d3 != null && actualVec != null) { - double d17 = (actualVec.y - vec3d3.y) * 0.05D; - Vec3d vec3d4 = cart.getMotion(); - double d18 = Math.sqrt(horizontalMag(vec3d4)); + Vector3d Vector3d3 = cart.getPos(x, y, z); + if (Vector3d3 != null && actualVec != null) { + double d17 = (actualVec.y - Vector3d3.y) * 0.05D; + Vector3d Vector3d4 = cart.getMotion(); + double d18 = Math.sqrt(horizontalMag(Vector3d4)); if (d18 > 0.0D) { - cart.setMotion(vec3d4.mul((d18 + d17) / d18, 1.0D, (d18 + d17) / d18)); + cart.setMotion(Vector3d4.mul((d18 + d17) / d18, 1.0D, (d18 + d17) / d18)); } - cart.setPosition(x, vec3d3.y, z); + cart.setPosition(x, Vector3d3.y, z); } x = cart.getX(); @@ -196,24 +196,24 @@ public class MinecartSim2020 { int j = MathHelper.floor(x); int i = MathHelper.floor(z); if (j != cartPos.getX() || i != cartPos.getZ()) { - Vec3d vec3d5 = cart.getMotion(); - double d26 = Math.sqrt(horizontalMag(vec3d5)); - cart.setMotion(d26 * (double) (j - cartPos.getX()), vec3d5.y, d26 * (double) (i - cartPos.getZ())); + Vector3d Vector3d5 = cart.getMotion(); + double d26 = Math.sqrt(horizontalMag(Vector3d5)); + cart.setMotion(d26 * (double) (j - cartPos.getX()), Vector3d5.y, d26 * (double) (i - cartPos.getZ())); } cart.setMotion(previousMotion); if (cart instanceof FurnaceMinecartEntity) { // FurnaceMinecartEntity furnaceCart = (FurnaceMinecartEntity) cart; -// Vec3d vec3d = cart.getMotion(); -// double d2 = horizontalMag(vec3d); +// Vector3d Vector3d = cart.getMotion(); +// double d2 = horizontalMag(Vector3d); // double d3 = furnaceCart.pushX * furnaceCart.pushX + furnaceCart.pushZ * furnaceCart.pushZ; // if (d3 > 1.0E-4D && d2 > 0.001D) { // double d40 = (double) MathHelper.sqrt(d2); // double d50 = (double) MathHelper.sqrt(d3); -// furnaceCart.pushX = vec3d.x / d40 * d50; -// furnaceCart.pushZ = vec3d.z / d40 * d50; -// furnaceCart.setMotion(vec3d.mul(0.8D, 0.0D, 0.8D) +// furnaceCart.pushX = Vector3d.x / d40 * d50; +// furnaceCart.pushZ = Vector3d.z / d40 * d50; +// furnaceCart.setMotion(Vector3d.mul(0.8D, 0.0D, 0.8D) // .add(furnaceCart.pushX, 0.0D, furnaceCart.pushZ)); // } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartTrain.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartTrain.java index 987e73920..ce1f96cbe 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartTrain.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartTrain.java @@ -18,7 +18,7 @@ import net.minecraft.entity.item.minecart.AbstractMinecartEntity; import net.minecraft.state.properties.RailShape; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; public class MinecartTrain { @@ -201,7 +201,7 @@ public class MinecartTrain { } public void hardCollisionStep(World world, Couple carts, double couplingLength) { - Couple corrections = Couple.create(null, null); + Couple corrections = Couple.create(null, null); Couple maxSpeed = carts.map(AbstractMinecartEntity::getMaxCartSpeedOnRail); boolean firstLoop = true; for (boolean current : new boolean[] { true, false, true }) { @@ -220,9 +220,9 @@ public class MinecartTrain { shape = block.getRailDirection(railState, world, railPosition, cart); } - Vec3d correction = Vec3d.ZERO; - Vec3d pos = cart.getPositionVec(); - Vec3d link = otherCart.getPositionVec() + Vector3d correction = Vector3d.ZERO; + Vector3d pos = cart.getPositionVec(); + Vector3d link = otherCart.getPositionVec() .subtract(pos); float correctionMagnitude = firstLoop ? -stress / 2f : -stress; correction = shape != null ? followLinkOnRail(link, pos, correctionMagnitude, shape).subtract(pos) @@ -248,7 +248,7 @@ public class MinecartTrain { public void softCollisionStep(World world, Couple carts, double couplingLength) { - Couple positions = carts.map(Entity::getPositionVector); + Couple positions = carts.map(Entity::getPositionVec); Couple maxSpeed = carts.map(AbstractMinecartEntity::getMaxCartSpeedOnRail); Couple canAddmotion = carts.map(MinecartSim2020::canAddMotion); @@ -261,9 +261,9 @@ public class MinecartTrain { return block.getRailDirection(railState, world, railPosition, current); }); - Couple motions = carts.map(MinecartSim2020::predictMotionOf); - Couple nextPositions = positions.copy(); - nextPositions.replaceWithParams(Vec3d::add, motions); + Couple motions = carts.map(MinecartSim2020::predictMotionOf); + Couple nextPositions = positions.copy(); + nextPositions.replaceWithParams(Vector3d::add, motions); float futureStress = (float) (couplingLength - nextPositions.getFirst() .distanceTo(nextPositions.getSecond())); @@ -271,9 +271,9 @@ public class MinecartTrain { return; for (boolean current : Iterate.trueAndFalse) { - Vec3d correction = Vec3d.ZERO; - Vec3d pos = nextPositions.get(current); - Vec3d link = nextPositions.get(!current) + Vector3d correction = Vector3d.ZERO; + Vector3d pos = nextPositions.get(current); + Vector3d link = nextPositions.get(!current) .subtract(pos); float correctionMagnitude = -futureStress / 2f; @@ -293,16 +293,16 @@ public class MinecartTrain { carts.forEachWithParams(Entity::setMotion, motions); } - public static Vec3d followLinkOnRail(Vec3d link, Vec3d cart, float diffToReduce, RailShape shape) { - Vec3d railAxis = getRailVec(shape); + public static Vector3d followLinkOnRail(Vector3d link, Vector3d cart, float diffToReduce, RailShape shape) { + Vector3d railAxis = getRailVec(shape); double dotProduct = railAxis.dotProduct(link); if (Double.isNaN(dotProduct) || dotProduct == 0 || diffToReduce == 0) return cart; - Vec3d axis = railAxis.scale(-Math.signum(dotProduct)); - Vec3d center = cart.add(link); + Vector3d axis = railAxis.scale(-Math.signum(dotProduct)); + Vector3d center = cart.add(link); double radius = link.length() - diffToReduce; - Vec3d intersectSphere = VecHelper.intersectSphere(cart, axis, center, radius); + Vector3d intersectSphere = VecHelper.intersectSphere(cart, axis, center, radius); // Cannot satisfy on current rail vector if (intersectSphere == null) @@ -311,24 +311,24 @@ public class MinecartTrain { return intersectSphere; } - private static Vec3d getRailVec(RailShape shape) { + private static Vector3d getRailVec(RailShape shape) { switch (shape) { case ASCENDING_NORTH: case ASCENDING_SOUTH: case NORTH_SOUTH: - return new Vec3d(0, 0, 1); + return new Vector3d(0, 0, 1); case ASCENDING_EAST: case ASCENDING_WEST: case EAST_WEST: - return new Vec3d(1, 0, 0); + return new Vector3d(1, 0, 0); case NORTH_EAST: case SOUTH_WEST: - return new Vec3d(1, 0, 1).normalize(); + return new Vector3d(1, 0, 1).normalize(); case NORTH_WEST: case SOUTH_EAST: - return new Vec3d(1, 0, -1).normalize(); + return new Vector3d(1, 0, -1).normalize(); default: - return new Vec3d(0, 1, 0); + return new Vector3d(0, 1, 0); } } @@ -345,9 +345,9 @@ public class MinecartTrain { return; int yOffset = 1; - Vec3d mainCenter = mainCart.getPositionVec() + Vector3d mainCenter = mainCart.getPositionVec() .add(0, yOffset, 0); - Vec3d connectedCenter = connectedCart.getPositionVec() + Vector3d connectedCenter = connectedCart.getPositionVec() .add(0, yOffset, 0); int color = ColorHelper.mixColors(0xabf0e9, 0xee8572, @@ -357,7 +357,7 @@ public class MinecartTrain { .colored(color) .lineWidth(1 / 8f); - Vec3d point = mainCart.getPositionVec() + Vector3d point = mainCart.getPositionVec() .add(0, yOffset, 0); CreateClient.outliner.showLine(coupling.getId() + "" + index, point, point.add(0, 1 / 128f, 0)) .colored(0xffffff) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ReinforcedRailBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ReinforcedRailBlock.java index 7f04b5687..05d2a3503 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ReinforcedRailBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ReinforcedRailBlock.java @@ -108,10 +108,11 @@ public class ReinforcedRailBlock extends AbstractRailBlock { return PushReaction.BLOCK; } + /* FIXME: Same thing as before, does this still matter? If so, what is the new way of doing it? @Override public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) { return false; - } + }*/ @Override public boolean isValidPosition(BlockState state, IWorldReader world, BlockPos pos) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/turntable/TurntableBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/turntable/TurntableBlock.java index a981a9c00..0ae961ef9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/turntable/TurntableBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/turntable/TurntableBlock.java @@ -47,7 +47,7 @@ public class TurntableBlock extends KineticBlock implements ITE 0) return; @@ -61,7 +61,7 @@ public class TurntableBlock extends KineticBlock implements ITE { public WaterWheelBlock(Properties properties) { @@ -61,10 +66,9 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE 0 ^ !clockwise ? -flow.y * clockwiseMultiplier : -flow.y; } - if (te.getSpeed() == 0 && flowStrength != 0 && !world.isRemote) { + if (te.getSpeed() == 0 && flowStrength != 0 && !world.isRemote()) { AllTriggers.triggerForNearbyPlayers(AllTriggers.WATER_WHEEL, world, pos, 5); if (fluid.getFluid() == Fluids.FLOWING_LAVA || fluid.getFluid() == Fluids.LAVA) AllTriggers.triggerForNearbyPlayers(AllTriggers.LAVA_WHEEL, world, pos, 5); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelTileEntity.java index c7f39e7b9..608900266 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelTileEntity.java @@ -29,7 +29,7 @@ public class WaterWheelTileEntity extends GeneratingKineticTileEntity { if (compound.contains("Flows")) { for (Direction d : Direction.values()) setFlow(d, compound.getCompound("Flows") - .getFloat(d.getName())); + .getFloat(d.getString())); } } @@ -42,7 +42,7 @@ public class WaterWheelTileEntity extends GeneratingKineticTileEntity { public void write(CompoundNBT compound, boolean clientPacket) { CompoundNBT flows = new CompoundNBT(); for (Direction d : Direction.values()) - flows.putFloat(d.getName(), this.flows.get(d)); + flows.putFloat(d.getString(), this.flows.get(d)); compound.put("Flows", flows); super.write(compound, clientPacket); diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidPipeAttachmentBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidPipeAttachmentBehaviour.java index 0edd0cfd0..cf477c172 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidPipeAttachmentBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidPipeAttachmentBehaviour.java @@ -7,13 +7,13 @@ import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType; import net.minecraft.block.BlockState; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.ILightReader; +import net.minecraft.world.IBlockDisplayReader; public class FluidPipeAttachmentBehaviour extends TileEntityBehaviour { public static BehaviourType TYPE = new BehaviourType<>(); - public AttachmentTypes getAttachment(ILightReader world, BlockPos pos, BlockState state, Direction direction) { + public AttachmentTypes getAttachment(IBlockDisplayReader world, BlockPos pos, BlockState state, Direction direction) { if (!isPipeConnectedTowards(state, direction)) return AttachmentTypes.NONE; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidPipeBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidPipeBehaviour.java index 3010fa403..c28d36b35 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidPipeBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidPipeBehaviour.java @@ -37,7 +37,7 @@ import net.minecraft.particles.ParticleTypes; import net.minecraft.util.Direction; import net.minecraft.util.math.AxisAlignedBB; 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.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -296,15 +296,15 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour { return; float rimRadius = getRimRadius(state, side); - Vec3d directionVec = new Vec3d(side.getDirectionVec()); + Vector3d directionVec = Vector3d.of(side.getDirectionVec()); for (int i = 0; i < amount; i++) { - Vec3d vec = VecHelper.offsetRandomly(Vec3d.ZERO, r, 1) + Vector3d vec = VecHelper.offsetRandomly(Vector3d.ZERO, r, 1) .normalize(); vec = VecHelper.clampComponentWise(vec, rimRadius) .mul(VecHelper.axisAlingedPlaneOf(directionVec)) .add(directionVec.scale(.45 + r.nextFloat() / 16f)); - Vec3d m = vec; + Vector3d m = vec; vec = vec.add(VecHelper.getCenterOf(pos)); world.addOptionalParticle(particle, vec.x, vec.y - 1 / 16f, vec.z, m.x, m.y, m.z); @@ -317,7 +317,7 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour { .getDefaultState() .getBlockState()); float rimRadius = getRimRadius(state, side); - Vec3d directionVec = new Vec3d(side.getDirectionVec()); + Vector3d directionVec = Vector3d.of(side.getDirectionVec()); Couple couple = allFlows.get(side); if (couple == null) @@ -326,11 +326,11 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour { if (flow.progress == null) return; for (int i = 0; i < amount; i++) { - Vec3d vec = VecHelper.offsetRandomly(Vec3d.ZERO, r, rimRadius); + Vector3d vec = VecHelper.offsetRandomly(Vector3d.ZERO, r, rimRadius); vec = vec.mul(VecHelper.axisAlingedPlaneOf(directionVec)) .add(directionVec.scale(.5 + r.nextFloat() / 4f)); - Vec3d m = vec; - Vec3d centerOf = VecHelper.getCenterOf(tileEntity.getPos()); + Vector3d m = vec; + Vector3d centerOf = VecHelper.getCenterOf(tileEntity.getPos()); vec = vec.add(centerOf); if (inbound) { vec = vec.add(m); @@ -350,7 +350,7 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour { .getRenderViewEntity(); if (renderViewEntity == null) return false; - Vec3d center = VecHelper.getCenterOf(tileEntity.getPos()); + Vector3d center = VecHelper.getCenterOf(tileEntity.getPos()); if (renderViewEntity.getPositionVec() .distanceTo(center) > MAX_PARTICLE_RENDER_DISTANCE) return false; @@ -411,7 +411,7 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour { return; for (Entry> entry : allFlows.entrySet()) { Direction face = entry.getKey(); - Vec3d directionVec = new Vec3d(face.getDirectionVec()); + Vector3d directionVec = Vector3d.of(face.getDirectionVec()); float size = 1 / 4f; boolean extended = !isConnectedTo(tileEntity.getBlockState(), face.getOpposite()); float length = extended ? .75f : .5f; @@ -421,11 +421,11 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour { if (flow.progress == null) return; float value = flow.progress.getValue(); - Vec3d start = directionVec.scale(inbound ? .5 : .5f - length); - Vec3d offset = directionVec.scale(length * (inbound ? -1 : 1)) + Vector3d start = directionVec.scale(inbound ? .5 : .5f - length); + Vector3d offset = directionVec.scale(length * (inbound ? -1 : 1)) .scale(value); - Vec3d scale = new Vec3d(1, 1, 1).subtract(directionVec.scale(face.getAxisDirection() + Vector3d scale = new Vector3d(1, 1, 1).subtract(directionVec.scale(face.getAxisDirection() .getOffset())) .scale(size); AxisAlignedBB bb = diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidPropagator.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidPropagator.java index 066750b38..1f0281fc9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidPropagator.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidPropagator.java @@ -5,6 +5,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import com.simibubi.create.foundation.utility.BlockHelper; import org.apache.commons.lang3.mutable.MutableObject; import com.simibubi.create.AllBlocks; @@ -27,7 +28,7 @@ import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.World; @@ -73,11 +74,11 @@ public class FluidPropagator { if (PumpBlock.isPump(connectedState) && connectedState.get(PumpBlock.FACING) .getAxis() == side.getAxis()) return false; - if (Block.hasSolidSide(connectedState, reader, connectedPos, side.getOpposite())) + if (BlockHelper.hasBlockSolidSide(connectedState, reader, connectedPos, side.getOpposite())) return false; if (!(connectedState.getMaterial() .isReplaceable() && connectedState.getBlockHardness(reader, connectedPos) != -1) - && !connectedState.has(BlockStateProperties.WATERLOGGED)) + && !BlockHelper.hasBlockStateProperty(connectedState, BlockStateProperties.WATERLOGGED)) return false; return true; } @@ -139,14 +140,14 @@ public class FluidPropagator { public static OutlineParams showBlockFace(BlockFace face) { MutableObject params = new MutableObject<>(new OutlineParams()); DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { - Vec3d directionVec = new Vec3d(face.getFace() + Vector3d directionVec = Vector3d.of(face.getFace() .getDirectionVec()); - Vec3d scaleVec = directionVec.scale(-.25f * face.getFace() + Vector3d scaleVec = directionVec.scale(-.25f * face.getFace() .getAxisDirection() .getOffset()); directionVec = directionVec.scale(.5f); params.setValue(CreateClient.outliner.showAABB(face, - FluidPropagator.smallCenter.offset(directionVec.add(new Vec3d(face.getPos()))) + FluidPropagator.smallCenter.offset(directionVec.add(Vector3d.of(face.getPos()))) .grow(scaleVec.x, scaleVec.y, scaleVec.z) .grow(1 / 16f))); }); diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidReactions.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidReactions.java index c15d2a40a..6f0aefa79 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidReactions.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidReactions.java @@ -6,7 +6,7 @@ import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.block.Blocks; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluids; -import net.minecraft.fluid.IFluidState; +import net.minecraft.fluid.FluidState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; @@ -21,7 +21,7 @@ public class FluidReactions { world.setBlockState(pos, Blocks.COBBLESTONE.getDefaultState()); } - public static void handlePipeSpillCollision(World world, BlockPos pos, Fluid pipeFluid, IFluidState worldFluid) { + public static void handlePipeSpillCollision(World world, BlockPos pos, Fluid pipeFluid, FluidState worldFluid) { Fluid pf = FluidHelper.convertToStill(pipeFluid); Fluid wf = worldFluid.getFluid(); if (pf == Fluids.WATER && wf == Fluids.LAVA) diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/OpenEndedPipe.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/OpenEndedPipe.java index 29e89f1f9..4e9a911aa 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/OpenEndedPipe.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/OpenEndedPipe.java @@ -3,13 +3,14 @@ package com.simibubi.create.content.contraptions.fluids; import javax.annotation.Nullable; import com.simibubi.create.foundation.utility.BlockFace; +import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.Iterate; import net.minecraft.block.BlockState; import net.minecraft.block.FlowingFluidBlock; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluids; -import net.minecraft.fluid.IFluidState; +import net.minecraft.fluid.FluidState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.math.BlockPos; @@ -44,8 +45,8 @@ public class OpenEndedPipe { } BlockState state = world.getBlockState(outputPos); - IFluidState fluidState = state.getFluidState(); - boolean waterlog = state.has(BlockStateProperties.WATERLOGGED); + FluidState fluidState = state.getFluidState(); + boolean waterlog = BlockHelper.hasBlockStateProperty(state, BlockStateProperties.WATERLOGGED); if (!waterlog && !state.getMaterial() .isReplaceable()) @@ -128,14 +129,14 @@ public class OpenEndedPipe { if (resource.isEmpty()) return 0; BlockState state = world.getBlockState(outputPos); - IFluidState fluidState = state.getFluidState(); + FluidState fluidState = state.getFluidState(); if (!fluidState.isEmpty() && fluidState.getFluid() != resource.getFluid()) { FluidReactions.handlePipeSpillCollision(world, outputPos, resource.getFluid(), fluidState); return 0; } if (fluidState.isSource()) return 0; - if (!(state.has(BlockStateProperties.WATERLOGGED) && resource.getFluid() == Fluids.WATER) + if (!(BlockHelper.hasBlockStateProperty(state, BlockStateProperties.WATERLOGGED) && resource.getFluid() == Fluids.WATER) && !state.getMaterial() .isReplaceable()) return 0; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/PipeAttachmentModel.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/PipeAttachmentModel.java index 715ccf946..f102c8145 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/PipeAttachmentModel.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/PipeAttachmentModel.java @@ -17,7 +17,7 @@ import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.ILightReader; +import net.minecraft.world.IBlockDisplayReader; import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.data.ModelDataMap; import net.minecraftforge.client.model.data.ModelProperty; @@ -31,7 +31,7 @@ public class PipeAttachmentModel extends WrappedBakedModel { } @Override - public IModelData getModelData(ILightReader world, BlockPos pos, BlockState state, IModelData tileData) { + public IModelData getModelData(IBlockDisplayReader world, BlockPos pos, BlockState state, IModelData tileData) { PipeModelData data = new PipeModelData(); FluidPipeAttachmentBehaviour attachmentBehaviour = TileEntityBehaviour.get(world, pos, FluidPipeAttachmentBehaviour.TYPE); diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpBlock.java index f64aae45f..a6bed287b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpBlock.java @@ -153,10 +153,10 @@ public class PumpBlock extends DirectionalKineticBlock implements IWaterLoggable @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - FluidState ifluidstate = context.getWorld() + FluidState FluidState = context.getWorld() .getFluidState(context.getPos()); return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED, - Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER)); + Boolean.valueOf(FluidState.getFluid() == Fluids.WATER)); } public static boolean isPump(BlockState state) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpTileEntity.java index 2e83cfd4b..b52b87625 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpTileEntity.java @@ -25,7 +25,7 @@ import net.minecraft.nbt.ListNBT; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.ILightReader; +import net.minecraft.world.IBlockDisplayReader; import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; @@ -368,7 +368,7 @@ public class PumpTileEntity extends KineticTileEntity { } @Override - public AttachmentTypes getAttachment(ILightReader world, BlockPos pos, BlockState state, Direction direction) { + public AttachmentTypes getAttachment(IBlockDisplayReader world, BlockPos pos, BlockState state, Direction direction) { AttachmentTypes attachment = super.getAttachment(world, pos, state, direction); if (attachment == AttachmentTypes.RIM) return AttachmentTypes.NONE; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutTileEntity.java index b723a4849..94dfc48d8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutTileEntity.java @@ -27,7 +27,7 @@ import net.minecraft.particles.ParticleTypes; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; @@ -228,7 +228,7 @@ public class SpoutTileEntity extends SmartTileEntity { } protected void spawnProcessingParticles(FluidStack fluid) { - Vec3d vec = VecHelper.getCenterOf(pos); + Vector3d vec = VecHelper.getCenterOf(pos); vec = vec.subtract(0, 8 / 16f, 0); IParticleData particle = new BlockParticleData(ParticleTypes.BLOCK, fluid.getFluid() .getDefaultState() @@ -239,14 +239,14 @@ public class SpoutTileEntity extends SmartTileEntity { protected static int SPLASH_PARTICLE_COUNT = 20; protected void spawnSplash(FluidStack fluid) { - Vec3d vec = VecHelper.getCenterOf(pos); + Vector3d vec = VecHelper.getCenterOf(pos); vec = vec.subtract(0, 2 - 5 / 16f, 0); IParticleData particle = new BlockParticleData(ParticleTypes.BLOCK, fluid.getFluid() .getDefaultState() .getBlockState()); for (int i = 0; i < SPLASH_PARTICLE_COUNT; i++) { - Vec3d m = VecHelper.offsetRandomly(Vec3d.ZERO, world.rand, 0.25f); - m = new Vec3d(m.x, Math.abs(m.y), m.z); + Vector3d m = VecHelper.offsetRandomly(Vector3d.ZERO, world.rand, 0.25f); + m = new Vector3d(m.x, Math.abs(m.y), m.z); world.addOptionalParticle(particle, vec.x, vec.y, vec.z, m.x, m.y, m.z); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeBlock.java index 299f70405..e0ad1da7e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeBlock.java @@ -18,7 +18,7 @@ import net.minecraft.block.IWaterLoggable; import net.minecraft.block.SixWayBlock; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluids; -import net.minecraft.fluid.IFluidState; +import net.minecraft.fluid.FluidState; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemUseContext; import net.minecraft.network.DebugPacketSender; @@ -33,7 +33,7 @@ import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.world.IBlockReader; -import net.minecraft.world.ILightReader; +import net.minecraft.world.IBlockDisplayReader; import net.minecraft.world.IWorld; import net.minecraft.world.TickPriority; import net.minecraft.world.World; @@ -140,7 +140,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren return state.getBlock() instanceof FluidPipeBlock; } - public static boolean canConnectTo(ILightReader world, BlockPos pos, BlockState neighbour, Direction blockFace) { + public static boolean canConnectTo(IBlockDisplayReader world, BlockPos pos, BlockState neighbour, Direction blockFace) { if (isPipe(neighbour) || FluidPropagator.hasFluidCapability(neighbour, world, pos, blockFace)) return true; FluidPipeAttachmentBehaviour attachmentBehaviour = @@ -150,7 +150,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren return attachmentBehaviour.isPipeConnectedTowards(neighbour, blockFace); } - public static boolean shouldDrawRim(ILightReader world, BlockPos pos, BlockState state, Direction direction) { + public static boolean shouldDrawRim(IBlockDisplayReader world, BlockPos pos, BlockState state, Direction direction) { BlockPos offsetPos = pos.offset(direction); BlockState facingState = world.getBlockState(offsetPos); if (!isPipe(facingState)) @@ -170,11 +170,11 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren return state.get(FACING_TO_PROPERTY_MAP.get(direction)); } - public static boolean isCornerOrEndPipe(ILightReader world, BlockPos pos, BlockState state) { + public static boolean isCornerOrEndPipe(IBlockDisplayReader world, BlockPos pos, BlockState state) { return isPipe(state) && !FluidPropagator.isStraightPipe(state) && !shouldDrawCasing(world, pos, state); } - public static boolean shouldDrawCasing(ILightReader world, BlockPos pos, BlockState state) { + public static boolean shouldDrawCasing(IBlockDisplayReader world, BlockPos pos, BlockState state) { if (!isPipe(state)) return false; for (Axis axis : Iterate.axes) { @@ -196,11 +196,11 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - IFluidState ifluidstate = context.getWorld() + FluidState FluidState = context.getWorld() .getFluidState(context.getPos()); return updateBlockState(getDefaultState(), context.getNearestLookingDirection(), null, context.getWorld(), context.getPos()).with(BlockStateProperties.WATERLOGGED, - Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER)); + Boolean.valueOf(FluidState.getFluid() == Fluids.WATER)); } @Override @@ -214,7 +214,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren } public BlockState updateBlockState(BlockState state, Direction preferredDirection, @Nullable Direction ignore, - ILightReader world, BlockPos pos) { + IBlockDisplayReader world, BlockPos pos) { // Update sides that are not ignored for (Direction d : Iterate.directions) if (d != ignore) @@ -241,7 +241,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren } @Override - public IFluidState getFluidState(BlockState state) { + public FluidState getFluidState(BlockState state) { return state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : Fluids.EMPTY.getDefaultState(); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeTileEntity.java index 5b0ca5222..34abb83c4 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeTileEntity.java @@ -11,7 +11,7 @@ import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.ILightReader; +import net.minecraft.world.IBlockDisplayReader; public class FluidPipeTileEntity extends SmartTileEntity { @@ -45,7 +45,7 @@ public class FluidPipeTileEntity extends SmartTileEntity { } @Override - public AttachmentTypes getAttachment(ILightReader world, BlockPos pos, BlockState state, Direction direction) { + public AttachmentTypes getAttachment(IBlockDisplayReader world, BlockPos pos, BlockState state, Direction direction) { AttachmentTypes attachment = super.getAttachment(world, pos, state, direction); BlockPos offsetPos = pos.offset(direction); diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/StraightPipeTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/StraightPipeTileEntity.java index b5e273f5b..b95dc387d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/StraightPipeTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/StraightPipeTileEntity.java @@ -12,7 +12,7 @@ import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.ILightReader; +import net.minecraft.world.IBlockDisplayReader; public class StraightPipeTileEntity extends SmartTileEntity { @@ -46,7 +46,7 @@ public class StraightPipeTileEntity extends SmartTileEntity { } @Override - public AttachmentTypes getAttachment(ILightReader world, BlockPos pos, BlockState state, Direction direction) { + public AttachmentTypes getAttachment(IBlockDisplayReader world, BlockPos pos, BlockState state, Direction direction) { AttachmentTypes attachment = super.getAttachment(world, pos, state, direction); BlockState otherState = world.getBlockState(pos.offset(direction)); if (state.getBlock() instanceof AxisPipeBlock && otherState.getBlock() instanceof AxisPipeBlock) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankBlock.java index 0b209bbbf..d952c4693 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankBlock.java @@ -31,7 +31,7 @@ import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; @@ -171,10 +171,10 @@ public class FluidTankBlock extends Block implements IWrenchable, ITE tooltip; + private final List tooltip; public GoggleConfigScreen() { String spacing = " "; tooltip = new ArrayList<>(); - tooltip.add(spacing + Lang.translate("gui.config.overlay1")); - tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay2")); - tooltip.add(""); - tooltip.add(spacing + Lang.translate("gui.config.overlay3")); - tooltip.add(spacing + Lang.translate("gui.config.overlay4")); - tooltip.add(""); - tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay5")); - tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay6")); - tooltip.add(""); - tooltip.add(spacing + Lang.translate("gui.config.overlay7")); - tooltip.add(spacing + Lang.translate("gui.config.overlay8")); + tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.config.overlay1"))); + tooltip.add(ITextComponent.of(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay2"))); + tooltip.add(ITextComponent.of("")); + tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.config.overlay3"))); + tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.config.overlay4"))); + tooltip.add(ITextComponent.of("")); + tooltip.add(ITextComponent.of(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay5"))); + tooltip.add(ITextComponent.of(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay6"))); + tooltip.add(ITextComponent.of("")); + tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.config.overlay7"))); + tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.config.overlay8"))); } @Override @@ -71,16 +72,16 @@ public class GoggleConfigScreen extends AbstractSimiScreen { } @Override - protected void renderWindow(int mouseX, int mouseY, float partialTicks) { - RenderSystem.pushMatrix(); + protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) { + ms.push(); int posX = this.width / 2 + offsetX; int posY = this.height / 2 + offsetY; //tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2); - renderTooltip(tooltip, posX, posY); + renderTooltip(ms, tooltip, posX, posY); ItemStack item = AllItems.GOGGLES.asStack(); //GuiGameElement.of(item).at(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16).render(); GuiGameElement.of(item).at(posX + 10, posY - 16).render(); - RenderSystem.popMatrix(); + ms.pop(); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java index 2e728d649..449255aed 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java @@ -1,5 +1,6 @@ package com.simibubi.create.content.contraptions.goggles; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllItems; import com.simibubi.create.foundation.config.AllConfigs; @@ -29,6 +30,7 @@ public class GoggleOverlayRenderer { @SubscribeEvent public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEvent.Post event) { + MatrixStack ms = event.getMatrixStack(); if (event.getType() != ElementType.HOTBAR) return; @@ -49,7 +51,7 @@ public class GoggleOverlayRenderer { if (!goggleInformation && !hoveringInformation) return; - List tooltip = new ArrayList<>(); + List tooltip = new ArrayList<>(); if (goggleInformation && AllItems.GOGGLES.isIn(goggles)) { IHaveGoggleInformation gte = (IHaveGoggleInformation) te; @@ -60,7 +62,7 @@ public class GoggleOverlayRenderer { if (hoveringInformation) { boolean goggleAddedInformation = !tooltip.isEmpty(); if (goggleAddedInformation) - tooltip.add(""); + tooltip.add(ITextComponent.of("")); IHaveHoveringInformation hte = (IHaveHoveringInformation) te; if (!hte.addToTooltip(tooltip, mc.player.isSneaking())) hoveringInformation = false; @@ -79,7 +81,7 @@ public class GoggleOverlayRenderer { int posX = tooltipScreen.width / 2 + AllConfigs.CLIENT.overlayOffsetX.get(); int posY = tooltipScreen.height / 2 + AllConfigs.CLIENT.overlayOffsetY.get(); //tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2); - tooltipScreen.renderTooltip(tooltip, posX, posY); + tooltipScreen.renderTooltip(ms, tooltip, posX, posY); ItemStack item = AllItems.GOGGLES.asStack(); //GuiGameElement.of(item).at(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16).render(); @@ -95,9 +97,9 @@ public class GoggleOverlayRenderer { @Override public void init(Minecraft mc, int width, int height) { - this.minecraft = mc; + this.client = mc; this.itemRenderer = mc.getItemRenderer(); - this.font = mc.fontRenderer; + this.textRenderer = mc.fontRenderer; this.width = width; this.height = height; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/goggles/IHaveGoggleInformation.java b/src/main/java/com/simibubi/create/content/contraptions/goggles/IHaveGoggleInformation.java index f41753606..cafff466e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/goggles/IHaveGoggleInformation.java +++ b/src/main/java/com/simibubi/create/content/contraptions/goggles/IHaveGoggleInformation.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.contraptions.goggles; +import net.minecraft.util.text.ITextComponent; + import java.text.DecimalFormat; import java.util.List; @@ -17,7 +19,7 @@ public interface IHaveGoggleInformation { * @return {{@code true}} if the tooltip creation was successful and should be displayed, * or {{@code false}} if the overlay should not be displayed * */ - default boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking){ + default boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking){ return false; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/goggles/IHaveHoveringInformation.java b/src/main/java/com/simibubi/create/content/contraptions/goggles/IHaveHoveringInformation.java index eca6f0afe..cbcd50863 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/goggles/IHaveHoveringInformation.java +++ b/src/main/java/com/simibubi/create/content/contraptions/goggles/IHaveHoveringInformation.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.contraptions.goggles; +import net.minecraft.util.text.ITextComponent; + import java.util.List; /* @@ -7,7 +9,7 @@ import java.util.List; * */ public interface IHaveHoveringInformation { - default boolean addToTooltip(List tooltip, boolean isPlayerSneaking){ + default boolean addToTooltip(List tooltip, boolean isPlayerSneaking){ return false; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/particle/AirFlowParticle.java b/src/main/java/com/simibubi/create/content/contraptions/particle/AirFlowParticle.java index f1a0acf11..c29b790a1 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/particle/AirFlowParticle.java +++ b/src/main/java/com/simibubi/create/content/contraptions/particle/AirFlowParticle.java @@ -13,6 +13,7 @@ import net.minecraft.client.particle.IParticleRenderType; import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.SimpleAnimatedParticle; import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.world.ClientWorld; import net.minecraft.particles.BlockParticleData; import net.minecraft.particles.ParticleTypes; import net.minecraft.tileentity.TileEntity; @@ -25,8 +26,8 @@ public class AirFlowParticle extends SimpleAnimatedParticle { private EncasedFanTileEntity source; - protected AirFlowParticle(World world, EncasedFanTileEntity source, double x, double y, double z, - IAnimatedSprite sprite) { + protected AirFlowParticle(ClientWorld world, EncasedFanTileEntity source, double x, double y, double z, + IAnimatedSprite sprite) { super(world, x, y, z, sprite, world.rand.nextFloat() * .5f); this.source = source; this.particleScale *= 0.75F; @@ -159,7 +160,7 @@ public class AirFlowParticle extends SimpleAnimatedParticle { this.spriteSet = animatedSprite; } - public Particle makeParticle(AirFlowParticleData data, World worldIn, double x, double y, double z, + public Particle makeParticle(AirFlowParticleData data, ClientWorld worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { TileEntity te = worldIn.getTileEntity(new BlockPos(data.posX, data.posY, data.posZ)); if (!(te instanceof EncasedFanTileEntity)) diff --git a/src/main/java/com/simibubi/create/content/contraptions/particle/AirParticle.java b/src/main/java/com/simibubi/create/content/contraptions/particle/AirParticle.java index f6524ea40..fbb081449 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/particle/AirParticle.java +++ b/src/main/java/com/simibubi/create/content/contraptions/particle/AirParticle.java @@ -9,10 +9,11 @@ import net.minecraft.client.particle.IParticleRenderType; import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.SimpleAnimatedParticle; import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.world.ClientWorld; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; public class AirParticle extends SimpleAnimatedParticle { @@ -24,8 +25,8 @@ public class AirParticle extends SimpleAnimatedParticle { private float twirlRadius, twirlAngleOffset; private Axis twirlAxis; - protected AirParticle(World world, AirParticleData data, double x, double y, double z, double dx, double dy, - double dz, IAnimatedSprite sprite) { + protected AirParticle(ClientWorld world, AirParticleData data, double x, double y, double z, double dx, double dy, + double dz, IAnimatedSprite sprite) { super(world, x, y, z, sprite, world.rand.nextFloat() * .5f); particleScale *= 0.75F; canCollide = false; @@ -44,7 +45,7 @@ public class AirParticle extends SimpleAnimatedParticle { twirlAxis = Create.random.nextBoolean() ? Axis.X : Axis.Z; // speed in m/ticks - maxAge = Math.min((int) (new Vec3d(dx, dy, dz).length() / data.speed), 60); + maxAge = Math.min((int) (new Vector3d(dx, dy, dz).length() / data.speed), 60); selectSprite(7); setAlphaF(.25f); } @@ -65,7 +66,7 @@ public class AirParticle extends SimpleAnimatedParticle { float progress = (float) Math.pow(((float) age) / maxAge, drag); float angle = (progress * 2 * 360 + twirlAngleOffset) % 360; - Vec3d twirl = VecHelper.rotate(new Vec3d(0, twirlRadius, 0), angle, twirlAxis); + Vector3d twirl = VecHelper.rotate(new Vector3d(0, twirlRadius, 0), angle, twirlAxis); float x = (float) (MathHelper.lerp(progress, originX, targetX) + twirl.x); float y = (float) (MathHelper.lerp(progress, originY, targetY) + twirl.y); @@ -95,7 +96,7 @@ public class AirParticle extends SimpleAnimatedParticle { this.spriteSet = animatedSprite; } - public Particle makeParticle(AirParticleData data, World worldIn, double x, double y, double z, double xSpeed, + public Particle makeParticle(AirParticleData data, ClientWorld worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { return new AirParticle(worldIn, data, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/particle/CubeParticle.java b/src/main/java/com/simibubi/create/content/contraptions/particle/CubeParticle.java index 5668b81ed..aca7739ff 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/particle/CubeParticle.java +++ b/src/main/java/com/simibubi/create/content/contraptions/particle/CubeParticle.java @@ -1,5 +1,6 @@ package com.simibubi.create.content.contraptions.particle; +import net.minecraft.client.world.ClientWorld; import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.platform.GlStateManager; @@ -84,7 +85,7 @@ public class CubeParticle extends Particle { protected float scale; protected boolean hot; - public CubeParticle(World world, double x, double y, double z, double motionX, double motionY, double motionZ) { + public CubeParticle(ClientWorld world, double x, double y, double z, double motionX, double motionY, double motionZ) { super(world, x, y, z); this.motionX = motionX; this.motionY = motionY; @@ -113,9 +114,9 @@ public class CubeParticle extends Particle { if (this.hot && this.age > 0) { if (this.prevPosY == this.posY) { billowing = true; - field_228343_B_ = false; // Prevent motion being ignored due to vertical collision + field_21507 = false; // Prevent motion being ignored due to vertical collision if (this.motionX == 0 && this.motionZ == 0) { - Vec3d diff = new Vec3d(new BlockPos(posX, posY, posZ)).add(0.5, 0.5, 0.5).subtract(posX, posY, posZ); + Vector3d diff = Vector3d.of(new BlockPos(posX, posY, posZ)).add(0.5, 0.5, 0.5).subtract(posX, posY, posZ); this.motionX = -diff.x * 0.1; this.motionZ = -diff.z * 0.1; } @@ -170,7 +171,7 @@ public class CubeParticle extends Particle { public Factory() {} @Override - public Particle makeParticle(CubeParticleData data, World world, double x, double y, double z, double motionX, + public Particle makeParticle(CubeParticleData data, ClientWorld world, double x, double y, double z, double motionX, double motionY, double motionZ) { CubeParticle particle = new CubeParticle(world, x, y, z, motionX, motionY, motionZ); particle.setColor(data.r, data.g, data.b); diff --git a/src/main/java/com/simibubi/create/content/contraptions/particle/HeaterParticle.java b/src/main/java/com/simibubi/create/content/contraptions/particle/HeaterParticle.java index 713314f8c..974d13ba9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/particle/HeaterParticle.java +++ b/src/main/java/com/simibubi/create/content/contraptions/particle/HeaterParticle.java @@ -8,6 +8,7 @@ import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.IParticleRenderType; import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.SimpleAnimatedParticle; +import net.minecraft.client.world.ClientWorld; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; @@ -17,8 +18,8 @@ public class HeaterParticle extends SimpleAnimatedParticle { private final IAnimatedSprite animatedSprite; - public HeaterParticle(World worldIn, float r, float g, float b, double x, double y, double z, double vx, double vy, - double vz, IAnimatedSprite spriteSet) { + public HeaterParticle(ClientWorld worldIn, float r, float g, float b, double x, double y, double z, double vx, double vy, + double vz, IAnimatedSprite spriteSet) { super(worldIn, x, y, z, spriteSet, worldIn.rand.nextFloat() * .5f); this.animatedSprite = spriteSet; @@ -102,7 +103,7 @@ public class HeaterParticle extends SimpleAnimatedParticle { } @Override - public Particle makeParticle(HeaterParticleData data, World worldIn, double x, double y, double z, double vx, + public Particle makeParticle(HeaterParticleData data, ClientWorld worldIn, double x, double y, double z, double vx, double vy, double vz) { return new HeaterParticle(worldIn, data.r, data.g, data.b, x, y, z, vx, vy, vz, this.spriteSet); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/particle/RotationIndicatorParticle.java b/src/main/java/com/simibubi/create/content/contraptions/particle/RotationIndicatorParticle.java index 24e26a907..fcbb058b7 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/particle/RotationIndicatorParticle.java +++ b/src/main/java/com/simibubi/create/content/contraptions/particle/RotationIndicatorParticle.java @@ -13,6 +13,7 @@ import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.SimpleAnimatedParticle; import net.minecraft.client.renderer.ActiveRenderInfo; +import net.minecraft.client.world.ClientWorld; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; @@ -28,8 +29,8 @@ public class RotationIndicatorParticle extends SimpleAnimatedParticle { protected Vector3d offset; protected boolean isVisible; - private RotationIndicatorParticle(World world, double x, double y, double z, int color, float radius1, - float radius2, float speed, Axis axis, int lifeSpan, boolean isVisible, IAnimatedSprite sprite) { + private RotationIndicatorParticle(ClientWorld world, double x, double y, double z, int color, float radius1, + float radius2, float speed, Axis axis, int lifeSpan, boolean isVisible, IAnimatedSprite sprite) { super(world, x, y, z, sprite, 0); this.motionX = 0; this.motionY = 0; @@ -82,7 +83,7 @@ public class RotationIndicatorParticle extends SimpleAnimatedParticle { this.spriteSet = animatedSprite; } - public Particle makeParticle(RotationIndicatorParticleData data, World worldIn, double x, double y, double z, + public Particle makeParticle(RotationIndicatorParticleData data, ClientWorld worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { ClientPlayerEntity player = Minecraft.getInstance().player; boolean visible = player != null && GogglesItem.canSeeParticles(player); diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinBlock.java b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinBlock.java index 39fbddf41..5c70528bd 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinBlock.java @@ -75,21 +75,21 @@ public class BasinBlock extends Block implements ITE, IWrenchab @Override public void onLanded(IBlockReader worldIn, Entity entityIn) { super.onLanded(worldIn, entityIn); - if (!AllBlocks.BASIN.has(worldIn.getBlockState(entityIn.getPosition()))) + if (!AllBlocks.BASIN.has(worldIn.getBlockState(entityIn.getBlockPos()))) return; if (!(entityIn instanceof ItemEntity)) return; if (!entityIn.isAlive()) return; ItemEntity itemEntity = (ItemEntity) entityIn; - withTileEntityDo(worldIn, entityIn.getPosition(), te -> { + withTileEntityDo(worldIn, entityIn.getBlockPos(), te -> { ItemStack insertItem = ItemHandlerHelper.insertItem(te.inputInventory, itemEntity.getItem() .copy(), false); if (insertItem.isEmpty()) { itemEntity.remove(); if (!itemEntity.world.isRemote) AllTriggers.triggerForNearbyPlayers(AllTriggers.BASIN_THROW, itemEntity.world, - itemEntity.getPosition(), 3); + itemEntity.getBlockPos(), 3); return; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java index 5dcbc472c..7251db871 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java @@ -21,7 +21,7 @@ import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.capabilities.Capability; @@ -54,7 +54,7 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt @Override public void addBehaviours(List behaviours) { behaviours.add(new DirectBeltInputBehaviour(this)); - filtering = new FilteringBehaviour(this, new BasinValueBox()).moveText(new Vec3d(2, -8, 0)) + filtering = new FilteringBehaviour(this, new BasinValueBox()).moveText(new Vector3d(2, -8, 0)) .withCallback(newFilter -> contentsChanged = true) .forRecipes(); behaviours.add(filtering); @@ -145,7 +145,7 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt class BasinValueBox extends ValueBoxTransform.Sided { @Override - protected Vec3d getSouthLocation() { + protected Vector3d getSouthLocation() { return VecHelper.voxelSpace(8, 12, 16); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerBlockItem.java b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerBlockItem.java index 95ff6f7dc..c0cd2df3e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerBlockItem.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerBlockItem.java @@ -31,7 +31,7 @@ import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; import net.minecraft.util.WeightedSpawnerEntity; 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.minecraft.world.spawner.AbstractSpawner; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; @@ -115,20 +115,20 @@ public class BlazeBurnerBlockItem extends BlockItem { } @Override - public boolean itemInteractionForEntity(ItemStack heldItem, PlayerEntity player, LivingEntity entity, Hand hand) { + public ActionResultType itemInteractionForEntity(ItemStack heldItem, PlayerEntity player, LivingEntity entity, Hand hand) { if (hasCapturedBlaze()) - return false; + return ActionResultType.PASS; if (!(entity instanceof BlazeEntity)) - return false; + return ActionResultType.PASS; World world = player.world; spawnCaptureEffects(world, entity.getPositionVec()); if (world.isRemote) - return true; + return ActionResultType.FAIL; giveBurnerItemTo(player, heldItem, hand); entity.remove(); - return true; + return ActionResultType.SUCCESS; } protected void giveBurnerItemTo(PlayerEntity player, ItemStack heldItem, Hand hand) { @@ -142,12 +142,12 @@ public class BlazeBurnerBlockItem extends BlockItem { player.inventory.placeItemBackInInventory(player.world, filled); } - private void spawnCaptureEffects(World world, Vec3d vec) { + private void spawnCaptureEffects(World world, Vector3d vec) { if (world.isRemote) { for (int i = 0; i < 40; i++) { - Vec3d motion = VecHelper.offsetRandomly(Vec3d.ZERO, world.rand, .125f); + Vector3d motion = VecHelper.offsetRandomly(Vector3d.ZERO, world.rand, .125f); world.addParticle(ParticleTypes.FLAME, vec.x, vec.y, vec.z, motion.x, motion.y, motion.z); - Vec3d circle = motion.mul(1, 0, 1) + Vector3d circle = motion.mul(1, 0, 1) .normalize() .scale(.5f); world.addParticle(ParticleTypes.SMOKE, circle.x, vec.y, circle.z, 0, -0.125, 0); diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java index dac3dc308..ce344136c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java @@ -25,7 +25,7 @@ import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.event.entity.ProjectileImpactEvent; @@ -232,22 +232,22 @@ public class BlazeBurnerTileEntity extends SmartTileEntity { if (r.nextDouble() > 0.25) return; - Vec3d color = randomColor(heatLevel); + Vector3d color = randomColor(heatLevel); spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.03F, 15, false), 0.015 * burstMult, 0.1 * burstMult); } else if (heatLevel == BlazeBurnerBlock.HeatLevel.FADING) { if (r.nextDouble() > 0.5) return; - Vec3d color = randomColor(heatLevel); + Vector3d color = randomColor(heatLevel); spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.035F, 18, false), 0.03 * burstMult, 0.15 * burstMult); } else if (heatLevel == BlazeBurnerBlock.HeatLevel.KINDLED) { - Vec3d color = randomColor(heatLevel); + Vector3d color = randomColor(heatLevel); spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.04F, 35, true), 0.05 * burstMult, 0.2 * burstMult); }else if (heatLevel == BlazeBurnerBlock.HeatLevel.SEETHING) { for (int i = 0; i < 2; i++) { if (r.nextDouble() > 0.6) return; - Vec3d color = randomColor(heatLevel); + Vector3d color = randomColor(heatLevel); spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.045F, 35, true), 0.06 * burstMult, 0.22 * burstMult); } } @@ -266,9 +266,9 @@ public class BlazeBurnerTileEntity extends SmartTileEntity { 0.0D); } - private static Vec3d randomColor(BlazeBurnerBlock.HeatLevel heatLevel) { + private static Vector3d randomColor(BlazeBurnerBlock.HeatLevel heatLevel) { if (heatLevel == BlazeBurnerBlock.HeatLevel.NONE) - return new Vec3d(0,0,0); + return new Vector3d(0,0,0); return ColorHelper.getRGB(heatParticleColors[heatLevel.ordinal()-1][(int) (Math.random()*4)]); } @@ -287,7 +287,7 @@ public class BlazeBurnerTileEntity extends SmartTileEntity { } event.setCanceled(true); - event.getThrowable().setMotion(Vec3d.ZERO); + event.getThrowable().setMotion(Vector3d.ZERO); event.getThrowable().remove(); BlazeBurnerTileEntity heater = (BlazeBurnerTileEntity) tile; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java index c6956e514..ea6683e9f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java @@ -50,11 +50,6 @@ public class SpeedControllerTileEntity extends KineticTileEntity { attachKinetics(); } - @Override - public boolean hasFastRenderer() { - return false; - } - public static float getConveyedSpeed(KineticTileEntity cogWheel, KineticTileEntity speedControllerIn, boolean targetingController) { if (!(speedControllerIn instanceof SpeedControllerTileEntity)) diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftScreen.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftScreen.java index 0932fe187..27b8d1fd1 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftScreen.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftScreen.java @@ -1,5 +1,6 @@ package com.simibubi.create.content.contraptions.relays.advanced.sequencer; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.gui.AbstractSimiScreen; import com.simibubi.create.foundation.gui.AllGuiTextures; @@ -111,7 +112,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen { } @Override - protected void renderWindow(int mouseX, int mouseY, float partialTicks) { + protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { int hFontColor = 0xD3CBBE; background.draw(this, guiLeft, guiTop); @@ -124,14 +125,14 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen { SequencerInstructions def = instruction.instruction; def.background.draw(guiLeft + 14, guiTop + 29 + yOffset); - label(32, 6 + yOffset, Lang.translate(def.translationKey)); + label(matrixStack, 32, 6 + yOffset, Lang.translate(def.translationKey)); if (def.hasValueParameter) { String text = def.formatValue(instruction.value); - int stringWidth = font.getStringWidth(text); - label(85 + (12 - stringWidth / 2), 6 + yOffset, text); + int stringWidth = textRenderer.getStringWidth(text); + label(matrixStack, 85 + (12 - stringWidth / 2), 6 + yOffset, text); } if (def.hasSpeedParameter) - label(120, 6 + yOffset, instruction.speedModifier.label); + label(matrixStack, 120, 6 + yOffset, instruction.speedModifier.label); continue; } @@ -139,7 +140,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen { toDraw.draw(guiLeft + 14, guiTop + 29 + yOffset); } - font.drawStringWithShadow(title, guiLeft - 3 + (background.width - font.getStringWidth(title)) / 2, guiTop + 10, + textRenderer.drawWithShadow(matrixStack, title, guiLeft - 3 + (background.width - textRenderer.getStringWidth(title)) / 2, guiTop + 10, hFontColor); GuiGameElement.of(renderedItem) @@ -148,8 +149,8 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen { .render(); } - private void label(int x, int y, String text) { - font.drawStringWithShadow(text, guiLeft + x, guiTop + 26 + y, 0xFFFFEE); + private void label(MatrixStack matrixStack, int x, int y, String text) { + textRenderer.drawWithShadow(matrixStack, text, guiLeft + x, guiTop + 26 + y, 0xFFFFEE); } public void sendPacket() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java index 1bea353f8..e200a2e97 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java @@ -110,10 +110,11 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE { TextureAtlasSprite original = quad.getSprite(); TextureAtlasSprite target = spriteShift.getTarget(); BakedQuad newQuad = new BakedQuad(Arrays.copyOf(quad.getVertexData(), quad.getVertexData().length), - quad.getTintIndex(), quad.getFace(), target, quad.shouldApplyDiffuseLighting()); + quad.getTintIndex(), quad.getFace(), target, quad.hasShade()); VertexFormat format = DefaultVertexFormats.BLOCK; int[] vertexData = newQuad.getVertexData(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java index 7a90083bc..afa157ad9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java @@ -24,6 +24,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.settings.GraphicsFanciness; import net.minecraft.util.math.vector.Vector3f; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; @@ -207,7 +208,7 @@ public class BeltRenderer extends SafeTileEntityRenderer { int count = (int) (MathHelper.log2((int) (transported.stack.getCount()))) / 2; Random r = new Random(transported.angle); - if (Minecraft.getInstance().gameSettings.fancyGraphics) { + if (Minecraft.getInstance().gameSettings.graphicsMode == GraphicsFanciness.FANCY) { Vector3d shadowPos = Vector3d.of(te.getPos()).add(beltStartOffset.scale(1) .add(offsetVec) .add(alongX ? sideOffset : 0, .39, alongX ? 0 : sideOffset)); @@ -217,9 +218,9 @@ public class BeltRenderer extends SafeTileEntityRenderer { if (renderUpright) { Entity renderViewEntity = Minecraft.getInstance().renderViewEntity; if (renderViewEntity != null) { - Vec3d positionVec = renderViewEntity.getPositionVec(); - Vec3d vectorForOffset = BeltHelper.getVectorForOffset(te, offset); - Vec3d diff = vectorForOffset.subtract(positionVec); + Vector3d positionVec = renderViewEntity.getPositionVec(); + Vector3d vectorForOffset = BeltHelper.getVectorForOffset(te, offset); + Vector3d diff = vectorForOffset.subtract(positionVec); float yRot = (float) MathHelper.atan2(diff.z, -diff.x); ms.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion((float) (yRot + Math.PI / 2))); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java index 64a09757f..56e96ac57 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java @@ -154,11 +154,6 @@ public class BeltTileEntity extends KineticTileEntity { itemHandler = LazyOptional.of(() -> handler); } - @Override - public boolean hasFastRenderer() { - return !isController(); - } - @Override public LazyOptional getCapability(Capability cap, Direction side) { if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/item/BeltConnectorHandler.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/item/BeltConnectorHandler.java index 9ada79856..feb9b25ab 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/item/BeltConnectorHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/item/BeltConnectorHandler.java @@ -8,6 +8,7 @@ import com.simibubi.create.AllItems; import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock; import com.simibubi.create.foundation.config.AllConfigs; +import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -50,8 +51,7 @@ public class BeltConnectorHandler { BlockPos first = NBTUtil.readBlockPos(tag.getCompound("FirstPulley")); - if (!world.getBlockState(first) - .has(BlockStateProperties.AXIS)) + if (!BlockHelper.hasBlockStateProperty(world.getBlockState(first), BlockStateProperties.AXIS)) continue; Axis axis = world.getBlockState(first) .get(BlockStateProperties.AXIS); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltFunnelInteractionHandler.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltFunnelInteractionHandler.java index ad2d4e10f..d14e87002 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltFunnelInteractionHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltFunnelInteractionHandler.java @@ -6,6 +6,7 @@ import com.simibubi.create.content.logistics.block.funnel.FunnelTileEntity; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour; +import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -43,7 +44,7 @@ public class BeltFunnelInteractionHandler { return blocking; if (funnelState.get(BeltFunnelBlock.PUSHING)) return blocking; - if (funnelState.has(BeltFunnelBlock.POWERED) && funnelState.get(BeltFunnelBlock.POWERED)) + if (BlockHelper.hasBlockStateProperty(funnelState, BeltFunnelBlock.POWERED) && funnelState.get(BeltFunnelBlock.POWERED)) return blocking; TileEntity te = world.getTileEntity(funnelPos); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltInventory.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltInventory.java index e3e70261b..aa3e3333f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltInventory.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltInventory.java @@ -19,6 +19,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBe import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult; +import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.ServerSpeedProvider; import net.minecraft.block.Block; @@ -297,7 +298,7 @@ public class BeltInventory { if (inputBehaviour != null) return Ending.INSERT; - if (Block.hasSolidSide(world.getBlockState(nextPosition), world, nextPosition, belt.getMovementFacing() + if (BlockHelper.hasBlockSolidSide(world.getBlockState(nextPosition), world, nextPosition, belt.getMovementFacing() .getOpposite())) return Ending.BLOCKED; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltMovementHandler.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltMovementHandler.java index c50da55a7..ebbd51edb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltMovementHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltMovementHandler.java @@ -69,7 +69,7 @@ public class BeltMovementHandler { BlockPos pos = info.lastCollidedPos; World world = beltTe.getWorld(); TileEntity te = world.getTileEntity(pos); - TileEntity tileEntityBelowPassenger = world.getTileEntity(entityIn.getPosition()); + TileEntity tileEntityBelowPassenger = world.getTileEntity(entityIn.getBlockPos()); BlockState blockState = info.lastCollidedState; Direction movementFacing = Direction.getFacingFromAxisDirection(blockState.get(BlockStateProperties.HORIZONTAL_FACING).getAxis(), @@ -172,8 +172,8 @@ public class BeltMovementHandler { if (!isPlayer) entityIn.stepHeight = step; - boolean movedPastEndingSlope = onSlope && (AllBlocks.BELT.has(world.getBlockState(entityIn.getPosition())) - || AllBlocks.BELT.has(world.getBlockState(entityIn.getPosition().down()))); + boolean movedPastEndingSlope = onSlope && (AllBlocks.BELT.has(world.getBlockState(entityIn.getBlockPos())) + || AllBlocks.BELT.has(world.getBlockState(entityIn.getBlockPos().down()))); if (movedPastEndingSlope && !movingDown && Math.abs(movementSpeed) > 0) entityIn.setPosition(entityIn.getX(), entityIn.getY() + movement.y, entityIn.getZ()); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java index ebc34a3fd..ba3ff93bc 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java @@ -76,9 +76,9 @@ public class CogWheelBlock extends ShaftBlock { BlockState stateBelow = world.getBlockState(context.getPos() .down()); - FluidState ifluidstate = context.getWorld().getFluidState(context.getPos()); + FluidState FluidState = context.getWorld().getFluidState(context.getPos()); if (AllBlocks.ROTATION_SPEED_CONTROLLER.has(stateBelow) && isLarge) { - return this.getDefaultState().with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER)) + return this.getDefaultState().with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(FluidState.getFluid() == Fluids.WATER)) .with(AXIS, stateBelow.get(SpeedControllerBlock.HORIZONTAL_AXIS) == Axis.X ? Axis.Z : Axis.X); } @@ -87,10 +87,10 @@ public class CogWheelBlock extends ShaftBlock { Axis preferredAxis = getPreferredAxis(context); if (preferredAxis != null) return this.getDefaultState() - .with(AXIS, preferredAxis).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER)); + .with(AXIS, preferredAxis).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(FluidState.getFluid() == Fluids.WATER)); return this.getDefaultState() .with(AXIS, context.getFace() - .getAxis()).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER)); + .getAxis()).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(FluidState.getFluid() == Fluids.WATER)); } return getDefaultState().with(AXIS, ((IRotate) block).getRotationAxis(placedAgainst)); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ShaftBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ShaftBlock.java index 3ba62ce5e..8feb77850 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ShaftBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ShaftBlock.java @@ -134,7 +134,7 @@ public class ShaftBlock extends RotatedPillarKineticBlock implements IWaterLogga @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - FluidState ifluidstate = context.getWorld().getFluidState(context.getPos()); - return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER)); + FluidState FluidState = context.getWorld().getFluidState(context.getPos()); + return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(FluidState.getFluid() == Fluids.WATER)); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeBlock.java index 77cf273ff..a5adff8da 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeBlock.java @@ -5,6 +5,7 @@ import java.util.Random; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock; import com.simibubi.create.content.contraptions.base.IRotate; +import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.VecHelper; @@ -69,11 +70,12 @@ public class GaugeBlock extends DirectionalAxisKineticBlock { } } + /* FIXME: Is there a new way of doing this in 1.16? Or cn we just delete it? @SuppressWarnings("deprecation") @Override public MaterialColor getMaterialColor(BlockState state, IBlockReader worldIn, BlockPos pos) { return Blocks.SPRUCE_PLANKS.getMaterialColor(state, worldIn, pos); - } + } */ @Override public BlockState getStateForPlacement(BlockItemUseContext context) { @@ -127,7 +129,7 @@ public class GaugeBlock extends DirectionalAxisKineticBlock { if (getRotationAxis(state) == Axis.Y && face != state.get(FACING)) return false; BlockState blockState = world.getBlockState(pos.offset(face)); - if (Block.hasSolidSide(blockState, world, pos, face.getOpposite()) && blockState.getMaterial() != Material.GLASS + if (BlockHelper.hasBlockSolidSide(blockState, world, pos, face.getOpposite()) && blockState.getMaterial() != Material.GLASS && !(world instanceof WrappedWorld)) return false; return true; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeTileEntity.java index 3969af754..d7184659d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeTileEntity.java @@ -8,6 +8,7 @@ import com.simibubi.create.foundation.utility.Lang; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.text.ITextComponent; public class GaugeTileEntity extends KineticTileEntity implements IHaveGoggleInformation { @@ -44,8 +45,8 @@ public class GaugeTileEntity extends KineticTileEntity implements IHaveGoggleInf } @Override - public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { - tooltip.add(spacing + Lang.translate("gui.gauge.info_header")); + public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { + tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.gauge.info_header"))); return true; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/SpeedGaugeTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/SpeedGaugeTileEntity.java index 67af6486b..cc5fe3178 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/SpeedGaugeTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/SpeedGaugeTileEntity.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.relays.gauge; import java.util.List; +import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.content.contraptions.base.IRotate.SpeedLevel; import com.simibubi.create.content.contraptions.goggles.GogglesItem; import com.simibubi.create.foundation.advancement.AllTriggers; @@ -11,6 +12,7 @@ import com.simibubi.create.foundation.utility.Lang; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; public class SpeedGaugeTileEntity extends GaugeTileEntity{ @@ -46,13 +48,13 @@ public class SpeedGaugeTileEntity extends GaugeTileEntity{ } @Override - public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { + public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { super.addToGoggleTooltip(tooltip, isPlayerSneaking); - tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.speedometer.title")); - tooltip.add(spacing + SpeedLevel.getFormattedSpeedText(speed, overStressed)); + tooltip.add(ITextComponent.of(spacing + TextFormatting.GRAY + Lang.translate("gui.speedometer.title"))); + tooltip.add(ITextComponent.of(spacing + SpeedLevel.getFormattedSpeedText(speed, overStressed))); if (overStressed) - tooltip.add(spacing + TextFormatting.DARK_RED + Lang.translate("gui.stressometer.overstressed")); + tooltip.add(ITextComponent.of(spacing + TextFormatting.DARK_RED + Lang.translate("gui.stressometer.overstressed"))); return true; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/StressGaugeTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/StressGaugeTileEntity.java index fdd3b864c..db3f2a82d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/StressGaugeTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/StressGaugeTileEntity.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.relays.gauge; import java.util.List; +import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.content.contraptions.base.IRotate.StressImpact; import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation; import com.simibubi.create.foundation.item.ItemDescription; @@ -9,6 +10,7 @@ import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.Lang; import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; public class StressGaugeTileEntity extends GaugeTileEntity { @@ -56,7 +58,7 @@ public class StressGaugeTileEntity extends GaugeTileEntity { } @Override - public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { + public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { if (!StressImpact.isEnabled()) return false; @@ -65,15 +67,15 @@ public class StressGaugeTileEntity extends GaugeTileEntity { double capacity = getNetworkCapacity(); double stressFraction = getNetworkStress() / (capacity == 0 ? 1 : capacity); - tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.stressometer.title")); + tooltip.add(ITextComponent.of(spacing + TextFormatting.GRAY + Lang.translate("gui.stressometer.title"))); if (getTheoreticalSpeed() == 0) - tooltip.add(TextFormatting.DARK_GRAY + ItemDescription.makeProgressBar(3, -1) - + Lang.translate("gui.stressometer.no_rotation")); + tooltip.add(ITextComponent.of(TextFormatting.DARK_GRAY + ItemDescription.makeProgressBar(3, -1) + + Lang.translate("gui.stressometer.no_rotation"))); else { - tooltip.add(spacing + StressImpact.getFormattedStressText(stressFraction)); + tooltip.add(ITextComponent.of(spacing + StressImpact.getFormattedStressText(stressFraction))); - tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.stressometer.capacity")); + tooltip.add(ITextComponent.of(spacing + TextFormatting.GRAY + Lang.translate("gui.stressometer.capacity"))); double remainingCapacity = capacity - getNetworkStress(); double remainingCapacityAtBase = remainingCapacity / Math.abs(getTheoreticalSpeed()); @@ -81,10 +83,10 @@ public class StressGaugeTileEntity extends GaugeTileEntity { String capacityString = spacing + StressImpact.of(stressFraction).getRelativeColor() + "%s" + Lang.translate("generic.unit.stress") + " " + TextFormatting.DARK_GRAY + "%s"; - tooltip.add(String.format(capacityString, IHaveGoggleInformation.format(remainingCapacityAtBase), - Lang.translate("gui.goggles.base_value"))); - tooltip.add(String.format(capacityString, IHaveGoggleInformation.format(remainingCapacity), - Lang.translate("gui.goggles.at_current_speed"))); + tooltip.add(ITextComponent.of(String.format(capacityString, IHaveGoggleInformation.format(remainingCapacityAtBase), + Lang.translate("gui.goggles.base_value")))); + tooltip.add(ITextComponent.of(String.format(capacityString, IHaveGoggleInformation.format(remainingCapacity), + Lang.translate("gui.goggles.at_current_speed")))); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/wrench/IWrenchable.java b/src/main/java/com/simibubi/create/content/contraptions/wrench/IWrenchable.java index 6b4bb4481..bb55e417a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/wrench/IWrenchable.java +++ b/src/main/java/com/simibubi/create/content/contraptions/wrench/IWrenchable.java @@ -7,6 +7,7 @@ import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock; import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock; +import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.DirectionHelper; import com.simibubi.create.foundation.utility.VoxelShaper; @@ -57,7 +58,7 @@ public interface IWrenchable { .forEach(itemStack -> { player.inventory.placeItemBackInInventory(world, itemStack); }); - state.spawnAdditionalDrops(world, pos, ItemStack.EMPTY); + state.spawnAdditionalDrops((ServerWorld) world, pos, ItemStack.EMPTY); world.destroyBlock(pos, false); } return ActionResultType.SUCCESS; @@ -67,31 +68,31 @@ public interface IWrenchable { BlockState newState = originalState; if (targetedFace.getAxis() == Direction.Axis.Y) { - if (originalState.has(HorizontalAxisKineticBlock.HORIZONTAL_AXIS)) + if (BlockHelper.hasBlockStateProperty(originalState, HorizontalAxisKineticBlock.HORIZONTAL_AXIS)) return originalState.with(HorizontalAxisKineticBlock.HORIZONTAL_AXIS, DirectionHelper .rotateAround(VoxelShaper.axisAsFace(originalState.get(HorizontalAxisKineticBlock.HORIZONTAL_AXIS)), targetedFace.getAxis()) .getAxis()); - if (originalState.has(HorizontalKineticBlock.HORIZONTAL_FACING)) + if (BlockHelper.hasBlockStateProperty(originalState, HorizontalKineticBlock.HORIZONTAL_FACING)) return originalState.with(HorizontalKineticBlock.HORIZONTAL_FACING, DirectionHelper .rotateAround(originalState.get(HorizontalKineticBlock.HORIZONTAL_FACING), targetedFace.getAxis())); } - if (originalState.has(RotatedPillarKineticBlock.AXIS)) + if (BlockHelper.hasBlockStateProperty(originalState, RotatedPillarKineticBlock.AXIS)) return originalState.with(RotatedPillarKineticBlock.AXIS, DirectionHelper .rotateAround(VoxelShaper.axisAsFace(originalState.get(RotatedPillarKineticBlock.AXIS)), targetedFace.getAxis()) .getAxis()); - if (!originalState.has(DirectionalKineticBlock.FACING)) + if (!BlockHelper.hasBlockStateProperty(originalState, DirectionalKineticBlock.FACING)) return originalState; Direction stateFacing = originalState.get(DirectionalKineticBlock.FACING); if (stateFacing.getAxis() .equals(targetedFace.getAxis())) { - if (originalState.has(DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE)) + if (BlockHelper.hasBlockStateProperty(originalState, DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE)) return originalState.cycle(DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE); else return originalState; @@ -100,7 +101,7 @@ public interface IWrenchable { newState = newState.with(DirectionalKineticBlock.FACING, DirectionHelper.rotateAround(newState.get(DirectionalKineticBlock.FACING), targetedFace.getAxis())); if (targetedFace.getAxis() == Direction.Axis.Y - && newState.has(DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE)) + && BlockHelper.hasBlockStateProperty(newState, DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE)) newState = newState.cycle(DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE); } while (newState.get(DirectionalKineticBlock.FACING) .getAxis() diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryEffectPacket.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryEffectPacket.java index 764f8ab37..80a7445b7 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryEffectPacket.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryEffectPacket.java @@ -43,7 +43,7 @@ public class SymmetryEffectPacket extends SimplePacketBase { public void handle(Supplier ctx) { ctx.get().enqueueWork(() -> DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { - if (Minecraft.getInstance().player.getPositionVector().distanceTo(Vector3d.of(mirror)) > 100) + if (Minecraft.getInstance().player.getPositionVec().distanceTo(Vector3d.of(mirror)) > 100) return; for (BlockPos to : positions) SymmetryHandler.drawEffect(mirror, to); diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandScreen.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandScreen.java index 36b6d2c83..0dd73ad91 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandScreen.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandScreen.java @@ -104,14 +104,14 @@ public class SymmetryWandScreen extends AbstractSimiScreen { } @Override - protected void renderWindow(int mouseX, int mouseY, float partialTicks) { + protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { AllGuiTextures.WAND_SYMMETRY.draw(this, guiLeft, guiTop); int x = guiLeft + 63; int y = guiTop + 15; - font.drawString(mirrorType, x - 5, y, AllGuiTextures.FONT_COLOR); - font.drawString(orientation, x - 5, y + 20, AllGuiTextures.FONT_COLOR); + textRenderer.draw(matrixStack, mirrorType, x - 5, y, AllGuiTextures.FONT_COLOR); + textRenderer.draw(matrixStack, orientation, x - 5, y + 20, AllGuiTextures.FONT_COLOR); renderBlock(); @@ -140,12 +140,12 @@ public class SymmetryWandScreen extends AbstractSimiScreen { @Override public void removed() { - ItemStack heldItem = minecraft.player.getHeldItem(hand); + ItemStack heldItem = client.player.getHeldItem(hand); CompoundNBT compound = heldItem.getTag(); compound.put(SymmetryWandItem.SYMMETRY, currentElement.writeToNbt()); heldItem.setTag(compound); AllPackets.channel.send(PacketDistributor.SERVER.noArg(), new NbtPacket(heldItem, hand)); - minecraft.player.setHeldItem(hand, heldItem); + client.player.setHeldItem(hand, heldItem); super.removed(); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/DeforesterItem.java b/src/main/java/com/simibubi/create/content/curiosities/tools/DeforesterItem.java index ab33f1689..a178403d6 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/DeforesterItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/DeforesterItem.java @@ -30,30 +30,28 @@ public class DeforesterItem extends AxeItem { } // Moved away from Item#onBlockDestroyed as it does not get called in Creative - public static void destroyTree(ItemStack stack, IWorld worldIn, BlockState state, BlockPos pos, + public static void destroyTree(ItemStack stack, IWorld iWorld, BlockState state, BlockPos pos, PlayerEntity player) { - if (!state.isIn(BlockTags.LOGS) || player.isSneaking()) + if (!state.isIn(BlockTags.LOGS) || player.isSneaking() || !(iWorld instanceof World)) return; + World worldIn = (World) iWorld; Tree tree = TreeCutter.cutTree(worldIn, pos); if (tree == null) return; boolean dropBlock = !player.isCreative(); - World world = worldIn.getWorld(); - if (world == null) - return; Vector3d vec = player.getLookVec(); for (BlockPos log : tree.logs) - BlockHelper.destroyBlock(world, log, 1 / 2f, item -> { + BlockHelper.destroyBlock(worldIn, log, 1 / 2f, item -> { if (dropBlock) { - dropItemFromCutTree(world, pos, vec, log, item); + dropItemFromCutTree(worldIn, pos, vec, log, item); stack.damageItem(1, player, p -> p.sendBreakAnimation(Hand.MAIN_HAND)); } }); for (BlockPos leaf : tree.leaves) - BlockHelper.destroyBlock(world, leaf, 1 / 8f, item -> { + BlockHelper.destroyBlock(worldIn, leaf, 1 / 8f, item -> { if (dropBlock) - dropItemFromCutTree(world, pos, vec, leaf, item); + dropItemFromCutTree(worldIn, pos, vec, leaf, item); }); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java index bc1259b77..dcc67e25d 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java @@ -125,20 +125,20 @@ public class ExtendoGripItem extends Item { .getValue(); if (!player.isCreative()) d0 -= 0.5f; - Vector3d vec3d = player.getEyePosition(mc.getRenderPartialTicks()); - Vector3d vec3d1 = player.getLook(1.0F); - Vector3d vec3d2 = vec3d.add(vec3d1.x * d0, vec3d1.y * d0, vec3d1.z * d0); + Vector3d Vector3d = player.getEyePosition(mc.getRenderPartialTicks()); + Vector3d Vector3d1 = player.getLook(1.0F); + Vector3d Vector3d2 = Vector3d.add(Vector3d1.x * d0, Vector3d1.y * d0, Vector3d1.z * d0); AxisAlignedBB axisalignedbb = player.getBoundingBox() - .expand(vec3d1.scale(d0)) + .expand(Vector3d1.scale(d0)) .grow(1.0D, 1.0D, 1.0D); EntityRayTraceResult entityraytraceresult = - ProjectileHelper.rayTraceEntities(player, vec3d, vec3d2, axisalignedbb, (e) -> { + ProjectileHelper.rayTraceEntities(player, Vector3d, Vector3d2, axisalignedbb, (e) -> { return !e.isSpectator() && e.canBeCollidedWith(); }, d0 * d0); if (entityraytraceresult != null) { Entity entity1 = entityraytraceresult.getEntity(); - Vector3d vec3d3 = entityraytraceresult.getHitVec(); - double d2 = vec3d.squareDistanceTo(vec3d3); + Vector3d Vector3d3 = entityraytraceresult.getHitVec(); + double d2 = Vector3d.squareDistanceTo(Vector3d3); if (d2 < d0 * d0 || mc.objectMouseOver == null || mc.objectMouseOver.getType() == Type.MISS) { mc.objectMouseOver = entityraytraceresult; if (entity1 instanceof LivingEntity || entity1 instanceof ItemFrameEntity) diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperBeamPacket.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperBeamPacket.java index 3e45bdd04..45a0716ad 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperBeamPacket.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperBeamPacket.java @@ -49,7 +49,7 @@ public class ZapperBeamPacket extends SimplePacketBase { public void handle(Supplier context) { context.get().enqueueWork(() -> DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { - if (Minecraft.getInstance().player.getPositionVector().distanceTo(start) > 100) + if (Minecraft.getInstance().player.getPositionVec().distanceTo(start) > 100) return; ZapperRenderHandler.addBeam(new LaserBeam(start, target).followPlayer(self, hand == Hand.MAIN_HAND)); diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperInteractionHandler.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperInteractionHandler.java index 729876ac3..60278afc4 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperInteractionHandler.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperInteractionHandler.java @@ -70,19 +70,19 @@ public class ZapperInteractionHandler { return false; if (player.world.getTileEntity(pos) != null) return false; - if (newState.has(BlockStateProperties.DOUBLE_BLOCK_HALF)) + if (BlockHelper.hasBlockStateProperty(newState, BlockStateProperties.DOUBLE_BLOCK_HALF)) return false; - if (newState.has(BlockStateProperties.ATTACHED)) + if (BlockHelper.hasBlockStateProperty(newState, BlockStateProperties.ATTACHED)) return false; - if (newState.has(BlockStateProperties.HANGING)) + if (BlockHelper.hasBlockStateProperty(newState, BlockStateProperties.HANGING)) return false; - if (newState.has(BlockStateProperties.BED_PART)) + if (BlockHelper.hasBlockStateProperty(newState, BlockStateProperties.BED_PART)) return false; - if (newState.has(BlockStateProperties.STAIRS_SHAPE)) + if (BlockHelper.hasBlockStateProperty(newState, BlockStateProperties.STAIRS_SHAPE)) newState = newState.with(BlockStateProperties.STAIRS_SHAPE, StairsShape.STRAIGHT); - if (newState.has(BlockStateProperties.PERSISTENT)) + if (BlockHelper.hasBlockStateProperty(newState, BlockStateProperties.PERSISTENT)) newState = newState.with(BlockStateProperties.PERSISTENT, true); - if (newState.has(BlockStateProperties.WATERLOGGED)) + if (BlockHelper.hasBlockStateProperty(newState, BlockStateProperties.WATERLOGGED)) newState = newState.with(BlockStateProperties.WATERLOGGED, false); CompoundNBT tag = stack.getOrCreateTag(); @@ -91,7 +91,7 @@ public class ZapperInteractionHandler { return false; tag.put("BlockUsed", NBTUtil.writeBlockState(newState)); - player.world.playSound(player, player.getPosition(), AllSoundEvents.BLOCKZAPPER_CONFIRM.get(), + player.world.playSound(player, player.getBlockPos(), AllSoundEvents.BLOCKZAPPER_CONFIRM.get(), SoundCategory.BLOCKS, 0.5f, 0.8f); return true; } diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperItem.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperItem.java index 16c4fb5b5..a43fb07ae 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperItem.java @@ -139,7 +139,7 @@ public abstract class ZapperItem extends Item { // Check if can be used String msg = validateUsage(item); if (msg != null) { - world.playSound(player, player.getPosition(), AllSoundEvents.BLOCKZAPPER_DENY.get(), SoundCategory.BLOCKS, + world.playSound(player, player.getBlockPos(), AllSoundEvents.BLOCKZAPPER_DENY.get(), SoundCategory.BLOCKS, 1f, 0.5f); player.sendStatusMessage(new StringTextComponent(TextFormatting.RED + msg), true); return new ActionResult(ActionResultType.FAIL, item); diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperRenderHandler.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperRenderHandler.java index 6f62dab8b..35b24c9d7 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperRenderHandler.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperRenderHandler.java @@ -110,7 +110,7 @@ public class ZapperRenderHandler { leftHandAnimation = .2f; dontReequipLeft = false; } - playSound(hand, player.getPosition()); + playSound(hand, player.getBlockPos()); } public static void playSound(Hand hand, BlockPos position) { diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperScreen.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperScreen.java index 2beb5a4e7..4af858788 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperScreen.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperScreen.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.curiosities.zapper; import java.util.Vector; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.gui.AbstractSimiScreen; import com.simibubi.create.foundation.gui.AllGuiTextures; @@ -19,6 +20,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.NBTUtil; import net.minecraft.util.Hand; +import net.minecraft.util.text.ITextComponent; @SuppressWarnings("deprecation") public class ZapperScreen extends AbstractSimiScreen { @@ -63,7 +65,7 @@ public class ZapperScreen extends AbstractSimiScreen { PlacementPatterns pattern = PlacementPatterns.values()[id]; patternButtons.add(new IconButton(i + 147 + col * 18, j + 23 + row * 18, pattern.icon)); patternButtons.get(id) - .setToolTip(Lang.translate("gui.blockzapper.pattern." + pattern.translationKey)); + .setToolTip(ITextComponent.of(Lang.translate("gui.blockzapper.pattern." + pattern.translationKey))); } } @@ -75,14 +77,14 @@ public class ZapperScreen extends AbstractSimiScreen { } @Override - protected void renderWindow(int mouseX, int mouseY, float partialTicks) { + protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { int i = guiLeft - 20; int j = guiTop; background.draw(this, i, j); - drawOnBackground(i, j); + drawOnBackground(matrixStack, i, j); - minecraft.getTextureManager() + client.getTextureManager() .bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); RenderSystem.enableBlend(); @@ -90,9 +92,9 @@ public class ZapperScreen extends AbstractSimiScreen { renderZapper(); } - protected void drawOnBackground(int i, int j) { - font.drawStringWithShadow(title, i + 8, j + 10, brightColor); - font.drawString(patternSection, i + 148, j + 11, fontColor); + protected void drawOnBackground(MatrixStack matrixStack, int i, int j) { + textRenderer.drawWithShadow(matrixStack, title, i + 8, j + 10, brightColor); + textRenderer.draw(matrixStack, patternSection, i + 148, j + 11, fontColor); } @Override diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperItem.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperItem.java index 0d980fdc9..c652d0d2e 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperItem.java @@ -123,8 +123,8 @@ public class BlockzapperItem extends ZapperItem { world.getBlockState(placed.offset(updateDirection)), world, placed, placed.offset(updateDirection)); BlockSnapshot blocksnapshot = BlockSnapshot.getBlockSnapshot(world, placed); - FluidState ifluidstate = world.getFluidState(placed); - world.setBlockState(placed, ifluidstate.getBlockState(), 18); + FluidState FluidState = world.getFluidState(placed); + world.setBlockState(placed, FluidState.getBlockState(), 18); world.setBlockState(placed, selectedState); if (ForgeEventFactory.onBlockPlace(player, blocksnapshot, Direction.UP)) { blocksnapshot.restore(true, false); diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperScreen.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperScreen.java index d0e5794f9..62168da6a 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperScreen.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperScreen.java @@ -14,6 +14,7 @@ import com.simibubi.create.foundation.utility.Lang; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; public class BlockzapperScreen extends ZapperScreen { @@ -47,19 +48,19 @@ public class BlockzapperScreen extends ZapperScreen { replaceModeButton = new IconButton(i + 51, j + 41, AllIcons.I_REPLACE_SOLID); if (nbt.contains("Replace") && nbt.getBoolean("Replace")) replaceModeIndicator.state = State.ON; - replaceModeButton.setToolTip(Lang.translate("gui.blockzapper.replaceMode")); + replaceModeButton.setToolTip(ITextComponent.of(Lang.translate("gui.blockzapper.replaceMode"))); spreadDiagonallyIndicator = new Indicator(i + 74, j + 36, ""); spreadDiagonallyButton = new IconButton(i + 74, j + 41, AllIcons.I_FOLLOW_DIAGONAL); if (nbt.contains("SearchDiagonal") && nbt.getBoolean("SearchDiagonal")) spreadDiagonallyIndicator.state = State.ON; - spreadDiagonallyButton.setToolTip(Lang.translate("gui.blockzapper.searchDiagonal")); + spreadDiagonallyButton.setToolTip(ITextComponent.of(Lang.translate("gui.blockzapper.searchDiagonal"))); spreadMaterialIndicator = new Indicator(i + 92, j + 36, ""); spreadMaterialButton = new IconButton(i + 92, j + 41, AllIcons.I_FOLLOW_MATERIAL); if (nbt.contains("SearchFuzzy") && nbt.getBoolean("SearchFuzzy")) spreadMaterialIndicator.state = State.ON; - spreadMaterialButton.setToolTip(Lang.translate("gui.blockzapper.searchFuzzy")); + spreadMaterialButton.setToolTip(ITextComponent.of(Lang.translate("gui.blockzapper.searchFuzzy"))); spreadRangeLabel = new Label(i + 119, j + 46, "").withShadow().withSuffix("m"); spreadRangeInput = new ScrollInput(i + 115, j + 43, 22, 14).withRange(1, BlockzapperItem.getMaxAoe(zapper)) @@ -68,7 +69,7 @@ public class BlockzapperScreen extends ZapperScreen { if (nbt.contains("SearchDistance")) spreadRangeInput.setState(nbt.getInt("SearchDistance")); if (BlockzapperItem.getMaxAoe(zapper) == 2) - spreadRangeInput.getToolTip().add(1, TextFormatting.RED + needsUpgradedAmplifier); + spreadRangeInput.getToolTip().add(1, ITextComponent.of(TextFormatting.RED + needsUpgradedAmplifier)); Collections.addAll(widgets, replaceModeButton, replaceModeIndicator, spreadDiagonallyButton, spreadDiagonallyIndicator, spreadMaterialButton, spreadMaterialIndicator, spreadRangeLabel, diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperScreen.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperScreen.java index f9d6ec474..50b07b413 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperScreen.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperScreen.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.curiosities.zapper.terrainzapper; import java.util.List; import java.util.Vector; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.content.curiosities.zapper.ZapperScreen; import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.gui.widgets.IconButton; @@ -17,6 +18,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.NBTUtil; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; public class WorldshaperScreen extends ZapperScreen { @@ -70,7 +72,7 @@ public class WorldshaperScreen extends ZapperScreen { TerrainTools tool = toolValues[id]; toolButtons.add(new IconButton(i + 8 + id * 18, j + 76, tool.icon)); toolButtons.get(id) - .setToolTip(Lang.translate("gui.terrainzapper.tool." + tool.translationKey)); + .setToolTip(ITextComponent.of(Lang.translate("gui.terrainzapper.tool." + tool.translationKey))); } if (nbt.contains("Tool")) @@ -84,7 +86,7 @@ public class WorldshaperScreen extends ZapperScreen { PlacementOptions option = placementValues[id]; placementButtons.add(new IconButton(i + 147 + id * 18, j + 76, option.icon)); placementButtons.get(id) - .setToolTip(Lang.translate("gui.terrainzapper.placement." + option.translationKey)); + .setToolTip(ITextComponent.of(Lang.translate("gui.terrainzapper.placement." + option.translationKey))); } if (nbt.contains("Placement")) @@ -122,7 +124,7 @@ public class WorldshaperScreen extends ZapperScreen { .writingTo(label) .titled(currentBrush.getParamLabel(index)) .calling(state -> { - label.x = i + 62 + 18 * indexFinal - font.getStringWidth(label.text) / 2; + label.x = i + 62 + 18 * indexFinal - textRenderer.getStringWidth(label.text) / 2; }); input.setState(params[index]); input.onChanged(); @@ -171,16 +173,16 @@ public class WorldshaperScreen extends ZapperScreen { } @Override - protected void drawOnBackground(int i, int j) { - super.drawOnBackground(i, j); + protected void drawOnBackground(MatrixStack matrixStack, int i, int j) { + super.drawOnBackground(matrixStack, i, j); Brush currentBrush = TerrainBrushes.values()[brushInput.getState()].get(); for (int index = 2; index >= currentBrush.amtParams; index--) { AllGuiTextures.TERRAINZAPPER_INACTIVE_PARAM.draw(i + 55 + index * 18, j + 43); } - font.drawString(toolSection, i + 8, j + 64, fontColor); - font.drawString(placementSection, i + 148, j + 64, fontColor); + textRenderer.draw(matrixStack, toolSection, i + 8, j + 64, fontColor); + textRenderer.draw(matrixStack, placementSection, i + 148, j + 64, fontColor); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BrassTunnelTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BrassTunnelTileEntity.java index fe0afadf4..651b1af68 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BrassTunnelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BrassTunnelTileEntity.java @@ -8,6 +8,7 @@ import java.util.Set; import javax.annotation.Nullable; +import com.simibubi.create.foundation.utility.BlockHelper; import org.apache.commons.lang3.tuple.Pair; import com.simibubi.create.AllBlocks; @@ -275,7 +276,7 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity { Direction movementFacing = below.getMovementFacing(); if (side == movementFacing) - if (!Block.hasSolidSide(world.getBlockState(offset), world, offset, side.getOpposite())) { + if (!BlockHelper.hasBlockSolidSide(world.getBlockState(offset), world, offset, side.getOpposite())) { BeltTileEntity controllerTE = below.getControllerTE(); if (controllerTE == null) return null; @@ -393,7 +394,7 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity { TileEntityBehaviour.get(world, offset, DirectBeltInputBehaviour.TYPE); if (inputBehaviour == null) { if (direction == movementFacing) - if (!Block.hasSolidSide(world.getBlockState(offset), world, offset, direction.getOpposite())) + if (!BlockHelper.hasBlockSolidSide(world.getBlockState(offset), world, offset, direction.getOpposite())) validOutputs.add(Pair.of(tunnelTE, direction)); continue; } @@ -408,7 +409,7 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity { BlockState funnelState = world.getBlockState(getPos().offset(side)); if (!(funnelState.getBlock() instanceof BeltFunnelBlock)) return false; - if (funnelState.has(BeltFunnelBlock.POWERED) && funnelState.get(BeltFunnelBlock.POWERED)) + if (BlockHelper.hasBlockStateProperty(funnelState, BeltFunnelBlock.POWERED) && funnelState.get(BeltFunnelBlock.POWERED)) return false; if (funnelState.get(BeltFunnelBlock.HORIZONTAL_FACING) != side.getOpposite()) return false; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java index 8ea439a51..5a0520993 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java @@ -177,7 +177,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor if (bottomPullDistance > 0 && getItem().isEmpty() && entitySearchCooldown-- <= 0) { entitySearchCooldown = 5; - Vec3d center = VecHelper.getCenterOf(pos); + Vector3d center = VecHelper.getCenterOf(pos); AxisAlignedBB searchArea = new AxisAlignedBB(center.add(0, -bottomPullDistance - 0.5, 0), center.add(0, -0.5, 0)).grow(.45f); for (ItemEntity itemEntity : world.getEntitiesWithinAABB(ItemEntity.class, searchArea)) { @@ -277,11 +277,11 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor private void spawnAirFlow(float verticalStart, float verticalEnd, float motion, float drag) { AirParticleData airParticleData = new AirParticleData(drag, motion); - Vec3d origin = new Vec3d(pos); + Vector3d origin = new Vector3d(pos); float xOff = Create.random.nextFloat() * .5f + .25f; float zOff = Create.random.nextFloat() * .5f + .25f; - Vec3d v = origin.add(xOff, verticalStart, zOff); - Vec3d d = origin.add(xOff, verticalEnd, zOff) + Vector3d v = origin.add(xOff, verticalStart, zOff); + Vector3d d = origin.add(xOff, verticalEnd, zOff) .subtract(v); if (Create.random.nextFloat() < 2 * motion) world.addOptionalParticle(airParticleData, v.x, v.y, v.z, d.x, d.y, d.z); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotRenderer.java index 0cf487c4d..b759215a4 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotRenderer.java @@ -33,7 +33,7 @@ public class DepotRenderer extends SafeTileEntityRenderer { TransportedItemStack transported = te.heldItem; MatrixStacker msr = MatrixStacker.of(ms); - Vec3d itemPosition = VecHelper.getCenterOf(te.getPos()); + Vector3d itemPosition = VecHelper.getCenterOf(te.getPos()); ms.push(); ms.translate(.5f, 15 / 16f, .5f); @@ -87,7 +87,7 @@ public class DepotRenderer extends SafeTileEntityRenderer { } protected void renderItem(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay, ItemStack itemStack, - int angle, Random r, Vec3d itemPosition) { + int angle, Random r, Vector3d itemPosition) { ItemRenderer itemRenderer = Minecraft.getInstance() .getItemRenderer(); MatrixStacker msr = MatrixStacker.of(ms); @@ -102,9 +102,9 @@ public class DepotRenderer extends SafeTileEntityRenderer { if (renderUpright) { Entity renderViewEntity = Minecraft.getInstance().renderViewEntity; if (renderViewEntity != null) { - Vec3d positionVec = renderViewEntity.getPositionVec(); - Vec3d vectorForOffset = itemPosition; - Vec3d diff = vectorForOffset.subtract(positionVec); + Vector3d positionVec = renderViewEntity.getPositionVec(); + Vector3d vectorForOffset = itemPosition; + Vector3d diff = vectorForOffset.subtract(positionVec); float yRot = (float) MathHelper.atan2(diff.z, -diff.x); ms.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion((float) (yRot - Math.PI / 2))); } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotTileEntity.java index f004aa239..a71da8fb6 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotTileEntity.java @@ -191,7 +191,7 @@ public class DepotTileEntity extends SmartTileEntity { continue; } ItemStack remainder = ItemHandlerHelper.insertItemStacked(processingOutputBuffer, added.stack, false); - Vec3d vec = VecHelper.getCenterOf(pos); + Vector3d vec = VecHelper.getCenterOf(pos); InventoryHelper.spawnItemStack(world, vec.x, vec.y + .5f, vec.z, remainder); } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateContainer.java b/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateContainer.java index 68c13d22a..0a3ad5136 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateContainer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateContainer.java @@ -26,7 +26,7 @@ public class AdjustableCrateContainer extends Container { this.playerInventory = inv; if (tileEntity instanceof AdjustableCrateTileEntity) { this.te = (AdjustableCrateTileEntity) tileEntity; - this.te.handleUpdateTag(extraData.readCompoundTag()); + this.te.handleUpdateTag(te.getBlockState(), extraData.readCompoundTag()); init(); } } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java index 93d21dea1..5619564d1 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java @@ -30,7 +30,7 @@ import net.minecraft.nbt.ListNBT; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.common.util.Constants.NBT; public class ArmTileEntity extends KineticTileEntity { @@ -414,9 +414,9 @@ public class ArmTileEntity extends KineticTileEntity { } @Override - protected Vec3d getLocalOffset(BlockState state) { + protected Vector3d getLocalOffset(BlockState state) { int yPos = state.get(ArmBlock.CEILING) ? 16 - 3 : 3; - Vec3d location = VecHelper.voxelSpace(8, yPos, 14.5); + Vector3d location = VecHelper.voxelSpace(8, yPos, 14.5); location = VecHelper.rotateCentered(location, AngleHelper.horizontalAngle(getSide()), Direction.Axis.Y); return location; } diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java index 73e532dc4..a699fb0cb 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java @@ -6,6 +6,7 @@ import static net.minecraft.util.text.TextFormatting.GRAY; import java.util.Collections; import java.util.List; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.content.logistics.item.filter.FilterScreenPacket.Option; import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen; import com.simibubi.create.foundation.gui.AllGuiTextures; @@ -14,6 +15,7 @@ import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.gui.widgets.IconButton; import com.simibubi.create.foundation.gui.widgets.Indicator; import com.simibubi.create.foundation.gui.widgets.Indicator.State; +import com.simibubi.create.foundation.item.ItemDescription; import com.simibubi.create.foundation.item.ItemDescription.Palette; import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.networking.AllPackets; @@ -49,7 +51,7 @@ public abstract class AbstractFilterScreen ex } @Override - protected void renderWindow(int mouseX, int mouseY, float partialTicks) { + protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) { int x = guiLeft; int y = guiTop; background.draw(this, x, y); @@ -58,8 +60,8 @@ public abstract class AbstractFilterScreen ex int invY = y + background.height + 10; PLAYER_INVENTORY.draw(this, invX, invY); - font.drawString(playerInventory.getDisplayName().getFormattedText(), invX + 7, invY + 6, 0x666666); - font.drawString(I18n.format(container.filterItem.getTranslationKey()), x + 15, y + 9, 0x5B5037); + textRenderer.draw(ms, playerInventory.getDisplayName(), invX + 7, invY + 6, 0x666666); + textRenderer.draw(ms, I18n.format(container.filterItem.getTranslationKey()), x + 15, y + 9, 0x5B5037); /*RenderHelper.enableGuiDepthLighting(); RenderSystem.pushMatrix(); @@ -82,7 +84,7 @@ public abstract class AbstractFilterScreen ex handleIndicators(); if (!container.player.getHeldItemMainhand().equals(container.filterItem, false)) - minecraft.player.closeScreen(); + client.player.closeScreen(); } public void handleIndicators() { @@ -104,7 +106,7 @@ public abstract class AbstractFilterScreen ex for (IconButton button : tooltipButtons) { if (!button.getToolTip().isEmpty()) { button.setToolTip(button.getToolTip().get(0)); - button.getToolTip().add(TooltipHelper.holdShift(Palette.Yellow, hasShiftDown())); + button.getToolTip().add(ITextComponent.of(TooltipHelper.holdShift(Palette.Yellow, hasShiftDown()))); } } @@ -126,8 +128,8 @@ public abstract class AbstractFilterScreen ex private void fillToolTip(IconButton button, String tooltip) { if (!button.isHovered()) return; - List tip = button.getToolTip(); - tip.addAll(TooltipHelper.cutString(tooltip, GRAY, GRAY)); + List tip = button.getToolTip(); + TooltipHelper.cutString(tooltip, GRAY, GRAY).stream().map(ITextComponent::of).forEachOrdered(tip::add); } @Override @@ -136,7 +138,7 @@ public abstract class AbstractFilterScreen ex if (button == 0) { if (confirmButton.isHovered()) { - minecraft.player.closeScreen(); + client.player.closeScreen(); return true; } if (resetButton.isHovered()) { diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableContainer.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableContainer.java index 00192180d..4b13a0d4f 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableContainer.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableContainer.java @@ -28,7 +28,7 @@ public class SchematicTableContainer extends Container { TileEntity tileEntity = world.getTileEntity(extraData.readBlockPos()); if (tileEntity instanceof SchematicTableTileEntity) { this.te = (SchematicTableTileEntity) tileEntity; - this.te.handleUpdateTag(extraData.readCompoundTag()); + this.te.handleUpdateTag(te.getBlockState(), extraData.readCompoundTag()); init(); } } diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonContainer.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonContainer.java index 5ffa0f784..6af24988e 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonContainer.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonContainer.java @@ -25,7 +25,7 @@ public class SchematicannonContainer extends Container { TileEntity tileEntity = world.getTileEntity(buffer.readBlockPos()); if (tileEntity instanceof SchematicannonTileEntity) { this.te = (SchematicannonTileEntity) tileEntity; - this.te.handleUpdateTag(buffer.readCompoundTag()); + this.te.handleUpdateTag(te.getBlockState(), buffer.readCompoundTag()); init(); } } diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java index a339e48dc..500777a35 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java @@ -634,7 +634,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC } currentPos = entities.get(printingEntityIndex) - .getPosition() + .getBlockPos() .subtract(schematicAnchor); return; } @@ -656,7 +656,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC return; } currentPos = entities.get(0) - .getPosition() + .getBlockPos() .subtract(schematicAnchor); } } diff --git a/src/main/java/com/simibubi/create/events/ClientEvents.java b/src/main/java/com/simibubi/create/events/ClientEvents.java index 2b1e9f27e..0f2cd4873 100644 --- a/src/main/java/com/simibubi/create/events/ClientEvents.java +++ b/src/main/java/com/simibubi/create/events/ClientEvents.java @@ -34,7 +34,7 @@ import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.item.ItemStack; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; @@ -100,7 +100,7 @@ public class ClientEvents { public static void onRenderWorld(RenderWorldLastEvent event) { MatrixStack ms = event.getMatrixStack(); ActiveRenderInfo info = Minecraft.getInstance().gameRenderer.getActiveRenderInfo(); - Vec3d view = info.getProjectedView(); + Vector3d view = info.getProjectedView(); ms.push(); ms.translate(-view.getX(), -view.getY(), -view.getZ()); SuperRenderTypeBuffer buffer = SuperRenderTypeBuffer.getInstance(); diff --git a/src/main/java/com/simibubi/create/foundation/advancement/AllTriggers.java b/src/main/java/com/simibubi/create/foundation/advancement/AllTriggers.java index fe199f622..9de978031 100644 --- a/src/main/java/com/simibubi/create/foundation/advancement/AllTriggers.java +++ b/src/main/java/com/simibubi/create/foundation/advancement/AllTriggers.java @@ -9,6 +9,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IWorld; import net.minecraft.world.World; public class AllTriggers { @@ -55,21 +56,21 @@ public class AllTriggers { trigger.trigger((ServerPlayerEntity) player); } - public static void triggerForNearbyPlayers(ITriggerable trigger, World world, BlockPos pos, int range) { + public static void triggerForNearbyPlayers(ITriggerable trigger, IWorld world, BlockPos pos, int range) { triggerForNearbyPlayers(trigger, world, pos, range, player -> true); } - public static void triggerForNearbyPlayers(ITriggerable trigger, World world, BlockPos pos, int range, + public static void triggerForNearbyPlayers(ITriggerable trigger, IWorld world, BlockPos pos, int range, Predicate playerFilter) { if (world == null) return; - if (world.isRemote) + if (world.isRemote()) return; List players = getPlayersInRange(world, pos, range); players.stream().filter(playerFilter).forEach(trigger::trigger); } - public static List getPlayersInRange(World world, BlockPos pos, int range) { + public static List getPlayersInRange(IWorld world, BlockPos pos, int range) { List players = world.getEntitiesWithinAABB(ServerPlayerEntity.class, new AxisAlignedBB(pos).grow(range)); return players; diff --git a/src/main/java/com/simibubi/create/foundation/block/ITE.java b/src/main/java/com/simibubi/create/foundation/block/ITE.java index c6290f434..abc375a1c 100644 --- a/src/main/java/com/simibubi/create/foundation/block/ITE.java +++ b/src/main/java/com/simibubi/create/foundation/block/ITE.java @@ -8,10 +8,9 @@ import com.simibubi.create.foundation.config.AllConfigs; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.DimensionType; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; -import net.minecraft.world.dimension.Dimension; -import net.minecraft.world.dimension.DimensionType; public interface ITE { @@ -61,10 +60,7 @@ public interface ITE { String notAvailable = "Dim N/A"; if (world == null) return notAvailable; - Dimension dimension = world.getDimension(); - if (dimension == null) - return notAvailable; - DimensionType type = dimension.getType(); + DimensionType type = world.getDimension(); if (type == null) return notAvailable; ResourceLocation registryName = type.getRegistryName(); diff --git a/src/main/java/com/simibubi/create/foundation/collision/CollisionDebugger.java b/src/main/java/com/simibubi/create/foundation/collision/CollisionDebugger.java index 0f697c166..9624e84cb 100644 --- a/src/main/java/com/simibubi/create/foundation/collision/CollisionDebugger.java +++ b/src/main/java/com/simibubi/create/foundation/collision/CollisionDebugger.java @@ -15,13 +15,13 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult.Type; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; public class CollisionDebugger { public static AxisAlignedBB AABB = new AxisAlignedBB(BlockPos.ZERO.up(10)); public static OrientedBB OBB = new OrientedBB(new AxisAlignedBB(BlockPos.ZERO)); - public static Vec3d motion = Vec3d.ZERO; + public static Vector3d motion = Vector3d.ZERO; static ContinuousSeparationManifold seperation; static double angle = 0; static AABBOutline outline; @@ -71,7 +71,7 @@ public class CollisionDebugger { ms.push(); if (seperation != null) { - Vec3d asSeparationVec = seperation.asSeparationVec(.5f); + Vector3d asSeparationVec = seperation.asSeparationVec(.5f); if (asSeparationVec != null) { outline.getParams() .colored(0x65ff44) @@ -92,7 +92,7 @@ public class CollisionDebugger { public static void tick() { AABB = new AxisAlignedBB(BlockPos.ZERO.up(60)).offset(.5, 0, .5); - motion = Vec3d.ZERO; + motion = Vector3d.ZERO; RayTraceResult mouse = Minecraft.getInstance().objectMouseOver; if (mouse != null && mouse.getType() == Type.BLOCK) { BlockRayTraceResult hit = (BlockRayTraceResult) mouse; @@ -103,8 +103,8 @@ public class CollisionDebugger { .withFaceTexture(seperation == null ? AllSpecialTextures.CHECKERED : null); } - static void showDebugLine(Vec3d relativeStart, Vec3d relativeEnd, int color, String id, int offset) { - Vec3d center = CollisionDebugger.AABB.getCenter() + static void showDebugLine(Vector3d relativeStart, Vector3d relativeEnd, int color, String id, int offset) { + Vector3d center = CollisionDebugger.AABB.getCenter() .add(0, 1 + offset / 16f, 0); CreateClient.outliner.showLine(id + OBBCollider.checkCount, center.add(relativeStart), center.add(relativeEnd)) .colored(color) diff --git a/src/main/java/com/simibubi/create/foundation/collision/ContinuousOBBCollider.java b/src/main/java/com/simibubi/create/foundation/collision/ContinuousOBBCollider.java index b87de83b9..25b5fef39 100644 --- a/src/main/java/com/simibubi/create/foundation/collision/ContinuousOBBCollider.java +++ b/src/main/java/com/simibubi/create/foundation/collision/ContinuousOBBCollider.java @@ -1,21 +1,22 @@ package com.simibubi.create.foundation.collision; +import net.minecraft.util.math.vector.Vector3d; + import static java.lang.Math.abs; import static java.lang.Math.signum; -import net.minecraft.util.math.Vec3d; public class ContinuousOBBCollider extends OBBCollider { - public static ContinuousSeparationManifold separateBBs(Vec3d cA, Vec3d cB, Vec3d eA, Vec3d eB, Matrix3d m, - Vec3d motion) { + public static ContinuousSeparationManifold separateBBs(Vector3d cA, Vector3d cB, Vector3d eA, Vector3d eB, Matrix3d m, + Vector3d motion) { ContinuousSeparationManifold mf = new ContinuousSeparationManifold(); - Vec3d diff = cB.subtract(cA); + Vector3d diff = cB.subtract(cA); m.transpose(); - Vec3d diff2 = m.transform(diff); - Vec3d motion2 = m.transform(motion); + Vector3d diff2 = m.transform(diff); + Vector3d motion2 = m.transform(motion); m.transpose(); double a00 = abs(m.m00); @@ -28,9 +29,9 @@ public class ContinuousOBBCollider extends OBBCollider { double a21 = abs(m.m21); double a22 = abs(m.m22); - Vec3d uB0 = new Vec3d(m.m00, m.m10, m.m20); - Vec3d uB1 = new Vec3d(m.m01, m.m11, m.m21); - Vec3d uB2 = new Vec3d(m.m02, m.m12, m.m22); + Vector3d uB0 = new Vector3d(m.m00, m.m10, m.m20); + Vector3d uB1 = new Vector3d(m.m01, m.m11, m.m21); + Vector3d uB2 = new Vector3d(m.m02, m.m12, m.m22); checkCount = 0; mf.stepSeparationAxis = uB1; @@ -51,7 +52,7 @@ public class ContinuousOBBCollider extends OBBCollider { return null; } - static boolean separate(ContinuousSeparationManifold mf, Vec3d axis, double TL, double rA, double rB, + static boolean separate(ContinuousSeparationManifold mf, Vector3d axis, double TL, double rA, double rB, double projectedMotion) { checkCount++; double distance = abs(TL); @@ -78,36 +79,36 @@ public class ContinuousOBBCollider extends OBBCollider { mf.earliestCollisionExitTime = Math.min(exitTime, mf.earliestCollisionExitTime); } - Vec3d normalizedAxis = axis.normalize(); + Vector3d normalizedAxis = axis.normalize(); boolean isBestSeperation = distance != 0 && -(diff) <= abs(mf.separation); // boolean isBestSeperation = discreteCollision && checkCount == 5; // Debug specific separations double dot = mf.stepSeparationAxis.dotProduct(axis); if (dot != 0 && discreteCollision) { - Vec3d cross = axis.crossProduct(mf.stepSeparationAxis); + Vector3d cross = axis.crossProduct(mf.stepSeparationAxis); double dotSeparation = signum(dot) * TL - (rA + rB); double stepSeparation = -dotSeparation; - Vec3d stepSeparationVec = axis; + Vector3d stepSeparationVec = axis; - if (!cross.equals(Vec3d.ZERO)) { - Vec3d sepVec = normalizedAxis.scale(dotSeparation); - Vec3d axisPlane = axis.crossProduct(cross); - Vec3d stepPlane = mf.stepSeparationAxis.crossProduct(cross); + if (!cross.equals(Vector3d.ZERO)) { + Vector3d sepVec = normalizedAxis.scale(dotSeparation); + Vector3d axisPlane = axis.crossProduct(cross); + Vector3d stepPlane = mf.stepSeparationAxis.crossProduct(cross); stepSeparationVec = sepVec.subtract(axisPlane.scale(sepVec.dotProduct(stepPlane) / axisPlane.dotProduct(stepPlane))); stepSeparation = stepSeparationVec.length(); if (abs(mf.stepSeparation) > abs(stepSeparation) && stepSeparation != 0) { -// CollisionDebugger.showDebugLine(Vec3d.ZERO, sepVec, 0x111155, "stepsep", -16); +// CollisionDebugger.showDebugLine(Vector3d.ZERO, sepVec, 0x111155, "stepsep", -16); mf.stepSeparation = stepSeparation; } } else { if (abs(mf.stepSeparation) > stepSeparation) { mf.stepSeparation = stepSeparation; -// CollisionDebugger.showDebugLine(Vec3d.ZERO, stepSeparationVec, 0xff9999, "axis", -16); +// CollisionDebugger.showDebugLine(Vector3d.ZERO, stepSeparationVec, 0xff9999, "axis", -16); } } @@ -121,10 +122,10 @@ public class ContinuousOBBCollider extends OBBCollider { // Visualize values // if (CollisionDebugger.AABB != null) { -// Vec3d normalizedAxis = axis.normalize(); -// showDebugLine(Vec3d.ZERO, normalizedAxis.scale(projectedMotion), 0x111155, "motion", 5); -// showDebugLine(Vec3d.ZERO, normalizedAxis.scale(TL), 0xbb00bb, "tl", 4); -// showDebugLine(Vec3d.ZERO, normalizedAxis.scale(sTL * rA), 0xff4444, "ra", 3); +// Vector3d normalizedAxis = axis.normalize(); +// showDebugLine(Vector3d.ZERO, normalizedAxis.scale(projectedMotion), 0x111155, "motion", 5); +// showDebugLine(Vector3d.ZERO, normalizedAxis.scale(TL), 0xbb00bb, "tl", 4); +// showDebugLine(Vector3d.ZERO, normalizedAxis.scale(sTL * rA), 0xff4444, "ra", 3); // showDebugLine(normalizedAxis.scale(sTL * rA), // normalizedAxis.scale(sTL * rA - entryTime * projectedMotion), 0x44ff44, "entry", 0); // showDebugLine(normalizedAxis.scale(sTL * rA - entryTime * projectedMotion), @@ -148,7 +149,7 @@ public class ContinuousOBBCollider extends OBBCollider { double earliestCollisionExitTime = Double.MAX_VALUE; boolean isDiscreteCollision = true; - Vec3d stepSeparationAxis; + Vector3d stepSeparationAxis; double stepSeparation; public double getTimeOfImpact() { @@ -163,13 +164,13 @@ public class ContinuousOBBCollider extends OBBCollider { return true; } - public Vec3d getAllowedMotion(Vec3d motion) { + public Vector3d getAllowedMotion(Vector3d motion) { double length = motion.length(); return motion.normalize() .scale(getTimeOfImpact() * length); } - public Vec3d asSeparationVec(double obbStepHeight) { + public Vector3d asSeparationVec(double obbStepHeight) { if (isDiscreteCollision) { if (stepSeparation <= obbStepHeight) return createSeparationVec(stepSeparation, stepSeparationAxis); @@ -178,11 +179,11 @@ public class ContinuousOBBCollider extends OBBCollider { double t = getTimeOfImpact(); if (t == UNDEFINED) return null; - return Vec3d.ZERO; + return Vector3d.ZERO; } @Override - public Vec3d asSeparationVec() { + public Vector3d asSeparationVec() { return asSeparationVec(0); } diff --git a/src/main/java/com/simibubi/create/foundation/collision/OBBCollider.java b/src/main/java/com/simibubi/create/foundation/collision/OBBCollider.java index daf13ab6b..f5c09f232 100644 --- a/src/main/java/com/simibubi/create/foundation/collision/OBBCollider.java +++ b/src/main/java/com/simibubi/create/foundation/collision/OBBCollider.java @@ -1,21 +1,23 @@ package com.simibubi.create.foundation.collision; +import net.minecraft.util.math.vector.Vector3d; + import static com.simibubi.create.foundation.collision.CollisionDebugger.showDebugLine; import static java.lang.Math.abs; import static java.lang.Math.signum; -import net.minecraft.util.math.Vec3d; + public class OBBCollider { - static final Vec3d uA0 = new Vec3d(1, 0, 0); - static final Vec3d uA1 = new Vec3d(0, 1, 0); - static final Vec3d uA2 = new Vec3d(0, 0, 1); + static final Vector3d uA0 = new Vector3d(1, 0, 0); + static final Vector3d uA1 = new Vector3d(0, 1, 0); + static final Vector3d uA2 = new Vector3d(0, 0, 1); - public static Vec3d separateBBs(Vec3d cA, Vec3d cB, Vec3d eA, Vec3d eB, Matrix3d m) { + public static Vector3d separateBBs(Vector3d cA, Vector3d cB, Vector3d eA, Vector3d eB, Matrix3d m) { SeparationManifold mf = new SeparationManifold(); - Vec3d t = cB.subtract(cA); + Vector3d t = cB.subtract(cA); double a00 = abs(m.m00); double a01 = abs(m.m01); @@ -27,9 +29,9 @@ public class OBBCollider { double a21 = abs(m.m21); double a22 = abs(m.m22); - Vec3d uB0 = new Vec3d(m.m00, m.m10, m.m20); - Vec3d uB1 = new Vec3d(m.m01, m.m11, m.m21); - Vec3d uB2 = new Vec3d(m.m02, m.m12, m.m22); + Vector3d uB0 = new Vector3d(m.m00, m.m10, m.m20); + Vector3d uB1 = new Vector3d(m.m01, m.m11, m.m21); + Vector3d uB2 = new Vector3d(m.m02, m.m12, m.m22); checkCount = 0; @@ -53,7 +55,7 @@ public class OBBCollider { static int checkCount = 0; - static boolean isSeparatedAlong(SeparationManifold mf, Vec3d axis, double TL, double rA, double rB) { + static boolean isSeparatedAlong(SeparationManifold mf, Vector3d axis, double TL, double rA, double rB) { checkCount++; double distance = abs(TL); double diff = distance - (rA + rB); @@ -71,9 +73,9 @@ public class OBBCollider { // Visualize values if (CollisionDebugger.AABB != null) { - Vec3d normalizedAxis = axis.normalize(); - showDebugLine(Vec3d.ZERO, normalizedAxis.scale(TL), 0xbb00bb, "tl", 4); - showDebugLine(Vec3d.ZERO, normalizedAxis.scale(sTL * rA), 0xff4444, "ra", 3); + Vector3d normalizedAxis = axis.normalize(); + showDebugLine(Vector3d.ZERO, normalizedAxis.scale(TL), 0xbb00bb, "tl", 4); + showDebugLine(Vector3d.ZERO, normalizedAxis.scale(sTL * rA), 0xff4444, "ra", 3); showDebugLine(normalizedAxis.scale(sTL * (distance - rB)), normalizedAxis.scale(TL), 0x4444ff, "rb", 2); showDebugLine(normalizedAxis.scale(sTL * (distance - rB)), normalizedAxis.scale(sTL * (distance - rB) + value), 0xff9966, "separation", 1); @@ -85,21 +87,21 @@ public class OBBCollider { } static class SeparationManifold { - Vec3d axis; + Vector3d axis; double separation; public SeparationManifold() { - axis = Vec3d.ZERO; + axis = Vector3d.ZERO; separation = Double.MAX_VALUE; } - public Vec3d asSeparationVec() { + public Vector3d asSeparationVec() { double sep = separation; - Vec3d axis = this.axis; + Vector3d axis = this.axis; return createSeparationVec(sep, axis); } - protected Vec3d createSeparationVec(double sep, Vec3d axis) { + protected Vector3d createSeparationVec(double sep, Vector3d axis) { return axis.normalize() .scale(signum(sep) * (abs(sep) + 1E-4)); } diff --git a/src/main/java/com/simibubi/create/foundation/collision/OrientedBB.java b/src/main/java/com/simibubi/create/foundation/collision/OrientedBB.java index 8b7c75225..09a2d4579 100644 --- a/src/main/java/com/simibubi/create/foundation/collision/OrientedBB.java +++ b/src/main/java/com/simibubi/create/foundation/collision/OrientedBB.java @@ -3,12 +3,12 @@ package com.simibubi.create.foundation.collision; import com.simibubi.create.foundation.collision.ContinuousOBBCollider.ContinuousSeparationManifold; import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; public class OrientedBB { - Vec3d center; - Vec3d extents; + Vector3d center; + Vector3d extents; Matrix3d rotation; public OrientedBB(AxisAlignedBB bb) { @@ -16,10 +16,10 @@ public class OrientedBB { } public OrientedBB() { - this(Vec3d.ZERO, Vec3d.ZERO, new Matrix3d().asIdentity()); + this(Vector3d.ZERO, Vector3d.ZERO, new Matrix3d().asIdentity()); } - public OrientedBB(Vec3d center, Vec3d extents, Matrix3d rotation) { + public OrientedBB(Vector3d center, Vector3d extents, Matrix3d rotation) { this.setCenter(center); this.extents = extents; this.setRotation(rotation); @@ -29,19 +29,19 @@ public class OrientedBB { return new OrientedBB(center, extents, rotation); } - public Vec3d intersect(AxisAlignedBB bb) { - Vec3d extentsA = extentsFromBB(bb); - Vec3d intersects = OBBCollider.separateBBs(bb.getCenter(), center, extentsA, extents, rotation); + public Vector3d intersect(AxisAlignedBB bb) { + Vector3d extentsA = extentsFromBB(bb); + Vector3d intersects = OBBCollider.separateBBs(bb.getCenter(), center, extentsA, extents, rotation); return intersects; } - public ContinuousSeparationManifold intersect(AxisAlignedBB bb, Vec3d motion) { - Vec3d extentsA = extentsFromBB(bb); + public ContinuousSeparationManifold intersect(AxisAlignedBB bb, Vector3d motion) { + Vector3d extentsA = extentsFromBB(bb); return ContinuousOBBCollider.separateBBs(bb.getCenter(), center, extentsA, extents, rotation, motion); } - private static Vec3d extentsFromBB(AxisAlignedBB bb) { - return new Vec3d(bb.getXSize() / 2, bb.getYSize() / 2, bb.getZSize() / 2); + private static Vector3d extentsFromBB(AxisAlignedBB bb) { + return new Vector3d(bb.getXSize() / 2, bb.getYSize() / 2, bb.getZSize() / 2); } public Matrix3d getRotation() { @@ -52,15 +52,15 @@ public class OrientedBB { this.rotation = rotation; } - public Vec3d getCenter() { + public Vector3d getCenter() { return center; } - public void setCenter(Vec3d center) { + public void setCenter(Vector3d center) { this.center = center; } - public void move(Vec3d offset) { + public void move(Vector3d offset) { setCenter(getCenter().add(offset)); } diff --git a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java index 5ed72ec0e..de27fd248 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java @@ -6,6 +6,7 @@ import java.util.List; import javax.annotation.Nullable; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget; @@ -119,20 +120,20 @@ public abstract class AbstractSimiContainerScreen extends C return false; } - protected abstract void renderWindow(int mouseX, int mouseY, float partialTicks); + protected abstract void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks); @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { } - protected void renderWindowForeground(int mouseX, int mouseY, float partialTicks) { - renderHoveredToolTip(mouseX, mouseY); + protected void renderWindowForeground(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { + renderHoveredToolTip(matrixStack, mouseX, mouseY); for (Widget widget : widgets) { if (!widget.isHovered()) continue; if (widget instanceof AbstractSimiWidget && !((AbstractSimiWidget) widget).getToolTip().isEmpty()) { - renderTooltip(((AbstractSimiWidget) widget).getToolTip(), mouseX, mouseY); + renderTooltip(matrixStack, ((AbstractSimiWidget) widget).getToolTip(), mouseX, mouseY); } } } diff --git a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java index 1ec2a4129..2b229a5a6 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java @@ -3,6 +3,7 @@ package com.simibubi.create.foundation.gui; import java.util.ArrayList; import java.util.List; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget; import net.minecraft.client.gui.screen.Screen; @@ -31,14 +32,14 @@ public abstract class AbstractSimiScreen extends Screen { } @Override - public void render(int mouseX, int mouseY, float partialTicks) { - renderBackground(); - renderWindow(mouseX, mouseY, partialTicks); + public void render(MatrixStack ms, int mouseX, int mouseY, float partialTicks) { + renderBackground(ms); + renderWindow(ms, mouseX, mouseY, partialTicks); for (Widget widget : widgets) - widget.render(mouseX, mouseY, partialTicks); - renderWindowForeground(mouseX, mouseY, partialTicks); + widget.render(ms, mouseX, mouseY, partialTicks); + renderWindowForeground(ms, mouseX, mouseY, partialTicks); for (Widget widget : widgets) - widget.renderToolTip(mouseX, mouseY); + widget.renderToolTip(ms, mouseX, mouseY); } @Override @@ -100,15 +101,15 @@ public abstract class AbstractSimiScreen extends Screen { return false; } - protected abstract void renderWindow(int mouseX, int mouseY, float partialTicks); + protected abstract void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks); - protected void renderWindowForeground(int mouseX, int mouseY, float partialTicks) { + protected void renderWindowForeground(MatrixStack ms, int mouseX, int mouseY, float partialTicks) { for (Widget widget : widgets) { if (!widget.isHovered()) continue; if (widget instanceof AbstractSimiWidget && !((AbstractSimiWidget) widget).getToolTip().isEmpty()) { - renderTooltip(((AbstractSimiWidget) widget).getToolTip(), mouseX, mouseY); + renderTooltip(ms, ((AbstractSimiWidget) widget).getToolTip(), mouseX, mouseY); } } } diff --git a/src/main/java/com/simibubi/create/foundation/gui/widgets/AbstractSimiWidget.java b/src/main/java/com/simibubi/create/foundation/gui/widgets/AbstractSimiWidget.java index 31b559037..ada29fae0 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widgets/AbstractSimiWidget.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widgets/AbstractSimiWidget.java @@ -3,23 +3,25 @@ package com.simibubi.create.foundation.gui.widgets; import java.util.LinkedList; import java.util.List; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.client.gui.widget.Widget; +import net.minecraft.util.text.ITextComponent; public abstract class AbstractSimiWidget extends Widget { - protected List toolTip; + protected List toolTip; public AbstractSimiWidget(int xIn, int yIn, int widthIn, int heightIn) { - super(xIn, yIn, widthIn, heightIn, ""); + super(xIn, yIn, widthIn, heightIn, ITextComponent.of("")); toolTip = new LinkedList<>(); } - public List getToolTip() { + public List getToolTip() { return toolTip; } @Override - public void renderButton(int p_renderButton_1_, int p_renderButton_2_, float p_renderButton_3_) { + public void renderButton(MatrixStack matrixStack, int p_renderButton_1_, int p_renderButton_2_, float p_renderButton_3_) { } } diff --git a/src/main/java/com/simibubi/create/foundation/gui/widgets/IconButton.java b/src/main/java/com/simibubi/create/foundation/gui/widgets/IconButton.java index c06bafa5d..eed3be1ed 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widgets/IconButton.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widgets/IconButton.java @@ -1,8 +1,10 @@ package com.simibubi.create.foundation.gui.widgets; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.gui.AllIcons; +import net.minecraft.util.text.ITextComponent; public class IconButton extends AbstractSimiWidget { @@ -15,17 +17,17 @@ public class IconButton extends AbstractSimiWidget { } @Override - public void renderButton(int mouseX, int mouseY, float partialTicks) { + public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { if (this.visible) { - this.isHovered = + this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height; AllGuiTextures button = (pressed || !active) ? button = AllGuiTextures.BUTTON_DOWN - : (isHovered) ? AllGuiTextures.BUTTON_HOVER : AllGuiTextures.BUTTON; + : (hovered) ? AllGuiTextures.BUTTON_HOVER : AllGuiTextures.BUTTON; RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); AllGuiTextures.BUTTON.bind(); - drawTexture(x, y, button.startX, button.startY, button.width, button.height); + drawTexture(matrixStack, x, y, button.startX, button.startY, button.width, button.height); icon.draw(this, x + 1, y + 1); } } @@ -42,7 +44,7 @@ public class IconButton extends AbstractSimiWidget { this.pressed = false; } - public void setToolTip(String text) { + public void setToolTip(ITextComponent text) { toolTip.clear(); toolTip.add(text); } diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/SyncedTileEntity.java b/src/main/java/com/simibubi/create/foundation/tileEntity/SyncedTileEntity.java index be1c6b74d..beda6786c 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/SyncedTileEntity.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/SyncedTileEntity.java @@ -1,11 +1,17 @@ package com.simibubi.create.foundation.tileEntity; +import mcp.MethodsReturnNonnullByDefault; +import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.SUpdateTileEntityPacket; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; +import javax.annotation.ParametersAreNonnullByDefault; + +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault public abstract class SyncedTileEntity extends TileEntity { public SyncedTileEntity(TileEntityType tileEntityTypeIn) { @@ -23,16 +29,18 @@ public abstract class SyncedTileEntity extends TileEntity { } @Override - public void handleUpdateTag(CompoundNBT tag) { - read(tag); + public void handleUpdateTag(BlockState state, CompoundNBT tag) { + fromTag(state, tag); } public void sendData() { - world.notifyBlockUpdate(getPos(), getBlockState(), getBlockState(), 2 | 4 | 16); + if (world != null) + world.notifyBlockUpdate(getPos(), getBlockState(), getBlockState(), 2 | 4 | 16); } public void causeBlockUpdate() { - world.notifyBlockUpdate(getPos(), getBlockState(), getBlockState(), 1); + if (world != null) + world.notifyBlockUpdate(getPos(), getBlockState(), getBlockState(), 1); } @Override @@ -42,12 +50,12 @@ public abstract class SyncedTileEntity extends TileEntity { @Override public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) { - readClientUpdate(pkt.getNbtCompound()); + readClientUpdate(getBlockState(), pkt.getNbtCompound()); } // Special handling for client update packets - public void readClientUpdate(CompoundNBT tag) { - read(tag); + public void readClientUpdate(BlockState state, CompoundNBT tag) { + fromTag(state, tag); } // Special handling for client update packets diff --git a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java index d653d650a..3128571bc 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java @@ -2,7 +2,10 @@ package com.simibubi.create.foundation.utility; import java.util.function.Consumer; +import net.minecraft.client.world.ClientWorld; import net.minecraft.item.Items; +import net.minecraft.state.Property; +import net.minecraft.tags.BlockTags; import org.apache.commons.lang3.mutable.MutableInt; import net.minecraft.block.Block; @@ -30,7 +33,10 @@ import net.minecraftforge.api.distmarker.OnlyIn; public class BlockHelper { @OnlyIn(Dist.CLIENT) - public static void addReducedDestroyEffects(BlockState state, World world, BlockPos pos, ParticleManager manager) { + public static void addReducedDestroyEffects(BlockState state, World worldIn, BlockPos pos, ParticleManager manager) { + if (!(worldIn instanceof ClientWorld)) + return; + ClientWorld world = (ClientWorld) worldIn; VoxelShape voxelshape = state.getShape(world, pos); MutableInt amtBoxes = new MutableInt(0); voxelshape.forEachBox((x1, y1, z1, x2, y2, z2) -> amtBoxes.increment()); @@ -67,25 +73,25 @@ public class BlockHelper { } public static BlockState setZeroAge(BlockState blockState) { - if (blockState.has(BlockStateProperties.AGE_0_1)) + if (hasBlockStateProperty(blockState, BlockStateProperties.AGE_0_1)) return blockState.with(BlockStateProperties.AGE_0_1, 0); - if (blockState.has(BlockStateProperties.AGE_0_2)) + if (hasBlockStateProperty(blockState, BlockStateProperties.AGE_0_2)) return blockState.with(BlockStateProperties.AGE_0_2, 0); - if (blockState.has(BlockStateProperties.AGE_0_3)) + if (hasBlockStateProperty(blockState, BlockStateProperties.AGE_0_3)) return blockState.with(BlockStateProperties.AGE_0_3, 0); - if (blockState.has(BlockStateProperties.AGE_0_5)) + if (hasBlockStateProperty(blockState, BlockStateProperties.AGE_0_5)) return blockState.with(BlockStateProperties.AGE_0_5, 0); - if (blockState.has(BlockStateProperties.AGE_0_7)) + if (hasBlockStateProperty(blockState, BlockStateProperties.AGE_0_7)) return blockState.with(BlockStateProperties.AGE_0_7, 0); - if (blockState.has(BlockStateProperties.AGE_0_15)) + if (hasBlockStateProperty(blockState, BlockStateProperties.AGE_0_15)) return blockState.with(BlockStateProperties.AGE_0_15, 0); - if (blockState.has(BlockStateProperties.AGE_0_25)) + if (hasBlockStateProperty(blockState, BlockStateProperties.AGE_0_25)) return blockState.with(BlockStateProperties.AGE_0_25, 0); - if (blockState.has(BlockStateProperties.HONEY_LEVEL)) + if (hasBlockStateProperty(blockState, BlockStateProperties.HONEY_LEVEL)) return blockState.with(BlockStateProperties.HONEY_LEVEL, 0); - if (blockState.has(BlockStateProperties.HATCH_0_2)) + if (hasBlockStateProperty(blockState, BlockStateProperties.HATCH_0_2)) return blockState.with(BlockStateProperties.HATCH_0_2, 0); - if (blockState.has(BlockStateProperties.STAGE_0_1)) + if (hasBlockStateProperty(blockState, BlockStateProperties.STAGE_0_1)) return blockState.with(BlockStateProperties.STAGE_0_1, 0); return blockState; } @@ -95,15 +101,15 @@ public class BlockHelper { Item required = getRequiredItem(block).getItem(); boolean needsTwo = - block.has(BlockStateProperties.SLAB_TYPE) && block.get(BlockStateProperties.SLAB_TYPE) == SlabType.DOUBLE; + hasBlockStateProperty(block, BlockStateProperties.SLAB_TYPE) && block.get(BlockStateProperties.SLAB_TYPE) == SlabType.DOUBLE; if (needsTwo) amount *= 2; - if (block.has(BlockStateProperties.EGGS_1_4)) + if (hasBlockStateProperty(block, BlockStateProperties.EGGS_1_4)) amount *= block.get(BlockStateProperties.EGGS_1_4); - if (block.has(BlockStateProperties.PICKLES_1_4)) + if (hasBlockStateProperty(block, BlockStateProperties.PICKLES_1_4)) amount *= block.get(BlockStateProperties.PICKLES_1_4); { @@ -158,24 +164,24 @@ public class BlockHelper { public static void destroyBlock(World world, BlockPos pos, float effectChance, Consumer droppedItemCallback) { - FluidState ifluidstate = world.getFluidState(pos); + FluidState FluidState = world.getFluidState(pos); BlockState state = world.getBlockState(pos); if (world.rand.nextFloat() < effectChance) world.playEvent(2001, pos, Block.getStateId(state)); TileEntity tileentity = state.hasTileEntity() ? world.getTileEntity(pos) : null; if (world.getGameRules() - .getBoolean(GameRules.DO_TILE_DROPS) && !world.restoringBlockSnapshots) { + .getBoolean(GameRules.DO_TILE_DROPS) && !world.restoringBlockSnapshots && world instanceof ServerWorld) { for (ItemStack itemStack : Block.getDrops(state, (ServerWorld) world, pos, tileentity)) droppedItemCallback.accept(itemStack); - state.spawnAdditionalDrops(world, pos, ItemStack.EMPTY); + state.spawnAdditionalDrops((ServerWorld) world, pos, ItemStack.EMPTY); } - world.setBlockState(pos, ifluidstate.getBlockState()); + world.setBlockState(pos, FluidState.getBlockState()); } public static boolean isSolidWall(IBlockReader reader, BlockPos fromPos, Direction toDirection) { - return Block.hasSolidSide(reader.getBlockState(fromPos.offset(toDirection)), reader, + return hasBlockSolidSide(reader.getBlockState(fromPos.offset(toDirection)), reader, fromPos.offset(toDirection), toDirection.getOpposite()); } @@ -183,4 +189,11 @@ public class BlockHelper { return reader.getBlockState(pos).getCollisionShape(reader, pos).isEmpty(); } + public static boolean hasBlockStateProperty(BlockState state, Property p) { + return state.method_28500(p).isPresent(); + } + + public static boolean hasBlockSolidSide(BlockState p_220056_0_, IBlockReader p_220056_1_, BlockPos p_220056_2_, Direction p_220056_3_) { + return !p_220056_0_.isIn(BlockTags.LEAVES) && Block.doesSideFillSquare(p_220056_0_.getCollisionShape(p_220056_1_, p_220056_2_), p_220056_3_); + } } diff --git a/src/main/java/com/simibubi/create/foundation/utility/RaycastHelper.java b/src/main/java/com/simibubi/create/foundation/utility/RaycastHelper.java index 3d30182e7..8b11a0226 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/RaycastHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/RaycastHelper.java @@ -39,16 +39,16 @@ public class RaycastHelper { float f6 = f3 * f4; float f7 = f2 * f4; double d3 = range; - Vector3d vec3d1 = origin.add((double) f6 * d3, (double) f5 * d3, (double) f7 * d3); - return vec3d1; + Vector3d Vector3d1 = origin.add((double) f6 * d3, (double) f5 * d3, (double) f7 * d3); + return Vector3d1; } public static Vector3d getTraceOrigin(PlayerEntity playerIn) { double d0 = playerIn.getX(); double d1 = playerIn.getY() + (double) playerIn.getEyeHeight(); double d2 = playerIn.getZ(); - Vector3d vec3d = new Vector3d(d0, d1, d2); - return vec3d; + Vector3d Vector3d = new Vector3d(d0, d1, d2); + return Vector3d; } public static PredicateTraceResult rayTraceUntil(Vector3d start, Vector3d end, Predicate predicate) { diff --git a/src/main/java/com/simibubi/create/foundation/utility/outliner/Outline.java b/src/main/java/com/simibubi/create/foundation/utility/outliner/Outline.java index 3eb7f42c7..5d7041a9d 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/outliner/Outline.java +++ b/src/main/java/com/simibubi/create/foundation/utility/outliner/Outline.java @@ -33,8 +33,8 @@ public abstract class Outline { public abstract void render(MatrixStack ms, SuperRenderTypeBuffer buffer); - public void renderCuboidLine(MatrixStack ms, SuperRenderTypeBuffer buffer, Vec3d start, Vec3d end) { - Vec3d diff = end.subtract(start); + public void renderCuboidLine(MatrixStack ms, SuperRenderTypeBuffer buffer, Vector3d start, Vector3d end) { + Vector3d diff = end.subtract(start); float hAngle = AngleHelper.deg(MathHelper.atan2(diff.x, diff.z)); float hDistance = (float) diff.mul(1, 0, 1) .length(); @@ -43,11 +43,11 @@ public abstract class Outline { MatrixStacker.of(ms) .translate(start) .rotateY(hAngle).rotateX(vAngle); - renderAACuboidLine(ms, buffer, Vec3d.ZERO, new Vec3d(0, 0, diff.length())); + renderAACuboidLine(ms, buffer, Vector3d.ZERO, new Vector3d(0, 0, diff.length())); ms.pop(); } - public void renderAACuboidLine(MatrixStack ms, SuperRenderTypeBuffer buffer, Vec3d start, Vec3d end) { + public void renderAACuboidLine(MatrixStack ms, SuperRenderTypeBuffer buffer, Vector3d start, Vector3d end) { IVertexBuilder builder = buffer.getBuffer(RenderTypes.getOutlineSolid()); Vector3d diff = end.subtract(start); diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedWorld.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedWorld.java index b198db079..cf049fc81 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedWorld.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedWorld.java @@ -26,7 +26,7 @@ public class WrappedWorld extends World { protected World world; public WrappedWorld(World world) { - super(world.getWorldInfo(), world.getDimension().getType(), (w, d) -> world.getChunkProvider(), + super(world.getWorldInfo(), world.getDimension(), (w, d) -> world.getChunkProvider(), world.getProfiler(), world.isRemote); this.world = world; }