From 55562e5d16b8ae1e6e78154243cab9605d66ac66 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Wed, 28 Jun 2023 01:04:43 +0200 Subject: [PATCH] Found and Replaced - Progress on compilation errors --- .../java/com/simibubi/create/AllBlocks.java | 322 +++++++++--------- .../simibubi/create/AllCreativeModeTabs.java | 1 + .../com/simibubi/create/AllSoundEvents.java | 4 +- .../api/connectivity/ConnectivityHandler.java | 7 +- .../compat/curios/GogglesCurioRenderer.java | 4 +- .../compat/jei/ScreenResourceWrapper.java | 4 +- .../jei/category/ItemDrainCategory.java | 6 +- .../compat/jei/category/SpoutCategory.java | 6 +- .../compat/tconstruct/SpoutCasting.java | 4 +- .../AbstractContraptionEntity.java | 66 ++-- .../contraptions/BlockMovementChecks.java | 3 +- .../content/contraptions/Contraption.java | 96 +++--- .../contraptions/ContraptionCollider.java | 45 ++- .../ContraptionHandlerClient.java | 2 +- .../ContraptionMovementSetting.java | 2 +- .../contraptions/ContraptionWorld.java | 2 +- .../ControlledContraptionEntity.java | 16 +- .../contraptions/MountedFluidStorage.java | 5 +- .../content/contraptions/MountedStorage.java | 8 +- .../contraptions/MountedStorageManager.java | 22 +- .../OrientedContraptionEntity.java | 20 +- .../contraptions/StructureTransform.java | 2 +- .../contraptions/TrainCollisionPacket.java | 4 +- .../contraptions/TranslatingContraption.java | 8 +- .../ContraptionControlsMovingInteraction.java | 18 +- .../plough/PloughMovementBehaviour.java | 2 +- .../psi/PortableStorageInterfaceMovement.java | 2 +- .../roller/RollerMovementBehaviour.java | 11 +- .../actors/roller/TrackPaverV2.java | 8 +- .../contraptions/actors/seat/SeatBlock.java | 6 +- .../contraptions/actors/seat/SeatEntity.java | 4 +- .../ControlsInteractionBehaviour.java | 2 +- .../ControlsMovementBehaviour.java | 4 +- .../bearing/BearingContraption.java | 2 +- .../bearing/MechanicalBearingBlockEntity.java | 3 +- .../contraptions/bearing/SailBlock.java | 3 +- .../behaviour/BellMovementBehaviour.java | 2 +- .../behaviour/DoorMovingInteraction.java | 10 +- .../behaviour/MovementContext.java | 6 +- .../behaviour/MovingInteractionBehaviour.java | 4 +- .../SimpleBlockMovingInteraction.java | 8 +- .../behaviour/TrapdoorMovingInteraction.java | 2 +- .../elevator/ElevatorContraption.java | 2 +- .../elevator/ElevatorControlsHandler.java | 8 +- .../elevator/ElevatorFloorListPacket.java | 2 +- .../elevator/ElevatorPulleyBlockEntity.java | 3 +- .../elevator/ElevatorTargetFloorPacket.java | 4 +- .../gantry/GantryContraption.java | 2 +- .../gantry/GantryContraptionEntity.java | 22 +- .../contraptions/glue/SuperGlueEntity.java | 6 +- .../contraptions/glue/SuperGlueHandler.java | 6 +- .../glue/SuperGlueRemovalPacket.java | 4 +- .../glue/SuperGlueSelectionHandler.java | 8 +- .../glue/SuperGlueSelectionPacket.java | 8 +- .../minecart/CouplingCreationPacket.java | 2 +- .../minecart/CouplingPhysics.java | 2 +- .../minecart/CouplingRenderer.java | 5 +- .../minecart/MinecartSim2020.java | 2 +- .../capability/MinecartController.java | 2 +- .../mounted/MinecartContraptionItem.java | 5 +- .../mounted/MountedContraption.java | 4 +- .../piston/PistonContraption.java | 4 +- .../contraptions/pulley/PulleyLighter.java | 2 +- .../render/ContraptionInstanceManager.java | 2 +- .../render/ContraptionLighter.java | 4 +- .../render/ContraptionRenderDispatcher.java | 12 +- .../sync/ContraptionInteractionPacket.java | 4 +- .../content/decoration/MetalLadderBlock.java | 5 +- .../decoration/copycat/CopycatPanelBlock.java | 3 +- .../decoration/girder/GirderBlock.java | 3 +- .../girder/GirderPlacementHelper.java | 5 +- .../decoration/palettes/AllPaletteBlocks.java | 4 +- .../palettes/AllPaletteStoneTypes.java | 16 +- .../decoration/placard/PlacardRenderer.java | 4 +- .../SlidingDoorMovementBehaviour.java | 16 +- .../decoration/steamWhistle/WhistleBlock.java | 3 +- .../equipment/armor/BacktankArmorLayer.java | 2 +- .../content/equipment/armor/BacktankUtil.java | 4 +- .../equipment/armor/DivingBootsItem.java | 6 +- .../equipment/armor/DivingHelmetItem.java | 2 +- .../equipment/bell/HauntedBellPulser.java | 4 +- .../equipment/bell/SoulBaseParticle.java | 2 +- .../content/equipment/bell/SoulParticle.java | 2 +- .../BlueprintAssignCompleteRecipePacket.java | 2 +- .../equipment/blueprint/BlueprintEntity.java | 43 ++- .../blueprint/BlueprintRenderer.java | 4 +- .../equipment/clipboard/ClipboardBlock.java | 3 +- .../clipboard/ClipboardEditPacket.java | 2 +- .../equipment/clipboard/ClipboardScreen.java | 4 +- .../ExtendoGripInteractionPacket.java | 4 +- .../extendoGrip/ExtendoGripItem.java | 10 +- .../extendoGrip/ExtendoGripItemRenderer.java | 8 +- .../extendoGrip/ExtendoGripRenderHandler.java | 6 +- .../equipment/goggles/GogglesModel.java | 10 +- .../BuiltinPotatoProjectileTypes.java | 12 +- .../PotatoCannonItemRenderer.java | 8 +- .../potatoCannon/PotatoProjectileEntity.java | 14 +- .../PotatoProjectileRenderer.java | 4 +- .../sandPaper/SandPaperItemRenderer.java | 16 +- .../symmetryWand/SymmetryHandler.java | 8 +- .../symmetryWand/SymmetryWandItem.java | 11 +- .../SymmetryWandItemRenderer.java | 4 +- .../toolbox/ToolboxDisposeAllPacket.java | 2 +- .../equipment/toolbox/ToolboxEquipPacket.java | 2 +- .../equipment/toolbox/ToolboxHandler.java | 4 +- .../toolbox/ToolboxHandlerClient.java | 11 +- .../equipment/toolbox/ToolboxMenu.java | 4 +- .../equipment/wrench/WrenchItemRenderer.java | 4 +- .../zapper/ShootableGadgetRenderHandler.java | 6 +- .../zapper/ZapperInteractionHandler.java | 12 +- .../equipment/zapper/ZapperItemRenderer.java | 8 +- .../zapper/terrainzapper/DynamicBrush.java | 9 +- .../zapper/terrainzapper/TerrainTools.java | 2 +- .../WorldshaperItemRenderer.java | 4 +- .../WorldshaperRenderHandler.java | 4 +- .../create/content/fluids/FlowSource.java | 4 +- .../content/fluids/FluidPropagator.java | 7 +- .../create/content/fluids/OpenEndedPipe.java | 6 +- .../content/fluids/drain/ItemDrainBlock.java | 6 +- .../fluids/drain/ItemDrainBlockEntity.java | 4 +- .../fluids/drain/ItemDrainRenderer.java | 4 +- .../hosePulley/HosePulleyBlockEntity.java | 9 +- .../fluids/particle/BasinFluidParticle.java | 2 +- .../content/fluids/pump/PumpBlockEntity.java | 4 +- .../fluids/spout/SpoutBlockEntity.java | 6 +- .../content/fluids/tank/FluidTankBlock.java | 4 +- .../fluids/tank/FluidTankBlockEntity.java | 6 +- .../content/fluids/tank/FluidTankItem.java | 3 +- .../transfer/FluidFillingBehaviour.java | 16 +- .../fluids/transfer/GenericItemEmptying.java | 6 +- .../fluids/transfer/GenericItemFilling.java | 8 +- .../base/BlockBreakingKineticBlockEntity.java | 3 +- .../content/kinetics/belt/BeltBlock.java | 4 +- .../kinetics/belt/BeltBlockEntity.java | 4 +- .../content/kinetics/belt/BeltHelper.java | 4 +- .../content/kinetics/belt/BeltRenderer.java | 4 +- .../content/kinetics/belt/BeltSlicer.java | 7 +- .../behaviour/DirectBeltInputBehaviour.java | 4 +- .../belt/item/BeltConnectorHandler.java | 3 +- .../kinetics/belt/item/BeltConnectorItem.java | 10 +- .../crafter/MechanicalCrafterBlock.java | 4 +- .../crafter/MechanicalCrafterRenderer.java | 8 +- .../kinetics/crusher/CrushingWheelBlock.java | 5 +- .../crusher/CrushingWheelControllerBlock.java | 2 +- .../CrushingWheelControllerBlockEntity.java | 4 +- .../deployer/DeployerActorInstance.java | 2 +- .../kinetics/deployer/DeployerBlock.java | 3 +- .../deployer/DeployerBlockEntity.java | 2 +- .../kinetics/deployer/DeployerFakePlayer.java | 4 +- .../kinetics/deployer/DeployerHandler.java | 9 +- .../deployer/DeployerMovementBehaviour.java | 3 +- .../kinetics/deployer/DeployerRenderer.java | 10 +- .../content/kinetics/drill/DrillBlock.java | 3 +- .../content/kinetics/fan/AirFlowParticle.java | 2 +- .../content/kinetics/fan/FanProcessing.java | 10 +- .../mechanicalArm/ArmInteractionPoint.java | 4 +- .../mechanicalArm/ArmPlacementPacket.java | 2 +- .../kinetics/mechanicalArm/ArmRenderer.java | 4 +- .../kinetics/millstone/MillstoneBlock.java | 6 +- .../mixer/MechanicalMixerBlockEntity.java | 3 +- .../kinetics/press/PressingBehaviour.java | 4 +- .../create/content/kinetics/saw/SawBlock.java | 7 +- .../content/kinetics/saw/SawBlockEntity.java | 4 +- .../content/kinetics/saw/SawRenderer.java | 4 +- .../simpleRelays/CogwheelBlockItem.java | 15 +- .../speedController/SpeedControllerBlock.java | 3 +- .../steamEngine/SteamEngineBlock.java | 2 +- .../steamEngine/SteamJetParticle.java | 2 +- .../kinetics/turntable/TurntableBlock.java | 2 +- .../kinetics/turntable/TurntableHandler.java | 2 +- .../waterwheel/LargeWaterWheelBlock.java | 6 +- .../content/legacy/ChromaticCompoundItem.java | 4 +- .../legacy/NoGravMagicalDohickyItem.java | 2 +- .../logistics/chute/AbstractChuteBlock.java | 9 +- .../logistics/chute/ChuteBlockEntity.java | 6 +- .../content/logistics/chute/ChuteItem.java | 3 +- .../logistics/chute/ChuteRenderer.java | 4 +- .../chute/SmartChuteBlockEntity.java | 3 +- .../crate/CreativeCrateBlockEntity.java | 4 +- .../logistics/depot/DepotBlockEntity.java | 4 +- .../logistics/depot/DepotRenderer.java | 5 +- .../content/logistics/depot/EjectorBlock.java | 4 +- .../logistics/depot/EjectorElytraPacket.java | 2 +- .../depot/EjectorPlacementPacket.java | 2 +- .../logistics/depot/EjectorRenderer.java | 4 +- .../depot/SharedDepotBlockMethods.java | 2 +- .../logistics/filter/ItemAttribute.java | 4 +- .../attribute/FluidContentsAttribute.java | 4 +- .../funnel/FunnelMovementBehaviour.java | 2 +- .../tunnel/BeltTunnelBlockEntity.java | 4 +- .../tunnel/BrassTunnelBlockEntity.java | 6 +- .../logistics/vault/ItemVaultBlock.java | 4 +- .../logistics/vault/ItemVaultItem.java | 3 +- .../processing/AssemblyOperatorBlockItem.java | 3 +- .../content/processing/basin/BasinBlock.java | 4 +- .../processing/basin/BasinBlockEntity.java | 15 +- .../content/processing/basin/BasinRecipe.java | 7 +- .../processing/basin/BasinRenderer.java | 4 +- .../burner/BlazeBurnerBlockItem.java | 4 +- .../processing/burner/BlazeBurnerHandler.java | 11 +- .../BlazeBurnerInteractionBehaviour.java | 16 +- .../displayLink/DisplayLinkBlockItem.java | 3 +- .../redstone/link/RedstoneLinkBlock.java | 3 +- .../LecternControllerBlockEntity.java | 2 +- .../controller/LecternControllerRenderer.java | 4 +- .../LinkedControllerBindPacket.java | 2 +- .../LinkedControllerClientHandler.java | 4 +- .../LinkedControllerItemRenderer.java | 23 +- .../LinkedControllerPacketBase.java | 2 +- .../smartObserver/SmartObserverBlock.java | 7 +- .../thresholdSwitch/ThresholdSwitchBlock.java | 7 +- .../schematics/SchematicAndQuillItem.java | 2 +- .../schematics/SchematicProcessor.java | 10 +- .../schematics/ServerSchematicLoader.java | 2 +- .../cannon/SchematicannonBlockEntity.java | 4 +- .../cannon/SchematicannonRenderer.java | 4 +- .../client/SchematicAndQuillHandler.java | 10 +- .../client/SchematicTransformation.java | 4 +- .../client/tools/SchematicToolBase.java | 12 +- .../packet/InstantSchematicPacket.java | 2 +- .../packet/SchematicPlacePacket.java | 2 +- .../create/content/trains/CubeParticle.java | 4 +- .../create/content/trains/HonkPacket.java | 2 +- .../create/content/trains/TrainHUD.java | 12 +- .../content/trains/TrainHUDUpdatePacket.java | 2 +- .../content/trains/bogey/BogeyInstance.java | 2 +- .../trains/display/FlapDisplayBlock.java | 3 +- .../trains/entity/ArrivalSoundQueue.java | 14 +- .../content/trains/entity/Carriage.java | 18 +- .../content/trains/entity/CarriageBogey.java | 2 +- .../trains/entity/CarriageContraption.java | 6 +- .../entity/CarriageContraptionEntity.java | 42 +-- .../CarriageContraptionEntityRenderer.java | 8 +- .../entity/CarriageCouplingRenderer.java | 6 +- .../trains/entity/CarriageEntityHandler.java | 4 +- .../trains/entity/CarriageParticles.java | 4 +- .../content/trains/entity/CarriageSounds.java | 14 +- .../trains/entity/CarriageSyncData.java | 6 +- .../create/content/trains/entity/Train.java | 8 +- .../content/trains/entity/TrainIconType.java | 4 +- .../trains/entity/TrainRelocationPacket.java | 4 +- .../trains/graph/TrackNodeLocation.java | 5 +- .../content/trains/schedule/ScheduleItem.java | 10 +- .../ScheduleItemEntityInteraction.java | 4 +- .../condition/TimeOfDayCondition.java | 4 +- .../trains/station/StationBlockEntity.java | 8 +- .../trains/station/TrainEditPacket.java | 2 +- .../trains/track/BezierConnection.java | 4 +- .../track/CurvedTrackDestroyPacket.java | 2 +- .../trains/track/CurvedTrackInteraction.java | 15 +- .../track/CurvedTrackSelectionPacket.java | 8 +- .../content/trains/track/ITrackBlock.java | 2 +- .../content/trains/track/TrackBlock.java | 7 +- .../trains/track/TrackBlockEntity.java | 10 +- .../content/trains/track/TrackBlockItem.java | 3 +- .../trains/track/TrackBlockOutline.java | 4 +- .../content/trains/track/TrackPaver.java | 15 +- .../content/trains/track/TrackPlacement.java | 18 +- .../trains/track/TrackTargetingBehaviour.java | 2 +- .../trains/track/TrackTargetingBlockItem.java | 3 +- .../create/foundation/block/BigOutlines.java | 4 +- .../blockEntity/SmartBlockEntity.java | 7 +- .../behaviour/ValueBoxRenderer.java | 6 +- .../behaviour/ValueBoxTransform.java | 3 +- .../filtering/FilteringBehaviour.java | 4 +- .../filtering/FilteringRenderer.java | 2 +- .../inventory/InvManipulationBehaviour.java | 4 +- .../inventory/TankManipulationBehaviour.java | 4 +- .../foundation/data/BuilderTransformers.java | 11 +- .../create/foundation/data/MetalBarsGen.java | 6 +- .../foundation/data/SharedProperties.java | 8 - .../create/foundation/data/WindowGen.java | 6 +- .../foundation/events/CommonEvents.java | 2 +- .../create/foundation/fluid/FluidHelper.java | 6 +- .../create/foundation/gui/AllGuiTextures.java | 3 +- .../create/foundation/gui/AllIcons.java | 3 +- .../gui/element/GuiGameElement.java | 4 +- .../foundation/item/ItemDescription.java | 7 +- .../item/render/CustomRenderedItemModel.java | 6 +- .../CustomRenderedItemModelRenderer.java | 6 +- .../item/render/PartialItemModelRenderer.java | 6 +- .../EntityContraptionInteractionMixin.java | 10 +- .../BlockEntityConfigurationPacket.java | 2 +- .../foundation/outliner/ItemOutline.java | 4 +- .../foundation/particle/AirParticle.java | 2 +- .../foundation/placement/PlacementOffset.java | 2 +- .../foundation/placement/PoleHelper.java | 4 +- .../foundation/ponder/PonderChapter.java | 4 +- .../create/foundation/ponder/PonderTag.java | 4 +- .../foundation/recipe/RecipeApplier.java | 4 +- .../render/BlockEntityRenderHelper.java | 2 +- .../foundation/render/SuperByteBuffer.java | 2 +- .../foundation/utility/BlockHelper.java | 5 +- .../infrastructure/command/CloneCommand.java | 22 +- .../command/HighlightCommand.java | 4 +- .../gametest/CreateGameTestHelper.java | 7 +- .../ponder/scenes/fluid/DrainScenes.java | 6 +- .../fluid/FluidMovementActorScenes.java | 4 +- .../ponder/scenes/fluid/FluidTankScenes.java | 4 +- .../ponder/scenes/fluid/HosePulleyScenes.java | 7 +- .../ponder/scenes/fluid/PipeScenes.java | 6 +- 301 files changed, 1092 insertions(+), 1156 deletions(-) diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 8906813e0..4879f8b46 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -291,8 +291,8 @@ import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.PistonType; -import net.minecraft.world.level.material.Material; -import net.minecraft.world.level.material.MaterialColor; +import net.minecraft.world.level.material.MapColor; +import net.minecraft.world.level.material.PushReaction; import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.LootTable.Builder; @@ -316,7 +316,7 @@ public class AllBlocks { public static final BlockEntry SCHEMATICANNON = REGISTRATE.block("schematicannon", SchematicannonBlock::new) .initialProperties(() -> Blocks.DISPENSER) - .properties(p -> p.color(MaterialColor.COLOR_GRAY)) + .properties(p -> p.mapColor(MapColor.COLOR_GRAY)) .transform(pickaxeOnly()) .blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov))) .loot((lt, block) -> { @@ -337,7 +337,7 @@ public class AllBlocks { public static final BlockEntry SCHEMATIC_TABLE = REGISTRATE.block("schematic_table", SchematicTableBlock::new) .initialProperties(() -> Blocks.LECTERN) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(axeOrPickaxe()) .blockstate((ctx, prov) -> prov.horizontalBlock(ctx.getEntry(), prov.models() .getExistingFile(ctx.getId()), 0)) @@ -348,7 +348,7 @@ public class AllBlocks { public static final BlockEntry SHAFT = REGISTRATE.block("shaft", ShaftBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.METAL)) + .properties(p -> p.mapColor(MapColor.METAL)) .transform(BlockStressDefaults.setNoImpact()) .transform(pickaxeOnly()) .blockstate(BlockStateGen.axisBlockProvider(false)) @@ -359,7 +359,7 @@ public class AllBlocks { public static final BlockEntry COGWHEEL = REGISTRATE.block("cogwheel", CogWheelBlock::small) .initialProperties(SharedProperties::stone) .properties(p -> p.sound(SoundType.WOOD)) - .properties(p -> p.color(MaterialColor.DIRT)) + .properties(p -> p.mapColor(MapColor.DIRT)) .transform(BlockStressDefaults.setNoImpact()) .transform(axeOrPickaxe()) .blockstate(BlockStateGen.axisBlockProvider(false)) @@ -372,7 +372,7 @@ public class AllBlocks { REGISTRATE.block("large_cogwheel", CogWheelBlock::large) .initialProperties(SharedProperties::stone) .properties(p -> p.sound(SoundType.WOOD)) - .properties(p -> p.color(MaterialColor.DIRT)) + .properties(p -> p.mapColor(MapColor.DIRT)) .transform(axeOrPickaxe()) .transform(BlockStressDefaults.setNoImpact()) .blockstate(BlockStateGen.axisBlockProvider(false)) @@ -383,7 +383,7 @@ public class AllBlocks { public static final BlockEntry ANDESITE_ENCASED_SHAFT = REGISTRATE.block("andesite_encased_shaft", p -> new EncasedShaftBlock(p, AllBlocks.ANDESITE_CASING::get)) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(BuilderTransformers.encasedShaft("andesite", () -> AllSpriteShifts.ANDESITE_CASING)) .transform(EncasingRegistry.addVariantTo(AllBlocks.SHAFT)) .transform(axeOrPickaxe()) @@ -391,7 +391,7 @@ public class AllBlocks { public static final BlockEntry BRASS_ENCASED_SHAFT = REGISTRATE.block("brass_encased_shaft", p -> new EncasedShaftBlock(p, AllBlocks.BRASS_CASING::get)) - .properties(p -> p.color(MaterialColor.TERRACOTTA_BROWN)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN)) .transform(BuilderTransformers.encasedShaft("brass", () -> AllSpriteShifts.BRASS_CASING)) .transform(EncasingRegistry.addVariantTo(AllBlocks.SHAFT)) .transform(axeOrPickaxe()) @@ -399,7 +399,7 @@ public class AllBlocks { public static final BlockEntry ANDESITE_ENCASED_COGWHEEL = REGISTRATE .block("andesite_encased_cogwheel", p -> new EncasedCogwheelBlock(p, false, AllBlocks.ANDESITE_CASING::get)) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(BuilderTransformers.encasedCogwheel("andesite", () -> AllSpriteShifts.ANDESITE_CASING)) .transform(EncasingRegistry.addVariantTo(AllBlocks.COGWHEEL)) .onRegister(CreateRegistrate.connectedTextures(() -> new EncasedCogCTBehaviour(AllSpriteShifts.ANDESITE_CASING, @@ -410,7 +410,7 @@ public class AllBlocks { public static final BlockEntry BRASS_ENCASED_COGWHEEL = REGISTRATE.block("brass_encased_cogwheel", p -> new EncasedCogwheelBlock(p, false, AllBlocks.BRASS_CASING::get)) - .properties(p -> p.color(MaterialColor.TERRACOTTA_BROWN)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN)) .transform(BuilderTransformers.encasedCogwheel("brass", () -> AllSpriteShifts.BRASS_CASING)) .transform(EncasingRegistry.addVariantTo(AllBlocks.COGWHEEL)) .onRegister(CreateRegistrate.connectedTextures(() -> new EncasedCogCTBehaviour(AllSpriteShifts.BRASS_CASING, @@ -422,7 +422,7 @@ public class AllBlocks { public static final BlockEntry ANDESITE_ENCASED_LARGE_COGWHEEL = REGISTRATE .block("andesite_encased_large_cogwheel", p -> new EncasedCogwheelBlock(p, true, AllBlocks.ANDESITE_CASING::get)) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(BuilderTransformers.encasedLargeCogwheel("andesite", () -> AllSpriteShifts.ANDESITE_CASING)) .transform(EncasingRegistry.addVariantTo(AllBlocks.LARGE_COGWHEEL)) .transform(axeOrPickaxe()) @@ -430,7 +430,7 @@ public class AllBlocks { public static final BlockEntry BRASS_ENCASED_LARGE_COGWHEEL = REGISTRATE .block("brass_encased_large_cogwheel", p -> new EncasedCogwheelBlock(p, true, AllBlocks.BRASS_CASING::get)) - .properties(p -> p.color(MaterialColor.TERRACOTTA_BROWN)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN)) .transform(BuilderTransformers.encasedLargeCogwheel("brass", () -> AllSpriteShifts.BRASS_CASING)) .transform(EncasingRegistry.addVariantTo(AllBlocks.LARGE_COGWHEEL)) .transform(axeOrPickaxe()) @@ -439,7 +439,7 @@ public class AllBlocks { public static final BlockEntry GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new) .initialProperties(SharedProperties::stone) .properties(BlockBehaviour.Properties::noOcclusion) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(BlockStressDefaults.setNoImpact()) .transform(axeOrPickaxe()) .onRegister(CreateRegistrate.connectedTextures(() -> new EncasedCTBehaviour(AllSpriteShifts.ANDESITE_CASING))) @@ -453,7 +453,7 @@ public class AllBlocks { public static final BlockEntry CLUTCH = REGISTRATE.block("clutch", ClutchBlock::new) .initialProperties(SharedProperties::stone) .properties(BlockBehaviour.Properties::noOcclusion) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .addLayer(() -> RenderType::cutoutMipped) .transform(BlockStressDefaults.setNoImpact()) .transform(axeOrPickaxe()) @@ -465,7 +465,7 @@ public class AllBlocks { public static final BlockEntry GEARSHIFT = REGISTRATE.block("gearshift", GearshiftBlock::new) .initialProperties(SharedProperties::stone) .properties(BlockBehaviour.Properties::noOcclusion) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .addLayer(() -> RenderType::cutoutMipped) .transform(BlockStressDefaults.setNoImpact()) .transform(axeOrPickaxe()) @@ -478,7 +478,7 @@ public class AllBlocks { REGISTRATE.block("encased_chain_drive", ChainDriveBlock::new) .initialProperties(SharedProperties::stone) .properties(BlockBehaviour.Properties::noOcclusion) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(BlockStressDefaults.setNoImpact()) .transform(axeOrPickaxe()) .blockstate((c, p) -> new ChainDriveGenerator((state, suffix) -> p.models() @@ -491,7 +491,7 @@ public class AllBlocks { REGISTRATE.block("adjustable_chain_gearshift", ChainGearshiftBlock::new) .initialProperties(SharedProperties::stone) .properties(BlockBehaviour.Properties::noOcclusion) - .properties(p -> p.color(MaterialColor.NETHER)) + .properties(p -> p.mapColor(MapColor.NETHER)) .transform(BlockStressDefaults.setNoImpact()) .transform(axeOrPickaxe()) .blockstate((c, p) -> new ChainDriveGenerator((state, suffix) -> { @@ -508,11 +508,10 @@ public class AllBlocks { .register(); public static final BlockEntry BELT = REGISTRATE.block("belt", BeltBlock::new) - .initialProperties(SharedProperties.BELT_MATERIAL, MaterialColor.COLOR_GRAY) + .properties(p -> p.sound(SoundType.WOOL) + .strength(0.8f) + .mapColor(MapColor.COLOR_GRAY)) .addLayer(() -> RenderType::cutoutMipped) - .properties(p -> p.sound(SoundType.WOOL)) - .properties(p -> p.strength(0.8F)) - .properties(p -> p.color(MaterialColor.COLOR_GRAY)) .transform(axeOrPickaxe()) .blockstate(new BeltGenerator()::generate) .transform(BlockStressDefaults.setImpact(0)) @@ -523,7 +522,7 @@ public class AllBlocks { public static final BlockEntry CREATIVE_MOTOR = REGISTRATE.block("creative_motor", CreativeMotorBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.COLOR_PURPLE)) + .properties(p -> p.mapColor(MapColor.COLOR_PURPLE)) .tag(AllBlockTags.SAFE_NBT.tag) .transform(pickaxeOnly()) .blockstate(new CreativeMotorGenerator()::generate) @@ -536,7 +535,7 @@ public class AllBlocks { public static final BlockEntry WATER_WHEEL = REGISTRATE.block("water_wheel", WaterWheelBlock::new) .initialProperties(SharedProperties::wooden) - .properties(p -> p.color(MaterialColor.DIRT)) + .properties(p -> p.mapColor(MapColor.DIRT)) .properties(BlockBehaviour.Properties::noOcclusion) .transform(axeOrPickaxe()) .blockstate( @@ -551,7 +550,7 @@ public class AllBlocks { public static final BlockEntry LARGE_WATER_WHEEL = REGISTRATE.block("large_water_wheel", LargeWaterWheelBlock::new) .initialProperties(SharedProperties::wooden) - .properties(p -> p.color(MaterialColor.DIRT)) + .properties(p -> p.mapColor(MapColor.DIRT)) .properties(BlockBehaviour.Properties::noOcclusion) .transform(axeOrPickaxe()) .blockstate((c, p) -> axisBlock(c, p, @@ -568,7 +567,7 @@ public class AllBlocks { .initialProperties(SharedProperties::wooden) .blockstate((c, p) -> p.getVariantBuilder(c.get()) .forAllStatesExcept(BlockStateGen.mapToAir(p), WaterWheelStructuralBlock.FACING)) - .properties(p -> p.color(MaterialColor.DIRT)) + .properties(p -> p.mapColor(MapColor.DIRT)) .properties(BlockBehaviour.Properties::noOcclusion) .transform(axeOrPickaxe()) .lang("Large Water Wheel") @@ -576,7 +575,7 @@ public class AllBlocks { public static final BlockEntry ENCASED_FAN = REGISTRATE.block("encased_fan", EncasedFanBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .blockstate(BlockStateGen.directionalBlockProvider(true)) .addLayer(() -> RenderType::cutoutMipped) .transform(axeOrPickaxe()) @@ -587,7 +586,7 @@ public class AllBlocks { public static final BlockEntry NOZZLE = REGISTRATE.block("nozzle", NozzleBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY)) + .properties(p -> p.mapColor(MapColor.COLOR_LIGHT_GRAY)) .tag(AllBlockTags.BRITTLE.tag) .transform(axeOrPickaxe()) .blockstate(BlockStateGen.directionalBlockProvider(true)) @@ -598,7 +597,7 @@ public class AllBlocks { public static final BlockEntry TURNTABLE = REGISTRATE.block("turntable", TurntableBlock::new) .initialProperties(SharedProperties::wooden) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(axeOrPickaxe()) .blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.standardModel(c, p))) .transform(BlockStressDefaults.setImpact(4.0)) @@ -607,7 +606,7 @@ public class AllBlocks { public static final BlockEntry HAND_CRANK = REGISTRATE.block("hand_crank", HandCrankBlock::new) .initialProperties(SharedProperties::wooden) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(axeOrPickaxe()) .blockstate(BlockStateGen.directionalBlockProvider(true)) .transform(BlockStressDefaults.setCapacity(8.0)) @@ -620,7 +619,7 @@ public class AllBlocks { public static final BlockEntry CUCKOO_CLOCK = REGISTRATE.block("cuckoo_clock", CuckooClockBlock::regular) - .properties(p -> p.color(MaterialColor.TERRACOTTA_YELLOW)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW)) .transform(axeOrPickaxe()) .transform(BuilderTransformers.cuckooClock()) .onRegister(assignDataBehaviour(new TimeOfDayDisplaySource(), "time_of_day")) @@ -629,7 +628,7 @@ public class AllBlocks { public static final BlockEntry MYSTERIOUS_CUCKOO_CLOCK = REGISTRATE.block("mysterious_cuckoo_clock", CuckooClockBlock::mysterious) - .properties(p -> p.color(MaterialColor.TERRACOTTA_YELLOW)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW)) .transform(axeOrPickaxe()) .transform(BuilderTransformers.cuckooClock()) .lang("Cuckoo Clock") @@ -638,7 +637,7 @@ public class AllBlocks { public static final BlockEntry MILLSTONE = REGISTRATE.block("millstone", MillstoneBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.METAL)) + .properties(p -> p.mapColor(MapColor.METAL)) .transform(pickaxeOnly()) .blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p))) .transform(BlockStressDefaults.setImpact(4.0)) @@ -648,7 +647,7 @@ public class AllBlocks { public static final BlockEntry CRUSHING_WHEEL = REGISTRATE.block("crushing_wheel", CrushingWheelBlock::new) - .properties(p -> p.color(MaterialColor.METAL)) + .properties(p -> p.mapColor(MapColor.METAL)) .initialProperties(SharedProperties::stone) .properties(BlockBehaviour.Properties::noOcclusion) .transform(pickaxeOnly()) @@ -661,11 +660,12 @@ public class AllBlocks { public static final BlockEntry CRUSHING_WHEEL_CONTROLLER = REGISTRATE.block("crushing_wheel_controller", CrushingWheelControllerBlock::new) - .initialProperties(SharedProperties.CRUSHING_WHEEL_CONTROLLER_MATERIAL) - .properties(p -> p.color(MaterialColor.STONE)) - .properties(p -> p.noOcclusion() + .properties(p -> p.mapColor(MapColor.STONE) + .noOcclusion() .noLootTable() - .air()) + .air() + .noCollission() + .pushReaction(PushReaction.BLOCK)) .blockstate((c, p) -> p.getVariantBuilder(c.get()) .forAllStatesExcept(BlockStateGen.mapToAir(p), CrushingWheelControllerBlock.FACING)) .register(); @@ -673,7 +673,7 @@ public class AllBlocks { public static final BlockEntry MECHANICAL_PRESS = REGISTRATE.block("mechanical_press", MechanicalPressBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .properties(BlockBehaviour.Properties::noOcclusion) .transform(axeOrPickaxe()) .blockstate(BlockStateGen.horizontalBlockProvider(true)) @@ -685,7 +685,7 @@ public class AllBlocks { public static final BlockEntry MECHANICAL_MIXER = REGISTRATE.block("mechanical_mixer", MechanicalMixerBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.STONE)) + .properties(p -> p.mapColor(MapColor.STONE)) .properties(BlockBehaviour.Properties::noOcclusion) .transform(axeOrPickaxe()) .blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p))) @@ -697,7 +697,7 @@ public class AllBlocks { public static final BlockEntry BASIN = REGISTRATE.block("basin", BasinBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.COLOR_GRAY)) + .properties(p -> p.mapColor(MapColor.COLOR_GRAY)) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK)) .transform(pickaxeOnly()) .blockstate(new BasinGenerator()::generate) @@ -710,7 +710,7 @@ public class AllBlocks { public static final BlockEntry BLAZE_BURNER = REGISTRATE.block("blaze_burner", BlazeBurnerBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.COLOR_GRAY)) + .properties(p -> p.mapColor(MapColor.COLOR_GRAY)) .properties(p -> p.lightLevel(BlazeBurnerBlock::getLight)) .transform(pickaxeOnly()) .addLayer(() -> RenderType::cutoutMipped) @@ -727,7 +727,7 @@ public class AllBlocks { public static final BlockEntry LIT_BLAZE_BURNER = REGISTRATE.block("lit_blaze_burner", LitBlazeBurnerBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY)) + .properties(p -> p.mapColor(MapColor.COLOR_LIGHT_GRAY)) .properties(p -> p.lightLevel(LitBlazeBurnerBlock::getLight)) .transform(pickaxeOnly()) .addLayer(() -> RenderType::cutoutMipped) @@ -745,7 +745,7 @@ public class AllBlocks { public static final BlockEntry DEPOT = REGISTRATE.block("depot", DepotBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.COLOR_GRAY)) + .properties(p -> p.mapColor(MapColor.COLOR_GRAY)) .transform(axeOrPickaxe()) .blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p))) .onRegister(assignDataBehaviour(new ItemNameDisplaySource(), "combine_item_names")) @@ -756,7 +756,7 @@ public class AllBlocks { public static final BlockEntry WEIGHTED_EJECTOR = REGISTRATE.block("weighted_ejector", EjectorBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.COLOR_GRAY)) + .properties(p -> p.mapColor(MapColor.COLOR_GRAY)) .properties(BlockBehaviour.Properties::noOcclusion) .transform(axeOrPickaxe()) .blockstate((c, p) -> p.horizontalBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p), 180)) @@ -769,7 +769,7 @@ public class AllBlocks { public static final BlockEntry CHUTE = REGISTRATE.block("chute", ChuteBlock::new) .addLayer(() -> RenderType::cutoutMipped) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.COLOR_GRAY)) + .properties(p -> p.mapColor(MapColor.COLOR_GRAY)) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK)) .transform(pickaxeOnly()) .addLayer(() -> RenderType::cutoutMipped) @@ -781,7 +781,7 @@ public class AllBlocks { public static final BlockEntry SMART_CHUTE = REGISTRATE.block("smart_chute", SmartChuteBlock::new) .addLayer(() -> RenderType::cutoutMipped) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.COLOR_GRAY)) + .properties(p -> p.mapColor(MapColor.COLOR_GRAY)) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK)) .properties(p -> p.noOcclusion()) .properties(p -> p.isRedstoneConductor((level, pos, state) -> false)) @@ -793,7 +793,7 @@ public class AllBlocks { public static final BlockEntry SPEEDOMETER = REGISTRATE.block("speedometer", GaugeBlock::speed) .initialProperties(SharedProperties::wooden) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(axeOrPickaxe()) .transform(BlockStressDefaults.setNoImpact()) .blockstate(new GaugeGenerator()::generate) @@ -804,7 +804,7 @@ public class AllBlocks { public static final BlockEntry STRESSOMETER = REGISTRATE.block("stressometer", GaugeBlock::stress) .initialProperties(SharedProperties::wooden) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(axeOrPickaxe()) .transform(BlockStressDefaults.setNoImpact()) .blockstate(new GaugeGenerator()::generate) @@ -843,7 +843,7 @@ public class AllBlocks { public static final BlockEntry ENCASED_FLUID_PIPE = REGISTRATE.block("encased_fluid_pipe", p -> new EncasedPipeBlock(p, AllBlocks.COPPER_CASING::get)) .initialProperties(SharedProperties::copperMetal) - .properties(p -> p.color(MaterialColor.TERRACOTTA_LIGHT_GRAY)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_LIGHT_GRAY)) .properties(BlockBehaviour.Properties::noOcclusion) .transform(axeOrPickaxe()) .blockstate(BlockStateGen.encasedPipe()) @@ -879,7 +879,7 @@ public class AllBlocks { public static final BlockEntry MECHANICAL_PUMP = REGISTRATE.block("mechanical_pump", PumpBlock::new) .initialProperties(SharedProperties::copperMetal) - .properties(p -> p.color(MaterialColor.STONE)) + .properties(p -> p.mapColor(MapColor.STONE)) .transform(pickaxeOnly()) .blockstate(BlockStateGen.directionalBlockProviderIgnoresWaterlogged(true)) .onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new)) @@ -891,7 +891,7 @@ public class AllBlocks { public static final BlockEntry SMART_FLUID_PIPE = REGISTRATE.block("smart_fluid_pipe", SmartFluidPipeBlock::new) .initialProperties(SharedProperties::copperMetal) - .properties(p -> p.color(MaterialColor.TERRACOTTA_YELLOW)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW)) .transform(pickaxeOnly()) .blockstate(new SmartFluidPipeGenerator()::generate) .onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new)) @@ -920,7 +920,7 @@ public class AllBlocks { public static final DyedBlockList DYED_VALVE_HANDLES = new DyedBlockList<>(colour -> { String colourName = colour.getSerializedName(); return REGISTRATE.block(colourName + "_valve_handle", p -> ValveHandleBlock.dyed(p, colour)) - .properties(p -> p.color(colour.getMaterialColor())) + .properties(p -> p.mapColor(colour.getMapColor())) .transform(pickaxeOnly()) .transform(BuilderTransformers.valveHandle(colour)) .recipe((c, p) -> ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, c.get()) @@ -949,7 +949,7 @@ public class AllBlocks { REGISTRATE.block("creative_fluid_tank", FluidTankBlock::creative) .initialProperties(SharedProperties::copperMetal) .properties(BlockBehaviour.Properties::noOcclusion) - .properties(p -> p.color(MaterialColor.COLOR_PURPLE)) + .properties(p -> p.mapColor(MapColor.COLOR_PURPLE)) .transform(pickaxeOnly()) .tag(AllBlockTags.SAFE_NBT.tag) .blockstate(new FluidTankGenerator("creative_")::generate) @@ -996,7 +996,7 @@ public class AllBlocks { public static final BlockEntry PORTABLE_FLUID_INTERFACE = REGISTRATE.block("portable_fluid_interface", PortableStorageInterfaceBlock::forFluids) .initialProperties(SharedProperties::copperMetal) - .properties(p -> p.color(MaterialColor.TERRACOTTA_LIGHT_GRAY)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_LIGHT_GRAY)) .transform(axeOrPickaxe()) .blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.partialBaseModel(c, p))) .onRegister(movementBehaviour(new PortableStorageInterfaceMovement())) @@ -1018,7 +1018,7 @@ public class AllBlocks { public static final BlockEntry STEAM_WHISTLE = REGISTRATE.block("steam_whistle", WhistleBlock::new) .initialProperties(SharedProperties::copperMetal) - .properties(p -> p.color(MaterialColor.GOLD)) + .properties(p -> p.mapColor(MapColor.GOLD)) .transform(pickaxeOnly()) .blockstate(new WhistleGenerator()::generate) .item() @@ -1028,7 +1028,7 @@ public class AllBlocks { public static final BlockEntry STEAM_WHISTLE_EXTENSION = REGISTRATE.block("steam_whistle_extension", WhistleExtenderBlock::new) .initialProperties(SharedProperties::copperMetal) - .properties(p -> p.color(MaterialColor.GOLD)) + .properties(p -> p.mapColor(MapColor.GOLD)) .transform(pickaxeOnly()) .blockstate(BlockStateGen.whistleExtender()) .register(); @@ -1036,7 +1036,7 @@ public class AllBlocks { public static final BlockEntry POWERED_SHAFT = REGISTRATE.block("powered_shaft", PoweredShaftBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.METAL)) + .properties(p -> p.mapColor(MapColor.METAL)) .transform(pickaxeOnly()) .blockstate(BlockStateGen.axisBlockProvider(false)) .loot((lt, block) -> lt.dropOther(block, AllBlocks.SHAFT.get())) @@ -1046,7 +1046,7 @@ public class AllBlocks { public static final BlockEntry MECHANICAL_PISTON = REGISTRATE.block("mechanical_piston", MechanicalPistonBlock::normal) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(axeOrPickaxe()) .transform(BuilderTransformers.mechanicalPiston(PistonType.DEFAULT)) .tag(AllBlockTags.SAFE_NBT.tag) @@ -1054,7 +1054,7 @@ public class AllBlocks { public static final BlockEntry STICKY_MECHANICAL_PISTON = REGISTRATE.block("sticky_mechanical_piston", MechanicalPistonBlock::sticky) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(axeOrPickaxe()) .transform(BuilderTransformers.mechanicalPiston(PistonType.STICKY)) .tag(AllBlockTags.SAFE_NBT.tag) @@ -1064,7 +1064,7 @@ public class AllBlocks { REGISTRATE.block("piston_extension_pole", PistonExtensionPoleBlock::new) .initialProperties(() -> Blocks.PISTON_HEAD) .properties(p -> p.sound(SoundType.SCAFFOLDING)) - .properties(p -> p.color(MaterialColor.DIRT)) + .properties(p -> p.mapColor(MapColor.DIRT)) .transform(axeOrPickaxe()) .blockstate(BlockStateGen.directionalBlockProviderIgnoresWaterlogged(false)) .simpleItem() @@ -1073,7 +1073,7 @@ public class AllBlocks { public static final BlockEntry MECHANICAL_PISTON_HEAD = REGISTRATE.block("mechanical_piston_head", MechanicalPistonHeadBlock::new) .initialProperties(() -> Blocks.PISTON_HEAD) - .properties(p -> p.color(MaterialColor.DIRT)) + .properties(p -> p.mapColor(MapColor.DIRT)) .transform(axeOrPickaxe()) .loot((p, b) -> p.dropOther(b, PISTON_EXTENSION_POLE.get())) .blockstate((c, p) -> BlockStateGen.directionalBlockIgnoresWaterlogged(c, p, state -> p.models() @@ -1084,7 +1084,7 @@ public class AllBlocks { public static final BlockEntry GANTRY_CARRIAGE = REGISTRATE.block("gantry_carriage", GantryCarriageBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .properties(BlockBehaviour.Properties::noOcclusion) .transform(axeOrPickaxe()) .blockstate(BlockStateGen.directionalAxisBlockProvider()) @@ -1095,7 +1095,7 @@ public class AllBlocks { public static final BlockEntry GANTRY_SHAFT = REGISTRATE.block("gantry_shaft", GantryShaftBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.NETHER)) + .properties(p -> p.mapColor(MapColor.NETHER)) .transform(axeOrPickaxe()) .blockstate((c, p) -> p.directionalBlock(c.get(), s -> { boolean isPowered = s.getValue(GantryShaftBlock.POWERED); @@ -1121,7 +1121,7 @@ public class AllBlocks { public static final BlockEntry WINDMILL_BEARING = REGISTRATE.block("windmill_bearing", WindmillBearingBlock::new) .transform(axeOrPickaxe()) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(BuilderTransformers.bearing("windmill", "gearbox")) .transform(BlockStressDefaults.setCapacity(512.0)) .transform(BlockStressDefaults.setGeneratorSpeed(WindmillBearingBlock::getSpeedRange)) @@ -1130,7 +1130,7 @@ public class AllBlocks { public static final BlockEntry MECHANICAL_BEARING = REGISTRATE.block("mechanical_bearing", MechanicalBearingBlock::new) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(axeOrPickaxe()) .transform(BuilderTransformers.bearing("mechanical", "gearbox")) .transform(BlockStressDefaults.setImpact(4.0)) @@ -1140,7 +1140,7 @@ public class AllBlocks { public static final BlockEntry CLOCKWORK_BEARING = REGISTRATE.block("clockwork_bearing", ClockworkBearingBlock::new) - .properties(p -> p.color(MaterialColor.TERRACOTTA_BROWN)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN)) .transform(axeOrPickaxe()) .transform(BuilderTransformers.bearing("clockwork", "brass_gearbox")) .transform(BlockStressDefaults.setImpact(4.0)) @@ -1149,7 +1149,7 @@ public class AllBlocks { public static final BlockEntry ROPE_PULLEY = REGISTRATE.block("rope_pulley", PulleyBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(axeOrPickaxe()) .tag(AllBlockTags.SAFE_NBT.tag) .blockstate(BlockStateGen.horizontalAxisBlockProvider(true)) @@ -1159,10 +1159,10 @@ public class AllBlocks { .register(); public static final BlockEntry ROPE = REGISTRATE.block("rope", PulleyBlock.RopeBlock::new) - .initialProperties(SharedProperties.BELT_MATERIAL, MaterialColor.COLOR_BROWN) + .properties(p -> p.sound(SoundType.WOOL) + .mapColor(MapColor.COLOR_BROWN)) .tag(AllBlockTags.BRITTLE.tag) .tag(BlockTags.CLIMBABLE) - .properties(p -> p.sound(SoundType.WOOL)) .blockstate((c, p) -> p.simpleBlock(c.get(), p.models() .getExistingFile(p.modLoc("block/rope_pulley/" + c.getName())))) .register(); @@ -1179,7 +1179,7 @@ public class AllBlocks { public static final BlockEntry ELEVATOR_PULLEY = REGISTRATE.block("elevator_pulley", ElevatorPulleyBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.TERRACOTTA_BROWN)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN)) .transform(axeOrPickaxe()) .blockstate(BlockStateGen.horizontalBlockProvider(true)) .transform(BlockStressDefaults.setImpact(4.0)) @@ -1190,7 +1190,7 @@ public class AllBlocks { public static final BlockEntry CART_ASSEMBLER = REGISTRATE.block("cart_assembler", CartAssemblerBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.COLOR_GRAY)) + .properties(p -> p.mapColor(MapColor.COLOR_GRAY)) .properties(BlockBehaviour.Properties::noOcclusion) .transform(axeOrPickaxe()) .blockstate(BlockStateGen.cartAssembler()) @@ -1223,7 +1223,7 @@ public class AllBlocks { public static final BlockEntry LINEAR_CHASSIS = REGISTRATE.block("linear_chassis", LinearChassisBlock::new) .initialProperties(SharedProperties::wooden) - .properties(p -> p.color(MaterialColor.TERRACOTTA_BROWN)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN)) .transform(axeOrPickaxe()) .tag(AllBlockTags.SAFE_NBT.tag) .blockstate(BlockStateGen.linearChassis()) @@ -1235,7 +1235,7 @@ public class AllBlocks { public static final BlockEntry SECONDARY_LINEAR_CHASSIS = REGISTRATE.block("secondary_linear_chassis", LinearChassisBlock::new) .initialProperties(SharedProperties::wooden) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(axeOrPickaxe()) .tag(AllBlockTags.SAFE_NBT.tag) .blockstate(BlockStateGen.linearChassis()) @@ -1246,7 +1246,7 @@ public class AllBlocks { public static final BlockEntry RADIAL_CHASSIS = REGISTRATE.block("radial_chassis", RadialChassisBlock::new) .initialProperties(SharedProperties::wooden) - .properties(p -> p.color(MaterialColor.DIRT)) + .properties(p -> p.mapColor(MapColor.DIRT)) .transform(axeOrPickaxe()) .tag(AllBlockTags.SAFE_NBT.tag) .blockstate(BlockStateGen.radialChassis()) @@ -1271,7 +1271,7 @@ public class AllBlocks { public static final BlockEntry CONTRAPTION_CONTROLS = REGISTRATE.block("contraption_controls", ContraptionControlsBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .addLayer(() -> RenderType::cutoutMipped) .transform(axeOrPickaxe()) .blockstate((c, p) -> p.horizontalBlock(c.get(), s -> AssetLookup.partialBaseModel(c, p))) @@ -1283,7 +1283,7 @@ public class AllBlocks { public static final BlockEntry MECHANICAL_DRILL = REGISTRATE.block("mechanical_drill", DrillBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(axeOrPickaxe()) .blockstate(BlockStateGen.directionalBlockProvider(true)) .transform(BlockStressDefaults.setImpact(4.0)) @@ -1296,7 +1296,7 @@ public class AllBlocks { public static final BlockEntry MECHANICAL_SAW = REGISTRATE.block("mechanical_saw", SawBlock::new) .initialProperties(SharedProperties::stone) .addLayer(() -> RenderType::cutoutMipped) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(axeOrPickaxe()) .blockstate(new SawGenerator()::generate) .transform(BlockStressDefaults.setImpact(4.0)) @@ -1309,7 +1309,7 @@ public class AllBlocks { public static final BlockEntry DEPLOYER = REGISTRATE.block("deployer", DeployerBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(axeOrPickaxe()) .blockstate(BlockStateGen.directionalAxisBlockProvider()) .transform(BlockStressDefaults.setImpact(4.0)) @@ -1323,7 +1323,7 @@ public class AllBlocks { public static final BlockEntry PORTABLE_STORAGE_INTERFACE = REGISTRATE.block("portable_storage_interface", PortableStorageInterfaceBlock::forItems) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(axeOrPickaxe()) .blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.partialBaseModel(c, p))) .onRegister(movementBehaviour(new PortableStorageInterfaceMovement())) @@ -1335,7 +1335,7 @@ public class AllBlocks { public static final BlockEntry REDSTONE_CONTACT = REGISTRATE.block("redstone_contact", RedstoneContactBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.COLOR_GRAY)) + .properties(p -> p.mapColor(MapColor.COLOR_GRAY)) .transform(axeOrPickaxe()) .onRegister(movementBehaviour(new ContactMovementBehaviour())) .blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p))) @@ -1347,7 +1347,7 @@ public class AllBlocks { public static final BlockEntry ELEVATOR_CONTACT = REGISTRATE.block("elevator_contact", ElevatorContactBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.TERRACOTTA_YELLOW)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW)) .properties(p -> p.lightLevel(ElevatorContactBlock::getLight)) .transform(axeOrPickaxe()) .blockstate((c, p) -> p.directionalBlock(c.get(), state -> { @@ -1365,7 +1365,7 @@ public class AllBlocks { public static final BlockEntry MECHANICAL_HARVESTER = REGISTRATE.block("mechanical_harvester", HarvesterBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.METAL)) + .properties(p -> p.mapColor(MapColor.METAL)) .transform(axeOrPickaxe()) .onRegister(movementBehaviour(new HarvesterMovementBehaviour())) .blockstate(BlockStateGen.horizontalBlockProvider(true)) @@ -1378,7 +1378,7 @@ public class AllBlocks { public static final BlockEntry MECHANICAL_PLOUGH = REGISTRATE.block("mechanical_plough", PloughBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.COLOR_GRAY)) + .properties(p -> p.mapColor(MapColor.COLOR_GRAY)) .transform(axeOrPickaxe()) .onRegister(movementBehaviour(new PloughMovementBehaviour())) .blockstate(BlockStateGen.horizontalBlockProvider(false)) @@ -1390,7 +1390,7 @@ public class AllBlocks { public static final BlockEntry MECHANICAL_ROLLER = REGISTRATE.block("mechanical_roller", RollerBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.COLOR_GRAY) + .properties(p -> p.mapColor(MapColor.COLOR_GRAY) .noOcclusion()) .transform(axeOrPickaxe()) .onRegister(movementBehaviour(new RollerMovementBehaviour())) @@ -1403,7 +1403,7 @@ public class AllBlocks { public static final BlockEntry SAIL_FRAME = REGISTRATE.block("sail_frame", p -> SailBlock.frame(p)) .initialProperties(SharedProperties::wooden) - .properties(p -> p.color(MaterialColor.DIRT)) + .properties(p -> p.mapColor(MapColor.DIRT)) .properties(p -> p.sound(SoundType.SCAFFOLDING) .noOcclusion()) .transform(axeOnly()) @@ -1417,7 +1417,7 @@ public class AllBlocks { public static final BlockEntry SAIL = REGISTRATE.block("white_sail", p -> SailBlock.withCanvas(p, DyeColor.WHITE)) .initialProperties(SharedProperties::wooden) - .properties(p -> p.color(MaterialColor.SNOW)) + .properties(p -> p.mapColor(MapColor.SNOW)) .properties(p -> p.sound(SoundType.SCAFFOLDING) .noOcclusion()) .transform(axeOnly()) @@ -1435,7 +1435,7 @@ public class AllBlocks { String colourName = colour.getSerializedName(); return REGISTRATE.block(colourName + "_sail", p -> SailBlock.withCanvas(p, colour)) .initialProperties(SharedProperties::wooden) - .properties(p -> p.color(colour.getMaterialColor())) + .properties(p -> p.mapColor(colour.getMapColor())) .properties(p -> p.sound(SoundType.SCAFFOLDING) .noOcclusion()) .transform(axeOnly()) @@ -1448,31 +1448,31 @@ public class AllBlocks { }); public static final BlockEntry ANDESITE_CASING = REGISTRATE.block("andesite_casing", CasingBlock::new) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(BuilderTransformers.casing(() -> AllSpriteShifts.ANDESITE_CASING)) .register(); public static final BlockEntry BRASS_CASING = REGISTRATE.block("brass_casing", CasingBlock::new) - .properties(p -> p.color(MaterialColor.TERRACOTTA_BROWN)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN)) .transform(BuilderTransformers.casing(() -> AllSpriteShifts.BRASS_CASING)) .register(); public static final BlockEntry COPPER_CASING = REGISTRATE.block("copper_casing", CasingBlock::new) - .properties(p -> p.color(MaterialColor.TERRACOTTA_LIGHT_GRAY)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_LIGHT_GRAY)) .properties(p -> p.sound(SoundType.COPPER)) .transform(BuilderTransformers.casing(() -> AllSpriteShifts.COPPER_CASING)) .register(); public static final BlockEntry SHADOW_STEEL_CASING = REGISTRATE.block("shadow_steel_casing", CasingBlock::new) - .properties(p -> p.color(MaterialColor.COLOR_BLACK)) + .properties(p -> p.mapColor(MapColor.COLOR_BLACK)) .transform(BuilderTransformers.casing(() -> AllSpriteShifts.SHADOW_STEEL_CASING)) .lang("Shadow Casing") .register(); public static final BlockEntry REFINED_RADIANCE_CASING = REGISTRATE.block("refined_radiance_casing", CasingBlock::new) - .properties(p -> p.color(MaterialColor.SNOW)) + .properties(p -> p.mapColor(MapColor.SNOW)) .transform(BuilderTransformers.casing(() -> AllSpriteShifts.REFINED_RADIANCE_CASING)) .properties(p -> p.lightLevel($ -> 12)) .lang("Radiant Casing") @@ -1481,7 +1481,7 @@ public class AllBlocks { public static final BlockEntry MECHANICAL_CRAFTER = REGISTRATE.block("mechanical_crafter", MechanicalCrafterBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.TERRACOTTA_YELLOW)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW)) .properties(BlockBehaviour.Properties::noOcclusion) .transform(axeOrPickaxe()) .blockstate(BlockStateGen.horizontalBlockProvider(true)) @@ -1495,7 +1495,7 @@ public class AllBlocks { public static final BlockEntry SEQUENCED_GEARSHIFT = REGISTRATE.block("sequenced_gearshift", SequencedGearshiftBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.TERRACOTTA_BROWN)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN)) .transform(axeOrPickaxe()) .tag(AllBlockTags.SAFE_NBT.tag) .properties(BlockBehaviour.Properties::noOcclusion) @@ -1507,7 +1507,7 @@ public class AllBlocks { public static final BlockEntry FLYWHEEL = REGISTRATE.block("flywheel", FlywheelBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.TERRACOTTA_YELLOW)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW)) .properties(BlockBehaviour.Properties::noOcclusion) .transform(axeOrPickaxe()) .transform(BlockStressDefaults.setNoImpact()) @@ -1519,7 +1519,7 @@ public class AllBlocks { public static final BlockEntry ROTATION_SPEED_CONTROLLER = REGISTRATE.block("rotation_speed_controller", SpeedControllerBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.TERRACOTTA_YELLOW)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW)) .transform(axeOrPickaxe()) .tag(AllBlockTags.SAFE_NBT.tag) .transform(BlockStressDefaults.setNoImpact()) @@ -1532,7 +1532,7 @@ public class AllBlocks { public static final BlockEntry MECHANICAL_ARM = REGISTRATE.block("mechanical_arm", ArmBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.TERRACOTTA_YELLOW)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW)) .transform(axeOrPickaxe()) .blockstate((c, p) -> p.getVariantBuilder(c.get()) .forAllStates(s -> ConfiguredModel.builder() @@ -1545,8 +1545,8 @@ public class AllBlocks { .register(); public static final BlockEntry TRACK = REGISTRATE.block("track", TrackMaterial.ANDESITE::createBlock) - .initialProperties(Material.STONE) - .properties(p -> p.color(MaterialColor.METAL) + .initialProperties(SharedProperties::stone) + .properties(p -> p.mapColor(MapColor.METAL) .strength(0.8F) .sound(SoundType.METAL) .noOcclusion()) @@ -1564,10 +1564,10 @@ public class AllBlocks { .register(); public static final BlockEntry FAKE_TRACK = REGISTRATE.block("fake_track", FakeTrackBlock::new) - .initialProperties((new Material.Builder(MaterialColor.METAL)).noCollider() - .nonSolid() - .replaceable() - .build()) + .properties(p -> p.mapColor(MapColor.METAL) + .noCollission() + .noOcclusion() + .replaceable()) .blockstate((c, p) -> p.simpleBlock(c.get(), p.models() .withExistingParent(c.getName(), p.mcLoc("block/air")))) .lang("Track Marker for Maps") @@ -1576,14 +1576,14 @@ public class AllBlocks { public static final BlockEntry RAILWAY_CASING = REGISTRATE.block("railway_casing", CasingBlock::new) .transform(BuilderTransformers.layeredCasing(() -> AllSpriteShifts.RAILWAY_CASING_SIDE, () -> AllSpriteShifts.RAILWAY_CASING)) - .properties(p -> p.color(MaterialColor.TERRACOTTA_CYAN)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_CYAN)) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK)) .lang("Train Casing") .register(); public static final BlockEntry TRACK_STATION = REGISTRATE.block("track_station", StationBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK)) .transform(pickaxeOnly()) .blockstate((c, p) -> p.simpleBlock(c.get(), AssetLookup.partialBaseModel(c, p))) @@ -1596,7 +1596,7 @@ public class AllBlocks { public static final BlockEntry TRACK_SIGNAL = REGISTRATE.block("track_signal", SignalBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .properties(p -> p.noOcclusion()) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK)) .transform(pickaxeOnly()) @@ -1613,7 +1613,7 @@ public class AllBlocks { public static final BlockEntry TRACK_OBSERVER = REGISTRATE.block("track_observer", TrackObserverBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .properties(p -> p.noOcclusion()) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK)) .blockstate((c, p) -> BlockStateGen.simpleBlock(c, p, AssetLookup.forPowered(c, p))) @@ -1626,19 +1626,19 @@ public class AllBlocks { public static final BlockEntry SMALL_BOGEY = REGISTRATE.block("small_bogey", p -> new StandardBogeyBlock(p, BogeySizes.SMALL)) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(BuilderTransformers.bogey()) .register(); public static final BlockEntry LARGE_BOGEY = REGISTRATE.block("large_bogey", p -> new StandardBogeyBlock(p, BogeySizes.LARGE)) - .properties(p -> p.color(MaterialColor.PODZOL)) + .properties(p -> p.mapColor(MapColor.PODZOL)) .transform(BuilderTransformers.bogey()) .register(); public static final BlockEntry TRAIN_CONTROLS = REGISTRATE.block("controls", ControlsBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.TERRACOTTA_BROWN)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN)) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK)) .addLayer(() -> RenderType::cutoutMipped) .transform(pickaxeOnly()) @@ -1654,7 +1654,7 @@ public class AllBlocks { public static final BlockEntry ITEM_VAULT = REGISTRATE.block("item_vault", ItemVaultBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.TERRACOTTA_BLUE)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_BLUE)) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK) .explosionResistance(1200)) .transform(pickaxeOnly()) @@ -1672,7 +1672,7 @@ public class AllBlocks { REGISTRATE.block("andesite_funnel", AndesiteFunnelBlock::new) .addLayer(() -> RenderType::cutoutMipped) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.STONE)) + .properties(p -> p.mapColor(MapColor.STONE)) .transform(pickaxeOnly()) .tag(AllBlockTags.SAFE_NBT.tag) .onRegister(movementBehaviour(FunnelMovementBehaviour.andesite())) @@ -1687,7 +1687,7 @@ public class AllBlocks { REGISTRATE.block("andesite_belt_funnel", p -> new BeltFunnelBlock(AllBlocks.ANDESITE_FUNNEL, p)) .addLayer(() -> RenderType::cutoutMipped) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.STONE)) + .properties(p -> p.mapColor(MapColor.STONE)) .transform(pickaxeOnly()) .tag(AllBlockTags.SAFE_NBT.tag) .blockstate(new BeltFunnelGenerator("andesite")::generate) @@ -1698,7 +1698,7 @@ public class AllBlocks { REGISTRATE.block("brass_funnel", BrassFunnelBlock::new) .addLayer(() -> RenderType::cutoutMipped) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.TERRACOTTA_YELLOW)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW)) .transform(pickaxeOnly()) .tag(AllBlockTags.SAFE_NBT.tag) .onRegister(movementBehaviour(FunnelMovementBehaviour.brass())) @@ -1713,7 +1713,7 @@ public class AllBlocks { REGISTRATE.block("brass_belt_funnel", p -> new BeltFunnelBlock(AllBlocks.BRASS_FUNNEL, p)) .addLayer(() -> RenderType::cutoutMipped) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.TERRACOTTA_YELLOW)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW)) .transform(pickaxeOnly()) .tag(AllBlockTags.SAFE_NBT.tag) .blockstate(new BeltFunnelGenerator("brass")::generate) @@ -1722,7 +1722,7 @@ public class AllBlocks { public static final BlockEntry ANDESITE_TUNNEL = REGISTRATE.block("andesite_tunnel", BeltTunnelBlock::new) - .properties(p -> p.color(MaterialColor.STONE)) + .properties(p -> p.mapColor(MapColor.STONE)) .transform(BuilderTransformers.beltTunnel("andesite", new ResourceLocation("block/polished_andesite"))) .onRegister(assignDataBehaviour(new AccumulatedItemCountDisplaySource(), "accumulate_items")) .onRegister(assignDataBehaviour(new ItemThroughputDisplaySource(), "item_throughput")) @@ -1730,7 +1730,7 @@ public class AllBlocks { public static final BlockEntry BRASS_TUNNEL = REGISTRATE.block("brass_tunnel", BrassTunnelBlock::new) - .properties(p -> p.color(MaterialColor.TERRACOTTA_YELLOW)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW)) .transform(BuilderTransformers.beltTunnel("brass", Create.asResource("block/brass_block"))) .onRegister(assignDataBehaviour(new AccumulatedItemCountDisplaySource(), "accumulate_items")) .onRegister(assignDataBehaviour(new ItemThroughputDisplaySource(), "item_throughput")) @@ -1740,7 +1740,7 @@ public class AllBlocks { public static final BlockEntry SMART_OBSERVER = REGISTRATE.block("content_observer", SmartObserverBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.TERRACOTTA_BROWN)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN)) .properties(p -> p.noOcclusion()) .transform(axeOrPickaxe()) .blockstate(new SmartObserverGenerator()::generate) @@ -1756,7 +1756,7 @@ public class AllBlocks { public static final BlockEntry THRESHOLD_SWITCH = REGISTRATE.block("stockpile_switch", ThresholdSwitchBlock::new) .initialProperties(SharedProperties::stone) - .properties(p -> p.color(MaterialColor.TERRACOTTA_BROWN)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN)) .properties(p -> p.noOcclusion()) .transform(axeOrPickaxe()) .blockstate(new ThresholdSwitchGenerator()::generate) @@ -1769,13 +1769,13 @@ public class AllBlocks { public static final BlockEntry CREATIVE_CRATE = REGISTRATE.block("creative_crate", CreativeCrateBlock::new) .transform(BuilderTransformers.crate("creative")) - .properties(p -> p.color(MaterialColor.COLOR_PURPLE)) + .properties(p -> p.mapColor(MapColor.COLOR_PURPLE)) .register(); public static final BlockEntry DISPLAY_LINK = REGISTRATE.block("display_link", DisplayLinkBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.TERRACOTTA_BROWN)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN)) .addLayer(() -> RenderType::translucent) .transform(axeOrPickaxe()) .blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p))) @@ -1786,7 +1786,7 @@ public class AllBlocks { public static final BlockEntry DISPLAY_BOARD = REGISTRATE.block("display_board", FlapDisplayBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.COLOR_GRAY)) + .properties(p -> p.mapColor(MapColor.COLOR_GRAY)) .addLayer(() -> RenderType::cutoutMipped) .transform(pickaxeOnly()) .transform(BlockStressDefaults.setImpact(0)) @@ -1801,7 +1801,7 @@ public class AllBlocks { REGISTRATE.block("nixie_tube", p -> new NixieTubeBlock(p, DyeColor.ORANGE)) .initialProperties(SharedProperties::softMetal) .properties(p -> p.lightLevel($ -> 5)) - .properties(p -> p.color(DyeColor.ORANGE.getMaterialColor())) + .properties(p -> p.mapColor(DyeColor.ORANGE)) .transform(pickaxeOnly()) .blockstate(new NixieTubeGenerator()::generate) .addLayer(() -> RenderType::translucent) @@ -1815,7 +1815,7 @@ public class AllBlocks { String colourName = colour.getSerializedName(); return REGISTRATE.block(colourName + "_nixie_tube", p -> new NixieTubeBlock(p, colour)) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(colour.getMaterialColor())) + .properties(p -> p.mapColor(colour)) .properties(p -> p.lightLevel($ -> 5)) .transform(pickaxeOnly()) .blockstate(new NixieTubeGenerator()::generate) @@ -1827,7 +1827,7 @@ public class AllBlocks { public static final BlockEntry ROSE_QUARTZ_LAMP = REGISTRATE.block("rose_quartz_lamp", RoseQuartzLampBlock::new) .initialProperties(() -> Blocks.REDSTONE_LAMP) - .properties(p -> p.color(MaterialColor.TERRACOTTA_PINK) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_PINK) .lightLevel(s -> s.getValue(RoseQuartzLampBlock.POWERING) ? 15 : 0)) .blockstate((c, p) -> BlockStateGen.simpleBlock(c, p, s -> { boolean powered = s.getValue(RoseQuartzLampBlock.POWERING); @@ -1842,7 +1842,7 @@ public class AllBlocks { public static final BlockEntry REDSTONE_LINK = REGISTRATE.block("redstone_link", RedstoneLinkBlock::new) .initialProperties(SharedProperties::wooden) - .properties(p -> p.color(MaterialColor.TERRACOTTA_BROWN)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_BROWN)) .transform(axeOrPickaxe()) .tag(AllBlockTags.BRITTLE.tag, AllBlockTags.SAFE_NBT.tag) .blockstate(new RedstoneLinkGenerator()::generate) @@ -1933,14 +1933,14 @@ public class AllBlocks { public static final BlockEntry PECULIAR_BELL = REGISTRATE.block("peculiar_bell", PeculiarBellBlock::new) - .properties(p -> p.color(MaterialColor.GOLD)) + .properties(p -> p.mapColor(MapColor.GOLD)) .transform(BuilderTransformers.bell()) .onRegister(movementBehaviour(new BellMovementBehaviour())) .register(); public static final BlockEntry HAUNTED_BELL = REGISTRATE.block("haunted_bell", HauntedBellBlock::new) - .properties(p -> p.color(MaterialColor.SAND)) + .properties(p -> p.mapColor(MapColor.SAND)) .transform(BuilderTransformers.bell()) .onRegister(movementBehaviour(new HauntedBellMovementBehaviour())) .register(); @@ -1950,7 +1950,7 @@ public class AllBlocks { return REGISTRATE.block(colourName + "_toolbox", p -> new ToolboxBlock(p, colour)) .initialProperties(SharedProperties::wooden) .properties(p -> p.sound(SoundType.WOOD)) - .properties(p -> p.color(colour.getMaterialColor())) + .properties(p -> p.mapColor(colour)) .addLayer(() -> RenderType::cutoutMipped) .loot((lt, block) -> { Builder builder = LootTable.lootTable(); @@ -1998,53 +1998,53 @@ public class AllBlocks { public static final BlockEntry ANDESITE_LADDER = REGISTRATE.block("andesite_ladder", MetalLadderBlock::new) .transform(BuilderTransformers.ladder("andesite", () -> DataIngredient.items(AllItems.ANDESITE_ALLOY.get()), - MaterialColor.STONE)) + MapColor.STONE)) .register(); public static final BlockEntry BRASS_LADDER = REGISTRATE.block("brass_ladder", MetalLadderBlock::new) .transform(BuilderTransformers.ladder("brass", - () -> DataIngredient.tag(AllTags.forgeItemTag("ingots/brass")), MaterialColor.TERRACOTTA_YELLOW)) + () -> DataIngredient.tag(AllTags.forgeItemTag("ingots/brass")), MapColor.TERRACOTTA_YELLOW)) .register(); public static final BlockEntry COPPER_LADDER = REGISTRATE.block("copper_ladder", MetalLadderBlock::new) .transform(BuilderTransformers.ladder("copper", - () -> DataIngredient.tag(AllTags.forgeItemTag("ingots/copper")), MaterialColor.COLOR_ORANGE)) + () -> DataIngredient.tag(AllTags.forgeItemTag("ingots/copper")), MapColor.COLOR_ORANGE)) .register(); public static final BlockEntry ANDESITE_BARS = MetalBarsGen.createBars("andesite", true, - () -> DataIngredient.items(AllItems.ANDESITE_ALLOY.get()), MaterialColor.STONE); + () -> DataIngredient.items(AllItems.ANDESITE_ALLOY.get()), MapColor.STONE); public static final BlockEntry BRASS_BARS = MetalBarsGen.createBars("brass", true, - () -> DataIngredient.tag(AllTags.forgeItemTag("ingots/brass")), MaterialColor.TERRACOTTA_YELLOW); + () -> DataIngredient.tag(AllTags.forgeItemTag("ingots/brass")), MapColor.TERRACOTTA_YELLOW); public static final BlockEntry COPPER_BARS = MetalBarsGen.createBars("copper", true, - () -> DataIngredient.tag(AllTags.forgeItemTag("ingots/copper")), MaterialColor.COLOR_ORANGE); + () -> DataIngredient.tag(AllTags.forgeItemTag("ingots/copper")), MapColor.COLOR_ORANGE); public static final BlockEntry ANDESITE_SCAFFOLD = REGISTRATE .block("andesite_scaffolding", MetalScaffoldingBlock::new) .transform(BuilderTransformers.scaffold("andesite", () -> DataIngredient.items(AllItems.ANDESITE_ALLOY.get()), - MaterialColor.STONE, AllSpriteShifts.ANDESITE_SCAFFOLD, AllSpriteShifts.ANDESITE_SCAFFOLD_INSIDE, + MapColor.STONE, AllSpriteShifts.ANDESITE_SCAFFOLD, AllSpriteShifts.ANDESITE_SCAFFOLD_INSIDE, AllSpriteShifts.ANDESITE_CASING)) .register(); public static final BlockEntry BRASS_SCAFFOLD = REGISTRATE.block("brass_scaffolding", MetalScaffoldingBlock::new) .transform(BuilderTransformers.scaffold("brass", - () -> DataIngredient.tag(AllTags.forgeItemTag("ingots/brass")), MaterialColor.TERRACOTTA_YELLOW, + () -> DataIngredient.tag(AllTags.forgeItemTag("ingots/brass")), MapColor.TERRACOTTA_YELLOW, AllSpriteShifts.BRASS_SCAFFOLD, AllSpriteShifts.BRASS_SCAFFOLD_INSIDE, AllSpriteShifts.BRASS_CASING)) .register(); public static final BlockEntry COPPER_SCAFFOLD = REGISTRATE.block("copper_scaffolding", MetalScaffoldingBlock::new) .transform(BuilderTransformers.scaffold("copper", - () -> DataIngredient.tag(AllTags.forgeItemTag("ingots/copper")), MaterialColor.COLOR_ORANGE, + () -> DataIngredient.tag(AllTags.forgeItemTag("ingots/copper")), MapColor.COLOR_ORANGE, AllSpriteShifts.COPPER_SCAFFOLD, AllSpriteShifts.COPPER_SCAFFOLD_INSIDE, AllSpriteShifts.COPPER_CASING)) .register(); public static final BlockEntry METAL_GIRDER = REGISTRATE.block("metal_girder", GirderBlock::new) .initialProperties(SharedProperties::softMetal) .blockstate(GirderBlockStateGenerator::blockState) - .properties(p -> p.color(MaterialColor.COLOR_GRAY)) + .properties(p -> p.mapColor(MapColor.COLOR_GRAY)) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK)) .transform(pickaxeOnly()) .onRegister(CreateRegistrate.blockModel(() -> ConnectedGirderModel::new)) @@ -2056,7 +2056,7 @@ public class AllBlocks { REGISTRATE.block("metal_girder_encased_shaft", GirderEncasedShaftBlock::new) .initialProperties(SharedProperties::softMetal) .blockstate(GirderBlockStateGenerator::blockStateWithShaft) - .properties(p -> p.color(MaterialColor.COLOR_GRAY)) + .properties(p -> p.mapColor(MapColor.COLOR_GRAY)) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK)) .transform(pickaxeOnly()) .loot((p, b) -> p.add(b, p.createSingleItemTable(METAL_GIRDER.get()) @@ -2068,7 +2068,7 @@ public class AllBlocks { public static final BlockEntry COPYCAT_BASE = REGISTRATE.block("copycat_base", Block::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.GLOW_LICHEN)) + .properties(p -> p.mapColor(MapColor.GLOW_LICHEN)) .addLayer(() -> RenderType::cutoutMipped) .tag(AllBlockTags.FAN_TRANSPARENT.tag) .transform(pickaxeOnly()) @@ -2107,7 +2107,7 @@ public class AllBlocks { SeatInteractionBehaviour interactionBehaviour = new SeatInteractionBehaviour(); return REGISTRATE.block(colourName + "_seat", p -> new SeatBlock(p, colour)) .initialProperties(SharedProperties::wooden) - .properties(p -> p.color(colour.getMaterialColor())) + .properties(p -> p.mapColor(colour)) .transform(axeOnly()) .onRegister(movementBehaviour(movementBehaviour)) .onRegister(interactionBehaviour(interactionBehaviour)) @@ -2141,7 +2141,7 @@ public class AllBlocks { public static final BlockEntry ANDESITE_DOOR = REGISTRATE.block("andesite_door", p -> new SlidingDoorBlock(p, true)) .transform(BuilderTransformers.slidingDoor("andesite")) - .properties(p -> p.color(MaterialColor.STONE) + .properties(p -> p.mapColor(MapColor.STONE) .sound(SoundType.STONE) .noOcclusion()) .register(); @@ -2149,7 +2149,7 @@ public class AllBlocks { public static final BlockEntry BRASS_DOOR = REGISTRATE.block("brass_door", p -> new SlidingDoorBlock(p, false)) .transform(BuilderTransformers.slidingDoor("brass")) - .properties(p -> p.color(MaterialColor.TERRACOTTA_YELLOW) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW) .sound(SoundType.STONE) .noOcclusion()) .register(); @@ -2157,7 +2157,7 @@ public class AllBlocks { public static final BlockEntry COPPER_DOOR = REGISTRATE.block("copper_door", p -> new SlidingDoorBlock(p, true)) .transform(BuilderTransformers.slidingDoor("copper")) - .properties(p -> p.color(MaterialColor.COLOR_ORANGE) + .properties(p -> p.mapColor(MapColor.COLOR_ORANGE) .sound(SoundType.STONE) .noOcclusion()) .register(); @@ -2165,7 +2165,7 @@ public class AllBlocks { public static final BlockEntry TRAIN_DOOR = REGISTRATE.block("train_door", p -> new SlidingDoorBlock(p, false)) .transform(BuilderTransformers.slidingDoor("train")) - .properties(p -> p.color(MaterialColor.TERRACOTTA_CYAN) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_CYAN) .sound(SoundType.NETHERITE_BLOCK) .noOcclusion()) .register(); @@ -2173,7 +2173,7 @@ public class AllBlocks { public static final BlockEntry TRAIN_TRAPDOOR = REGISTRATE.block("train_trapdoor", TrainTrapdoorBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.TERRACOTTA_CYAN) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_CYAN) .sound(SoundType.NETHERITE_BLOCK)) .transform(BuilderTransformers.trapdoor(true)) .register(); @@ -2181,7 +2181,7 @@ public class AllBlocks { public static final BlockEntry FRAMED_GLASS_DOOR = REGISTRATE.block("framed_glass_door", p -> new SlidingDoorBlock(p, false)) .transform(BuilderTransformers.slidingDoor("glass")) - .properties(p -> p.color(MaterialColor.NONE) + .properties(p -> p.mapColor(MapColor.NONE) .sound(SoundType.GLASS) .noOcclusion()) .register(); @@ -2190,7 +2190,7 @@ public class AllBlocks { REGISTRATE.block("framed_glass_trapdoor", TrainTrapdoorBlock::new) .initialProperties(SharedProperties::softMetal) .transform(BuilderTransformers.trapdoor(false)) - .properties(p -> p.color(MaterialColor.NONE) + .properties(p -> p.mapColor(MapColor.NONE) .sound(SoundType.GLASS) .noOcclusion()) .onRegister(connectedTextures(TrapdoorCTBehaviour::new)) @@ -2199,7 +2199,7 @@ public class AllBlocks { public static final BlockEntry ZINC_ORE = REGISTRATE.block("zinc_ore", Block::new) .initialProperties(() -> Blocks.GOLD_ORE) - .properties(p -> p.color(MaterialColor.METAL)) + .properties(p -> p.mapColor(MapColor.METAL)) .properties(p -> p.requiresCorrectToolForDrops() .sound(SoundType.STONE)) .transform(pickaxeOnly()) @@ -2216,7 +2216,7 @@ public class AllBlocks { public static final BlockEntry DEEPSLATE_ZINC_ORE = REGISTRATE.block("deepslate_zinc_ore", Block::new) .initialProperties(() -> Blocks.DEEPSLATE_GOLD_ORE) - .properties(p -> p.color(MaterialColor.STONE)) + .properties(p -> p.mapColor(MapColor.STONE)) .properties(p -> p.requiresCorrectToolForDrops() .sound(SoundType.DEEPSLATE)) .transform(pickaxeOnly()) @@ -2233,7 +2233,7 @@ public class AllBlocks { public static final BlockEntry RAW_ZINC_BLOCK = REGISTRATE.block("raw_zinc_block", Block::new) .initialProperties(() -> Blocks.RAW_GOLD_BLOCK) - .properties(p -> p.color(MaterialColor.GLOW_LICHEN)) + .properties(p -> p.mapColor(MapColor.GLOW_LICHEN)) .properties(p -> p.requiresCorrectToolForDrops()) .transform(pickaxeOnly()) .tag(Tags.Blocks.STORAGE_BLOCKS) @@ -2246,7 +2246,7 @@ public class AllBlocks { public static final BlockEntry ZINC_BLOCK = REGISTRATE.block("zinc_block", Block::new) .initialProperties(() -> Blocks.IRON_BLOCK) - .properties(p -> p.color(MaterialColor.GLOW_LICHEN)) + .properties(p -> p.mapColor(MapColor.GLOW_LICHEN)) .properties(p -> p.requiresCorrectToolForDrops()) .transform(pickaxeOnly()) .tag(BlockTags.NEEDS_IRON_TOOL) @@ -2260,7 +2260,7 @@ public class AllBlocks { public static final BlockEntry ANDESITE_ALLOY_BLOCK = REGISTRATE.block("andesite_alloy_block", Block::new) .initialProperties(() -> Blocks.ANDESITE) - .properties(p -> p.color(MaterialColor.STONE)) + .properties(p -> p.mapColor(MapColor.STONE)) .properties(p -> p.requiresCorrectToolForDrops()) .transform(pickaxeOnly()) .blockstate(simpleCubeAll("andesite_block")) @@ -2273,7 +2273,7 @@ public class AllBlocks { public static final BlockEntry INDUSTRIAL_IRON_BLOCK = REGISTRATE.block("industrial_iron_block", Block::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.COLOR_GRAY)) + .properties(p -> p.mapColor(MapColor.COLOR_GRAY)) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK)) .properties(p -> p.requiresCorrectToolForDrops()) .transform(pickaxeOnly()) @@ -2289,7 +2289,7 @@ public class AllBlocks { public static final BlockEntry BRASS_BLOCK = REGISTRATE.block("brass_block", Block::new) .initialProperties(() -> Blocks.IRON_BLOCK) - .properties(p -> p.color(MaterialColor.TERRACOTTA_YELLOW)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_YELLOW)) .properties(p -> p.requiresCorrectToolForDrops()) .transform(pickaxeOnly()) .blockstate(simpleCubeAll("brass_block")) @@ -2305,7 +2305,7 @@ public class AllBlocks { public static final BlockEntry EXPERIENCE_BLOCK = REGISTRATE.block("experience_block", ExperienceBlock::new) .initialProperties(SharedProperties::softMetal) - .properties(p -> p.color(MaterialColor.PLANT)) + .properties(p -> p.mapColor(MapColor.PLANT)) .properties(p -> p.sound(new ForgeSoundType(1, .5f, () -> SoundEvents.AMETHYST_BLOCK_BREAK, () -> SoundEvents.AMETHYST_BLOCK_STEP, () -> SoundEvents.AMETHYST_BLOCK_PLACE, () -> SoundEvents.AMETHYST_BLOCK_HIT, () -> SoundEvents.AMETHYST_BLOCK_FALL))) @@ -2325,7 +2325,7 @@ public class AllBlocks { public static final BlockEntry ROSE_QUARTZ_BLOCK = REGISTRATE.block("rose_quartz_block", RotatedPillarBlock::new) .initialProperties(() -> Blocks.AMETHYST_BLOCK) - .properties(p -> p.color(MaterialColor.TERRACOTTA_PINK) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_PINK) .requiresCorrectToolForDrops() .sound(SoundType.DEEPSLATE)) .transform(pickaxeOnly()) @@ -2339,7 +2339,7 @@ public class AllBlocks { public static final BlockEntry ROSE_QUARTZ_TILES = REGISTRATE.block("rose_quartz_tiles", Block::new) .initialProperties(() -> Blocks.DEEPSLATE) - .properties(p -> p.color(MaterialColor.TERRACOTTA_PINK)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_PINK)) .properties(p -> p.requiresCorrectToolForDrops()) .transform(pickaxeOnly()) .blockstate(simpleCubeAll("palettes/rose_quartz_tiles")) @@ -2351,7 +2351,7 @@ public class AllBlocks { public static final BlockEntry SMALL_ROSE_QUARTZ_TILES = REGISTRATE.block("small_rose_quartz_tiles", Block::new) .initialProperties(() -> Blocks.DEEPSLATE) - .properties(p -> p.color(MaterialColor.TERRACOTTA_PINK)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_PINK)) .properties(p -> p.requiresCorrectToolForDrops()) .transform(pickaxeOnly()) .blockstate(simpleCubeAll("palettes/small_rose_quartz_tiles")) diff --git a/src/main/java/com/simibubi/create/AllCreativeModeTabs.java b/src/main/java/com/simibubi/create/AllCreativeModeTabs.java index 8741c4ec7..7d031eaa8 100644 --- a/src/main/java/com/simibubi/create/AllCreativeModeTabs.java +++ b/src/main/java/com/simibubi/create/AllCreativeModeTabs.java @@ -7,6 +7,7 @@ import java.util.Set; import java.util.function.Function; import java.util.function.Predicate; +import com.simibubi.create.AllCreativeModeTabs.RegistrateDisplayItemsGenerator.ItemOrdering.Type; import com.simibubi.create.content.contraptions.actors.seat.SeatBlock; import com.simibubi.create.content.decoration.palettes.AllPaletteBlocks; import com.simibubi.create.content.equipment.armor.BacktankUtil; diff --git a/src/main/java/com/simibubi/create/AllSoundEvents.java b/src/main/java/com/simibubi/create/AllSoundEvents.java index 28e3b0b88..40287c419 100644 --- a/src/main/java/com/simibubi/create/AllSoundEvents.java +++ b/src/main/java/com/simibubi/create/AllSoundEvents.java @@ -332,7 +332,7 @@ public class AllSoundEvents { } public static void playItemPickup(Player player) { - player.level.playSound(null, player.blockPosition(), SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, .2f, + player.level().playSound(null, player.blockPosition(), SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, .2f, 1f + Create.RANDOM.nextFloat()); } @@ -509,7 +509,7 @@ public class AllSoundEvents { public void playFrom(Entity entity, float volume, float pitch) { if (!entity.isSilent()) - play(entity.level, null, entity.blockPosition(), volume, pitch); + play(entity.level(), null, entity.blockPosition(), volume, pitch); } public void play(Level world, Player entity, Vec3i pos, float volume, float pitch) { diff --git a/src/main/java/com/simibubi/create/api/connectivity/ConnectivityHandler.java b/src/main/java/com/simibubi/create/api/connectivity/ConnectivityHandler.java index f367df848..a056d4d9f 100644 --- a/src/main/java/com/simibubi/create/api/connectivity/ConnectivityHandler.java +++ b/src/main/java/com/simibubi/create/api/connectivity/ConnectivityHandler.java @@ -23,11 +23,10 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidTank; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.items.CapabilityItemHandler; public class ConnectivityHandler { @@ -361,10 +360,10 @@ public class ConnectivityHandler { } if (be instanceof IMultiBlockEntityContainer.Inventory inv && inv.hasInventory()) - be.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + be.getCapability(ForgeCapabilities.ITEM_HANDLER) .invalidate(); if (be instanceof IMultiBlockEntityContainer.Fluid fluid && fluid.hasTank()) - be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + be.getCapability(ForgeCapabilities.FLUID_HANDLER) .invalidate(); if (tryReconnect) diff --git a/src/main/java/com/simibubi/create/compat/curios/GogglesCurioRenderer.java b/src/main/java/com/simibubi/create/compat/curios/GogglesCurioRenderer.java index a76ee63b2..4fc4ca145 100644 --- a/src/main/java/com/simibubi/create/compat/curios/GogglesCurioRenderer.java +++ b/src/main/java/com/simibubi/create/compat/curios/GogglesCurioRenderer.java @@ -14,12 +14,12 @@ import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.entity.RenderLayerParent; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -60,7 +60,7 @@ public class GogglesCurioRenderer implements ICurioRenderer { } // Render - Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemTransforms.TransformType.HEAD, light, OverlayTexture.NO_OVERLAY, matrixStack, renderTypeBuffer, 0); + Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.HEAD, light, OverlayTexture.NO_OVERLAY, matrixStack, renderTypeBuffer, 0); matrixStack.popPose(); } diff --git a/src/main/java/com/simibubi/create/compat/jei/ScreenResourceWrapper.java b/src/main/java/com/simibubi/create/compat/jei/ScreenResourceWrapper.java index bc7bd4aa4..7b76bead1 100644 --- a/src/main/java/com/simibubi/create/compat/jei/ScreenResourceWrapper.java +++ b/src/main/java/com/simibubi/create/compat/jei/ScreenResourceWrapper.java @@ -4,7 +4,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.foundation.gui.AllGuiTextures; import mezz.jei.api.gui.drawable.IDrawable; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; public class ScreenResourceWrapper implements IDrawable { @@ -27,7 +27,7 @@ public class ScreenResourceWrapper implements IDrawable { @Override public void draw(PoseStack matrixStack, int xOffset, int yOffset) { resource.bind(); - GuiComponent.blit(matrixStack, xOffset, yOffset, 0, resource.startX, resource.startY, resource.width, + GuiGraphics.blit(matrixStack, xOffset, yOffset, 0, resource.startX, resource.startY, resource.width, resource.height, 256, 256); } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/ItemDrainCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/ItemDrainCategory.java index b40b8beb3..efa85ac75 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/ItemDrainCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/ItemDrainCategory.java @@ -25,9 +25,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.PotionItem; import net.minecraft.world.item.crafting.Ingredient; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; import net.minecraftforge.fluids.capability.IFluidHandlerItem; @@ -54,12 +54,12 @@ public class ItemDrainCategory extends CreateRecipeCategory { } LazyOptional capability = - stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); + stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM); if (!capability.isPresent()) continue; ItemStack copy = stack.copy(); - capability = copy.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); + capability = copy.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM); IFluidHandlerItem handler = capability.orElse(null); FluidStack extracted = handler.drain(1000, FluidAction.EXECUTE); ItemStack result = handler.getContainer(); diff --git a/src/main/java/com/simibubi/create/compat/jei/category/SpoutCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/SpoutCategory.java index 58940cb79..bf35689db 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/SpoutCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/SpoutCategory.java @@ -28,9 +28,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.PotionItem; import net.minecraft.world.item.crafting.Ingredient; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; import net.minecraftforge.fluids.capability.IFluidHandlerItem; @@ -58,13 +58,13 @@ public class SpoutCategory extends CreateRecipeCategory { } LazyOptional capability = - stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); + stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM); if (!capability.isPresent()) continue; for (FluidStack fluidStack : fluidStacks) { ItemStack copy = stack.copy(); - copy.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY) + copy.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM) .ifPresent(fhi -> { if (!GenericItemFilling.isFluidHandlerValid(copy, fhi)) return; diff --git a/src/main/java/com/simibubi/create/compat/tconstruct/SpoutCasting.java b/src/main/java/com/simibubi/create/compat/tconstruct/SpoutCasting.java index 65e26042f..d3e3ea1ed 100644 --- a/src/main/java/com/simibubi/create/compat/tconstruct/SpoutCasting.java +++ b/src/main/java/com/simibubi/create/compat/tconstruct/SpoutCasting.java @@ -12,8 +12,8 @@ import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; @@ -34,7 +34,7 @@ public class SpoutCasting extends BlockSpoutingBehaviour { if (blockEntity == null) return 0; - IFluidHandler handler = blockEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, Direction.UP) + IFluidHandler handler = blockEntity.getCapability(ForgeCapabilities.FLUID_HANDLER, Direction.UP) .orElse(null); if (handler == null) return 0; diff --git a/src/main/java/com/simibubi/create/content/contraptions/AbstractContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/AbstractContraptionEntity.java index 72d222792..be0ea6006 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/AbstractContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/AbstractContraptionEntity.java @@ -112,7 +112,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit this.contraption = contraption; if (contraption == null) return; - if (level.isClientSide) + if (level().isClientSide) return; contraption.onEntityCreated(this); } @@ -133,7 +133,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit } protected void contraptionInitialize() { - contraption.onEntityInitialize(level, this); + contraption.onEntityInitialize(level(), this); initialized = true; } @@ -160,7 +160,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit passenger.startRiding(this, true); if (passenger instanceof TamableAnimal ta) ta.setInSittingPose(true); - if (level.isClientSide) + if (level().isClientSide) return; contraption.getSeatMapping() .put(passenger.getUUID(), seatIndex); @@ -174,7 +174,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit super.removePassenger(passenger); if (passenger instanceof TamableAnimal ta) ta.setInSittingPose(false); - if (level.isClientSide) + if (level().isClientSide) return; if (transformedVector != null) passenger.getPersistentData() @@ -269,7 +269,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit } public void stopControlling(BlockPos controlsLocalPos) { - getControllingPlayer().map(level::getPlayerByUUID) + getControllingPlayer().map(level()::getPlayerByUUID) .map(p -> (p instanceof ServerPlayer) ? ((ServerPlayer) p) : null) .ifPresent(p -> AllPackets.getChannel().send(PacketDistributor.PLAYER.with(() -> p), new ControlsStopControllingPacket())); @@ -305,16 +305,16 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit } } - if (toDismount != null && !level.isClientSide) { + if (toDismount != null && !level().isClientSide) { Vec3 transformedVector = getPassengerPosition(toDismount, 1); toDismount.stopRiding(); if (transformedVector != null) toDismount.teleportTo(transformedVector.x, transformedVector.y, transformedVector.z); } - if (level.isClientSide) + if (level().isClientSide) return true; - addSittingPassenger(SeatBlock.getLeashed(level, player) + addSittingPassenger(SeatBlock.getLeashed(level(), player) .or(player), indexOfSeat); return true; } @@ -370,7 +370,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit tickContraption(); super.tick(); - if (level.isClientSide()) + if (level().isClientSide()) DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> { if (!contraption.deferInvalidate) return; @@ -378,7 +378,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit ContraptionRenderDispatcher.invalidate(contraption); }); - if (!(level instanceof ServerLevelAccessor sl)) + if (!(level() instanceof ServerLevelAccessor sl)) return; for (Entity entity : getPassengers()) { @@ -404,7 +404,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit float prevAngle = living.getYRot(); float angle = AngleHelper.deg(-Mth.atan2(motion.x, motion.z)); angle = AngleHelper.angleLerp(0.4f, prevAngle, angle); - if (level.isClientSide) { + if (level().isClientSide) { living.lerpTo(0, 0, 0, 0, 0, 0, false); living.lerpHeadTo(0, 0); living.setYRot(angle); @@ -418,7 +418,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit public void setBlock(BlockPos localPos, StructureBlockInfo newInfo) { contraption.blocks.put(localPos, newInfo); AllPackets.getChannel().send(PacketDistributor.TRACKING_ENTITY.with(() -> this), - new ContraptionBlockChangedPacket(getId(), localPos, newInfo.state)); + new ContraptionBlockChangedPacket(getId(), localPos, newInfo.state())); } protected abstract void tickContraption(); @@ -430,22 +430,22 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit public void tickActors() { boolean stalledPreviously = contraption.stalled; - if (!level.isClientSide) + if (!level().isClientSide) contraption.stalled = false; skipActorStop = true; for (MutablePair pair : contraption.getActors()) { MovementContext context = pair.right; StructureBlockInfo blockInfo = pair.left; - MovementBehaviour actor = AllMovementBehaviours.getBehaviour(blockInfo.state); + MovementBehaviour actor = AllMovementBehaviours.getBehaviour(blockInfo.state()); if (actor == null) continue; Vec3 oldMotion = context.motion; - Vec3 actorPosition = toGlobalVector(VecHelper.getCenterOf(blockInfo.pos) + Vec3 actorPosition = toGlobalVector(VecHelper.getCenterOf(blockInfo.pos()) .add(actor.getActiveAreaOffset(context)), 1); - BlockPos gridPosition = new BlockPos(actorPosition); + BlockPos gridPosition = BlockPos.containing(actorPosition); boolean newPosVisited = !context.stall && shouldActorTrigger(context, blockInfo, actor, actorPosition, gridPosition); @@ -470,7 +470,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit contraption.stalled |= context.stall; } if (!isAlive()) { - contraption.stop(level); + contraption.stop(level()); return; } skipActorStop = false; @@ -487,7 +487,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit } } - if (!level.isClientSide) { + if (!level().isClientSide) { if (!stalledPreviously && contraption.stalled) onContraptionStalled(); entityData.set(STALLED, contraption.stalled); @@ -501,10 +501,10 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit for (MutablePair pair : contraption.getActors()) { MovementContext context = pair.right; StructureBlockInfo blockInfo = pair.left; - MovementBehaviour actor = AllMovementBehaviours.getBehaviour(blockInfo.state); + MovementBehaviour actor = AllMovementBehaviours.getBehaviour(blockInfo.state()); if (actor instanceof PortableStorageInterfaceMovement && isActorActive(context, actor)) if (context.position != null) - actor.visitNewPosition(context, new BlockPos(context.position)); + actor.visitNewPosition(context, BlockPos.containing(context.position)); } } @@ -525,7 +525,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit context.motion = actorPosition.subtract(previousPosition); - if (!level.isClientSide() && context.contraption.entity instanceof CarriageContraptionEntity cce + if (!level().isClientSide() && context.contraption.entity instanceof CarriageContraptionEntity cce && cce.getCarriage() != null) { Train train = cce.getCarriage().train; double actualSpeed = train.speedBeforeStall != null ? train.speedBeforeStall : train.speed; @@ -537,7 +537,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit relativeMotion = reverseRotation(relativeMotion, 1); context.relativeMotion = relativeMotion; - return !new BlockPos(previousPosition).equals(gridPosition) + return !BlockPos.containing(previousPosition).equals(gridPosition) || (context.relativeMotion.length() > 0 || context.contraption instanceof CarriageContraption) && context.firstMovement; } @@ -640,7 +640,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit return; initialized = compound.getBoolean("Initialized"); - contraption = Contraption.fromNBT(level, compound.getCompound("Contraption"), spawnData); + contraption = Contraption.fromNBT(level(), compound.getCompound("Contraption"), spawnData); contraption.entity = this; entityData.set(STALLED, compound.getBoolean("Stalled")); } @@ -653,12 +653,12 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit StructureTransform transform = makeStructureTransform(); - contraption.stop(level); + contraption.stop(level()); AllPackets.getChannel().send(PacketDistributor.TRACKING_ENTITY.with(() -> this), new ContraptionDisassemblyPacket(this.getId(), transform)); - contraption.addBlocksToWorld(level, transform); - contraption.addPassengersToWorld(level, transform, getPassengers()); + contraption.addBlocksToWorld(level(), transform); + contraption.addPassengersToWorld(level(), transform, getPassengers()); for (Entity entity : getPassengers()) { if (!(entity instanceof OrientedContraptionEntity)) @@ -677,14 +677,14 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit ejectPassengers(); moveCollidedEntitiesOnDisassembly(transform); - AllSoundEvents.CONTRAPTION_DISASSEMBLE.playOnServer(level, blockPosition()); + AllSoundEvents.CONTRAPTION_DISASSEMBLE.playOnServer(level(), blockPosition()); } private void moveCollidedEntitiesOnDisassembly(StructureTransform transform) { for (Entity entity : collidingEntities.keySet()) { Vec3 localVec = toLocalVector(entity.position(), 0); Vec3 transformed = transform.apply(localVec); - if (level.isClientSide) + if (level().isClientSide) entity.setPos(transformed.x, transformed.y + 1 / 16f, transformed.z); else entity.teleportTo(transformed.x, transformed.y + 1 / 16f, transformed.z); @@ -693,8 +693,8 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit @Override public void remove(RemovalReason p_146834_) { - if (!level.isClientSide && !isRemoved() && contraption != null && !skipActorStop) - contraption.stop(level); + if (!level().isClientSide && !isRemoved() && contraption != null && !skipActorStop) + contraption.stop(level()); if (contraption != null) contraption.onEntityRemoved(this); super.remove(p_146834_); @@ -757,8 +757,8 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit if (contraption == null || !contraption.blocks.containsKey(localPos)) return; StructureBlockInfo info = contraption.blocks.get(localPos); - contraption.blocks.put(localPos, new StructureBlockInfo(info.pos, newState, info.nbt)); - if (info.state != newState && !(newState.getBlock() instanceof SlidingDoorBlock)) + contraption.blocks.put(localPos, new StructureBlockInfo(info.pos(), newState, info.nbt())); + if (info.state() != newState && !(newState.getBlock() instanceof SlidingDoorBlock)) contraption.deferInvalidate = true; contraption.invalidateColliders(); } @@ -918,7 +918,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit } public boolean isAliveOrStale() { - return isAlive() || level.isClientSide() ? staleTicks > 0 : false; + return isAlive() || level().isClientSide() ? staleTicks > 0 : false; } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/BlockMovementChecks.java b/src/main/java/com/simibubi/create/content/contraptions/BlockMovementChecks.java index 0a223944d..a1c70191b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/BlockMovementChecks.java +++ b/src/main/java/com/simibubi/create/content/contraptions/BlockMovementChecks.java @@ -177,8 +177,7 @@ public class BlockMovementChecks { if (state.getCollisionShape(world, pos) .isEmpty()) return false; - if (state.getMaterial() - .isReplaceable()) + if (state.canBeReplaced()) return false; return true; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/Contraption.java b/src/main/java/com/simibubi/create/content/contraptions/Contraption.java index 7e9805f66..8e4650d04 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/Contraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/Contraption.java @@ -189,7 +189,7 @@ public abstract class Contraption { public ContraptionWorld getContraptionWorld() { if (world == null) - world = new ContraptionWorld(entity.level, this); + world = new ContraptionWorld(entity.level(), this); return world; } @@ -251,7 +251,7 @@ public abstract class Contraption { for (BlockFace blockFace : pendingSubContraptions) { Direction face = blockFace.getFace(); StabilizedContraption subContraption = new StabilizedContraption(face); - Level world = entity.level; + Level world = entity.level(); BlockPos pos = blockFace.getPos(); try { if (!subContraption.assemble(world, pos)) @@ -635,7 +635,7 @@ public abstract class Contraption { protected void addBlock(BlockPos pos, Pair pair) { StructureBlockInfo captured = pair.getKey(); BlockPos localPos = pos.subtract(anchor); - StructureBlockInfo structureBlockInfo = new StructureBlockInfo(localPos, captured.state, captured.nbt); + StructureBlockInfo structureBlockInfo = new StructureBlockInfo(localPos, captured.state(), captured.nbt()); if (blocks.put(localPos, structureBlockInfo) != null) return; @@ -644,10 +644,10 @@ public abstract class Contraption { BlockEntity be = pair.getValue(); storage.addBlock(localPos, be); - if (AllMovementBehaviours.getBehaviour(captured.state) != null) + if (AllMovementBehaviours.getBehaviour(captured.state()) != null) actors.add(MutablePair.of(structureBlockInfo, null)); - MovingInteractionBehaviour interactionBehaviour = AllInteractionBehaviours.getBehaviour(captured.state); + MovingInteractionBehaviour interactionBehaviour = AllInteractionBehaviours.getBehaviour(captured.state()); if (interactionBehaviour != null) interactors.put(localPos, interactionBehaviour); @@ -735,7 +735,7 @@ public abstract class Contraption { StructureBlockInfo structureBlockInfo = getBlocks().get(pos); if (structureBlockInfo == null) return; - MovingInteractionBehaviour behaviour = AllInteractionBehaviours.getBehaviour(structureBlockInfo.state); + MovingInteractionBehaviour behaviour = AllInteractionBehaviours.getBehaviour(structureBlockInfo.state()); if (behaviour != null) interactors.put(pos, behaviour); }); @@ -758,11 +758,11 @@ public abstract class Contraption { ListTag actorsNBT = new ListTag(); for (MutablePair actor : getActors()) { - MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(actor.left.state); + MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(actor.left.state()); if (behaviour == null) continue; CompoundTag compound = new CompoundTag(); - compound.put("Pos", NbtUtils.writeBlockPos(actor.left.pos)); + compound.put("Pos", NbtUtils.writeBlockPos(actor.left.pos())); behaviour.writeExtraData(actor.right); actor.right.writeToNBT(compound); actorsNBT.add(compound); @@ -833,12 +833,12 @@ public abstract class Contraption { ListTag blockList = new ListTag(); for (StructureBlockInfo block : this.blocks.values()) { - int id = palette.idFor(block.state); + int id = palette.idFor(block.state()); CompoundTag c = new CompoundTag(); - c.putLong("Pos", block.pos.asLong()); + c.putLong("Pos", block.pos().asLong()); c.putInt("State", id); - if (block.nbt != null) - c.put("Data", block.nbt); + if (block.nbt() != null) + c.put("Data", block.nbt()); blockList.add(c); } @@ -879,36 +879,36 @@ public abstract class Contraption { StructureBlockInfo info = usePalettedDeserialization ? readStructureBlockInfo(c, finalPalette) : legacyReadStructureBlockInfo(c, holderGetter); - this.blocks.put(info.pos, info); + this.blocks.put(info.pos(), info); if (!world.isClientSide) return; - CompoundTag tag = info.nbt; + CompoundTag tag = info.nbt(); if (tag == null) return; - tag.putInt("x", info.pos.getX()); - tag.putInt("y", info.pos.getY()); - tag.putInt("z", info.pos.getZ()); + tag.putInt("x", info.pos().getX()); + tag.putInt("y", info.pos().getY()); + tag.putInt("z", info.pos().getZ()); - BlockEntity be = BlockEntity.loadStatic(info.pos, info.state, tag); + BlockEntity be = BlockEntity.loadStatic(info.pos(), info.state(), tag); if (be == null) return; be.setLevel(world); - modelData.put(info.pos, be.getModelData()); + modelData.put(info.pos(), be.getModelData()); if (be instanceof KineticBlockEntity kbe) kbe.setSpeed(0); be.getBlockState(); - MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(info.state); + MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(info.state()); if (movementBehaviour == null || !movementBehaviour.hasSpecialInstancedRendering()) maybeInstancedBlockEntities.add(be); if (movementBehaviour != null && !movementBehaviour.renderAsNormalBlockEntity()) return; - presentBlockEntities.put(info.pos, be); + presentBlockEntities.put(info.pos(), be); specialRenderedBlockEntities.add(be); }); } @@ -944,28 +944,28 @@ public abstract class Contraption { for (Iterator iterator = blocks.values() .iterator(); iterator.hasNext();) { StructureBlockInfo block = iterator.next(); - if (brittles != BlockMovementChecks.isBrittle(block.state)) + if (brittles != BlockMovementChecks.isBrittle(block.state())) continue; for (int i = 0; i < superglue.size(); i++) { AABB aabb = superglue.get(i); if (aabb == null - || !aabb.contains(block.pos.getX() + .5, block.pos.getY() + .5, block.pos.getZ() + .5)) + || !aabb.contains(block.pos().getX() + .5, block.pos().getY() + .5, block.pos().getZ() + .5)) continue; if (minimisedGlue.get(i) == null) - minimisedGlue.set(i, new BoundingBox(block.pos)); + minimisedGlue.set(i, new BoundingBox(block.pos())); else - minimisedGlue.set(i, BBHelper.encapsulate(minimisedGlue.get(i), block.pos)); + minimisedGlue.set(i, BBHelper.encapsulate(minimisedGlue.get(i), block.pos())); } - BlockPos add = block.pos.offset(anchor) + BlockPos add = block.pos().offset(anchor) .offset(offset); - if (customBlockRemoval(world, add, block.state)) + if (customBlockRemoval(world, add, block.state())) continue; BlockState oldState = world.getBlockState(add); Block blockIn = oldState.getBlock(); - boolean blockMismatch = block.state.getBlock() != blockIn; - blockMismatch &= !AllBlocks.POWERED_SHAFT.is(blockIn) || !AllBlocks.SHAFT.has(block.state); + boolean blockMismatch = block.state().getBlock() != blockIn; + blockMismatch &= !AllBlocks.POWERED_SHAFT.is(blockIn) || !AllBlocks.SHAFT.has(block.state()); if (blockMismatch) iterator.remove(); world.removeBlockEntity(add); @@ -990,13 +990,13 @@ public abstract class Contraption { } for (StructureBlockInfo block : blocks.values()) { - BlockPos add = block.pos.offset(anchor) + BlockPos add = block.pos().offset(anchor) .offset(offset); // if (!shouldUpdateAfterMovement(block)) // continue; int flags = Block.UPDATE_MOVE_BY_PISTON | Block.UPDATE_ALL; - world.sendBlockUpdated(add, block.state, Blocks.AIR.defaultBlockState(), flags); + world.sendBlockUpdated(add, block.state(), Blocks.AIR.defaultBlockState(), flags); // when the blockstate is set to air, the block's POI data is removed, but // markAndNotifyBlock tries to @@ -1004,7 +1004,7 @@ public abstract class Contraption { // we add the POI data back now // (code copied from ServerWorld.onBlockStateChange) ServerLevel serverWorld = (ServerLevel) world; - PoiTypes.forState(block.state) + PoiTypes.forState(block.state()) .ifPresent(poiType -> { world.getServer() .execute(() -> { @@ -1014,9 +1014,9 @@ public abstract class Contraption { }); }); - world.markAndNotifyBlock(add, world.getChunkAt(add), block.state, Blocks.AIR.defaultBlockState(), flags, + world.markAndNotifyBlock(add, world.getChunkAt(add), block.state(), Blocks.AIR.defaultBlockState(), flags, 512); - block.state.updateIndirectNeighbourShapes(world, add, flags & -2); + block.state().updateIndirectNeighbourShapes(world, add, flags & -2); } } @@ -1027,11 +1027,11 @@ public abstract class Contraption { for (boolean nonBrittles : Iterate.trueAndFalse) { for (StructureBlockInfo block : blocks.values()) { - if (nonBrittles == BlockMovementChecks.isBrittle(block.state)) + if (nonBrittles == BlockMovementChecks.isBrittle(block.state())) continue; - BlockPos targetPos = transform.apply(block.pos); - BlockState state = transform.apply(block.state); + BlockPos targetPos = transform.apply(block.pos()); + BlockState state = transform.apply(block.state()); if (customBlockPlacement(world, targetPos, state)) continue; @@ -1082,7 +1082,7 @@ public abstract class Contraption { BlockEntity blockEntity = world.getBlockEntity(targetPos); - CompoundTag tag = block.nbt; + CompoundTag tag = block.nbt(); // Temporary fix: Calling load(CompoundTag tag) on a Sculk sensor causes it to not react to vibrations. if(state.is(Blocks.SCULK_SENSOR) || state.is(Blocks.SCULK_SHRIEKER)) @@ -1114,8 +1114,8 @@ public abstract class Contraption { for (StructureBlockInfo block : blocks.values()) { if (!shouldUpdateAfterMovement(block)) continue; - BlockPos targetPos = transform.apply(block.pos); - world.markAndNotifyBlock(targetPos, world.getChunkAt(targetPos), block.state, block.state, + BlockPos targetPos = transform.apply(block.pos()); + world.markAndNotifyBlock(targetPos, world.getChunkAt(targetPos), block.state(), block.state(), Block.UPDATE_MOVE_BY_PISTON | Block.UPDATE_ALL, 512); } @@ -1152,7 +1152,7 @@ public abstract class Contraption { for (MutablePair pair : actors) { MovementContext context = new MovementContext(world, pair.left, this); - MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.left.state); + MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.left.state()); if (behaviour != null) behaviour.startMoving(context); pair.setRight(context); @@ -1182,7 +1182,7 @@ public abstract class Contraption { public void setActorsActive(ItemStack referenceStack, boolean enable) { for (MutablePair pair : actors) { - MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.left.state); + MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.left.state()); if (behaviour == null) continue; ItemStack behaviourStack = behaviour.canBeDisabledVia(pair.right); @@ -1212,7 +1212,7 @@ public abstract class Contraption { public void forEachActor(Level world, BiConsumer callBack) { for (MutablePair pair : actors) { - MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.getLeft().state); + MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.getLeft().state()); if (behaviour == null) continue; callBack.accept(behaviour, pair.getRight()); @@ -1220,10 +1220,10 @@ public abstract class Contraption { } protected boolean shouldUpdateAfterMovement(StructureBlockInfo info) { - if (PoiTypes.forState(info.state) + if (PoiTypes.forState(info.state()) .isPresent()) return false; - if (info.state.getBlock() instanceof SlidingDoorBlock) + if (info.state().getBlock() instanceof SlidingDoorBlock) return false; return true; } @@ -1293,7 +1293,7 @@ public abstract class Contraption { @Nullable public MutablePair getActorAt(BlockPos localPos) { for (MutablePair pair : actors) - if (localPos.equals(pair.left.pos)) + if (localPos.equals(pair.left.pos())) return pair; return null; } @@ -1320,7 +1320,7 @@ public abstract class Contraption { for (Entry entry : blocks.entrySet()) { StructureBlockInfo info = entry.getValue(); BlockPos localPos = entry.getKey(); - VoxelShape collisionShape = info.state.getCollisionShape(world, localPos, CollisionContext.empty()); + VoxelShape collisionShape = info.state().getCollisionShape(world, localPos, CollisionContext.empty()); if (collisionShape.isEmpty()) continue; combinedShape = Shapes.joinUnoptimized(combinedShape, @@ -1421,7 +1421,7 @@ public abstract class Contraption { public boolean containsBlockBreakers() { for (MutablePair pair : actors) { - MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.getLeft().state); + MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.getLeft().state()); if (behaviour instanceof BlockBreakingMovementBehaviour || behaviour instanceof HarvesterMovementBehaviour) return true; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/ContraptionCollider.java b/src/main/java/com/simibubi/create/content/contraptions/ContraptionCollider.java index 245107612..6d77b2fa3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/ContraptionCollider.java +++ b/src/main/java/com/simibubi/create/content/contraptions/ContraptionCollider.java @@ -272,22 +272,22 @@ public class ContraptionCollider { if (temporalCollision) collisionLocation = collisionLocation.add(0, motionResponse.y, 0); - BlockPos pos = new BlockPos(contraptionEntity.toLocalVector(entity.position(), 0)); + BlockPos pos = BlockPos.containing(contraptionEntity.toLocalVector(entity.position(), 0)); if (contraption.getBlocks() .containsKey(pos)) { BlockState blockState = contraption.getBlocks() - .get(pos).state; + .get(pos).state(); if (blockState.is(BlockTags.CLIMBABLE)) { surfaceCollision.setTrue(); totalResponse = totalResponse.add(0, .1f, 0); } } - pos = new BlockPos(contraptionEntity.toLocalVector(collisionLocation, 0)); + pos = BlockPos.containing(contraptionEntity.toLocalVector(collisionLocation, 0)); if (contraption.getBlocks() .containsKey(pos)) { BlockState blockState = contraption.getBlocks() - .get(pos).state; + .get(pos).state(); MovingInteractionBehaviour movingInteractionBehaviour = contraption.interactors.get(pos); if (movingInteractionBehaviour != null) @@ -303,7 +303,7 @@ public class ContraptionCollider { if (bounce > 0 && hasNormal && anyCollision && bounceEntity(entity, collisionNormal, contraptionEntity, bounce)) { - entity.level.playSound(playerType == PlayerType.CLIENT ? (Player) entity : null, entity.getX(), + entity.level().playSound(playerType == PlayerType.CLIENT ? (Player) entity : null, entity.getX(), entity.getY(), entity.getZ(), SoundEvents.SLIME_BLOCK_FALL, SoundSource.BLOCKS, .5f, 1); continue; } @@ -397,7 +397,7 @@ public class ContraptionCollider { AllPackets.getChannel() .sendToServer(new ClientMotionPacket(entityMotion, true, limbSwing)); - if (entity.isOnGround() && contraption instanceof TranslatingContraption) { + if (entity.onGround() && contraption instanceof TranslatingContraption) { safetyLock.setLeft(new WeakReference<>(contraptionEntity)); safetyLock.setRight(entity.getY() - contraptionEntity.getY()); } @@ -506,7 +506,7 @@ public class ContraptionCollider { if (!(contraptionEntity instanceof CarriageContraptionEntity cce)) return entityMotion; - if (!entity.isOnGround()) + if (!entity.onGround()) return entityMotion; CompoundTag persistentData = entity.getPersistentData(); @@ -612,20 +612,20 @@ public class ContraptionCollider { /** From Entity#collide **/ static Vec3 collide(Vec3 p_20273_, Entity e) { AABB aabb = e.getBoundingBox(); - List list = e.level.getEntityCollisions(e, aabb.expandTowards(p_20273_)); - Vec3 vec3 = p_20273_.lengthSqr() == 0.0D ? p_20273_ : collideBoundingBox(e, p_20273_, aabb, e.level, list); + List list = e.level().getEntityCollisions(e, aabb.expandTowards(p_20273_)); + Vec3 vec3 = p_20273_.lengthSqr() == 0.0D ? p_20273_ : collideBoundingBox(e, p_20273_, aabb, e.level(), list); boolean flag = p_20273_.x != vec3.x; boolean flag1 = p_20273_.y != vec3.y; boolean flag2 = p_20273_.z != vec3.z; boolean flag3 = flag1 && p_20273_.y < 0.0D; if (e.getStepHeight() > 0.0F && flag3 && (flag || flag2)) { Vec3 vec31 = collideBoundingBox(e, new Vec3(p_20273_.x, (double) e.getStepHeight(), p_20273_.z), aabb, - e.level, list); + e.level(), list); Vec3 vec32 = collideBoundingBox(e, new Vec3(0.0D, (double) e.getStepHeight(), 0.0D), - aabb.expandTowards(p_20273_.x, 0.0D, p_20273_.z), e.level, list); + aabb.expandTowards(p_20273_.x, 0.0D, p_20273_.z), e.level(), list); if (vec32.y < (double) e.getStepHeight()) { Vec3 vec33 = - collideBoundingBox(e, new Vec3(p_20273_.x, 0.0D, p_20273_.z), aabb.move(vec32), e.level, list) + collideBoundingBox(e, new Vec3(p_20273_.x, 0.0D, p_20273_.z), aabb.move(vec32), e.level(), list) .add(vec32); if (vec33.horizontalDistanceSqr() > vec31.horizontalDistanceSqr()) { vec31 = vec33; @@ -634,7 +634,7 @@ public class ContraptionCollider { if (vec31.horizontalDistanceSqr() > vec3.horizontalDistanceSqr()) { return vec31.add(collideBoundingBox(e, new Vec3(0.0D, -vec31.y + p_20273_.y, 0.0D), aabb.move(vec31), - e.level, list)); + e.level(), list)); } } @@ -644,7 +644,7 @@ public class ContraptionCollider { private static PlayerType getPlayerType(Entity entity) { if (!(entity instanceof Player)) return PlayerType.NONE; - if (!entity.level.isClientSide) + if (!entity.level().isClientSide) return PlayerType.SERVER; MutableBoolean isClient = new MutableBoolean(false); DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> isClient.setValue(isClientPlayerEntity(entity))); @@ -665,17 +665,17 @@ public class ContraptionCollider { AABB blockScanBB = localBB.inflate(0.5f); blockScanBB = blockScanBB.inflate(horizontalFactor, verticalFactor, horizontalFactor); - BlockPos min = new BlockPos(blockScanBB.minX, blockScanBB.minY, blockScanBB.minZ); - BlockPos max = new BlockPos(blockScanBB.maxX, blockScanBB.maxY, blockScanBB.maxZ); + BlockPos min = BlockPos.containing(blockScanBB.minX, blockScanBB.minY, blockScanBB.minZ); + BlockPos max = BlockPos.containing(blockScanBB.maxX, blockScanBB.maxY, blockScanBB.maxZ); List potentialHits = BlockPos.betweenClosedStream(min, max) .filter(contraption.getBlocks()::containsKey) .filter(Predicates.not(contraption::isHiddenInPortal)) .map(p -> { BlockState blockState = contraption.getBlocks() - .get(p).state; + .get(p).state(); BlockPos pos = contraption.getBlocks() - .get(p).pos; + .get(p).pos(); VoxelShape collisionShape = blockState.getCollisionShape(world, p); return collisionShape.move(pos.getX(), pos.getY(), pos.getZ()); }) @@ -694,7 +694,7 @@ public class ContraptionCollider { TranslatingContraption contraption = (TranslatingContraption) contraptionEntity.getContraption(); AABB bounds = contraptionEntity.getBoundingBox(); Vec3 position = contraptionEntity.position(); - BlockPos gridPos = new BlockPos(position); + BlockPos gridPos = BlockPos.containing(position); if (contraption == null) return false; @@ -734,7 +734,7 @@ public class ContraptionCollider { for (BlockPos colliderPos : contraption.getOrCreateColliders(world, movementDirection)) { colliderPos = colliderPos.offset(gridPos) - .subtract(new BlockPos(otherPosition)); + .subtract(BlockPos.containing(otherPosition)); if (!otherContraption.getBlocks() .containsKey(colliderPos)) continue; @@ -762,7 +762,7 @@ public class ContraptionCollider { if (collidedState.getBlock() instanceof CocoaBlock) continue; - MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(blockInfo.state); + MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(blockInfo.state()); if (movementBehaviour != null) { if (movementBehaviour instanceof BlockBreakingMovementBehaviour) { BlockBreakingMovementBehaviour behaviour = (BlockBreakingMovementBehaviour) movementBehaviour; @@ -784,8 +784,7 @@ public class ContraptionCollider { if (AllBlocks.PULLEY_MAGNET.has(collidedState) && pos.equals(BlockPos.ZERO) && movementDirection == Direction.UP) continue; - if (!collidedState.getMaterial() - .isReplaceable() && !emptyCollider) { + if (!collidedState.canBeReplaced() && !emptyCollider) { return true; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/ContraptionHandlerClient.java b/src/main/java/com/simibubi/create/content/contraptions/ContraptionHandlerClient.java index a80369809..654412af1 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/ContraptionHandlerClient.java +++ b/src/main/java/com/simibubi/create/content/contraptions/ContraptionHandlerClient.java @@ -156,7 +156,7 @@ public class ContraptionHandlerClient { .get(pos); if (blockInfo == null) continue; - BlockState state = blockInfo.state; + BlockState state = blockInfo.state(); VoxelShape raytraceShape = state.getShape(contraption.getContraptionWorld(), BlockPos.ZERO.below()); if (raytraceShape.isEmpty()) continue; diff --git a/src/main/java/com/simibubi/create/content/contraptions/ContraptionMovementSetting.java b/src/main/java/com/simibubi/create/content/contraptions/ContraptionMovementSetting.java index e8fc89990..4d49f8ffb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/ContraptionMovementSetting.java +++ b/src/main/java/com/simibubi/create/content/contraptions/ContraptionMovementSetting.java @@ -39,7 +39,7 @@ public enum ContraptionMovementSetting { } public static boolean allAre(Collection blocks, ContraptionMovementSetting are) { - return blocks.stream().anyMatch(b -> get(b.state.getBlock()) == are); + return blocks.stream().anyMatch(b -> get(b.state().getBlock()) == are); } public static boolean isNoPickup(Collection blocks) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/ContraptionWorld.java b/src/main/java/com/simibubi/create/content/contraptions/ContraptionWorld.java index 171b9e17f..a5b7790f2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/ContraptionWorld.java +++ b/src/main/java/com/simibubi/create/content/contraptions/ContraptionWorld.java @@ -37,7 +37,7 @@ public class ContraptionWorld extends WrappedWorld { StructureTemplate.StructureBlockInfo blockInfo = contraption.getBlocks().get(pos); if (blockInfo != null) - return blockInfo.state; + return blockInfo.state(); return Blocks.AIR.defaultBlockState(); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/ControlledContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/ControlledContraptionEntity.java index a343b6c87..6ce543d15 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/ControlledContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/ControlledContraptionEntity.java @@ -55,7 +55,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { @Override public void setPos(double x, double y, double z) { super.setPos(x, y, z); - if (!level.isClientSide()) + if (!level().isClientSide()) return; for (Entity entity : getPassengers()) positionRider(entity); @@ -125,7 +125,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { public void setAngle(float angle) { this.angle = angle; - if (!level.isClientSide()) + if (!level().isClientSide()) return; for (Entity entity : getPassengers()) positionRider(entity); @@ -157,7 +157,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { if (controllerPos == null) return; - if (!level.isLoaded(controllerPos)) + if (!level().isLoaded(controllerPos)) return; IControlContraption controller = getController(); if (controller == null) { @@ -166,7 +166,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { } if (!controller.isAttachedTo(this)) { controller.attach(this); - if (level.isClientSide) + if (level().isClientSide) setPos(getX(), getY(), getZ()); } } @@ -186,7 +186,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { if (!activeAreaOffset.multiply(VecHelper.axisAlingedPlaneOf(Vec3.atLowerCornerOf(facing.getNormal()))) .equals(Vec3.ZERO)) return false; - if (!VecHelper.onSameAxis(blockInfo.pos, BlockPos.ZERO, facing.getAxis())) + if (!VecHelper.onSameAxis(blockInfo.pos(), BlockPos.ZERO, facing.getAxis())) return false; context.motion = Vec3.atLowerCornerOf(facing.getNormal()) .scale(angleDelta / 360.0); @@ -204,9 +204,9 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { protected IControlContraption getController() { if (controllerPos == null) return null; - if (!level.isLoaded(controllerPos)) + if (!level().isLoaded(controllerPos)) return null; - BlockEntity be = level.getBlockEntity(controllerPos); + BlockEntity be = level().getBlockEntity(controllerPos); if (!(be instanceof IControlContraption)) return null; return (IControlContraption) be; @@ -214,7 +214,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { @Override protected StructureTransform makeStructureTransform() { - BlockPos offset = new BlockPos(getAnchorVec().add(.5, .5, .5)); + BlockPos offset = BlockPos.containing(getAnchorVec().add(.5, .5, .5)); float xRot = rotationAxis == Axis.X ? angle : 0; float yRot = rotationAxis == Axis.Y ? angle : 0; float zRot = rotationAxis == Axis.Z ? angle : 0; diff --git a/src/main/java/com/simibubi/create/content/contraptions/MountedFluidStorage.java b/src/main/java/com/simibubi/create/content/contraptions/MountedFluidStorage.java index 648995587..21f215b40 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/MountedFluidStorage.java +++ b/src/main/java/com/simibubi/create/content/contraptions/MountedFluidStorage.java @@ -14,6 +14,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidTank; @@ -98,7 +99,7 @@ public class MountedFluidStorage { if (blockEntity == null) return; - IFluidHandler teHandler = blockEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + IFluidHandler teHandler = blockEntity.getCapability(ForgeCapabilities.FLUID_HANDLER) .orElse(null); if (!(teHandler instanceof SmartFluidTank)) return; @@ -116,7 +117,7 @@ public class MountedFluidStorage { if (tank instanceof CreativeSmartFluidTank) return; - LazyOptional capability = be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY); + LazyOptional capability = be.getCapability(ForgeCapabilities.FLUID_HANDLER); IFluidHandler teHandler = capability.orElse(null); if (!(teHandler instanceof SmartFluidTank)) return; diff --git a/src/main/java/com/simibubi/create/content/contraptions/MountedStorage.java b/src/main/java/com/simibubi/create/content/contraptions/MountedStorage.java index cf310f026..375a2cfad 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/MountedStorage.java +++ b/src/main/java/com/simibubi/create/content/contraptions/MountedStorage.java @@ -17,8 +17,8 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.ChestBlockEntity; import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity; import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; @@ -51,7 +51,7 @@ public class MountedStorage { return true; try { - LazyOptional capability = be.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY); + LazyOptional capability = be.getCapability(ForgeCapabilities.ITEM_HANDLER); IItemHandler handler = capability.orElse(null); if (handler instanceof ItemStackHandler) return !(handler instanceof ProcessingInventory); @@ -102,7 +102,7 @@ public class MountedStorage { return; } - IItemHandler beHandler = blockEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + IItemHandler beHandler = blockEntity.getCapability(ForgeCapabilities.ITEM_HANDLER) .orElse(dummyHandler); if (beHandler == dummyHandler) return; @@ -156,7 +156,7 @@ public class MountedStorage { return; } - LazyOptional capability = be.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY); + LazyOptional capability = be.getCapability(ForgeCapabilities.ITEM_HANDLER); IItemHandler teHandler = capability.orElse(null); if (!(teHandler instanceof IItemHandlerModifiable)) return; diff --git a/src/main/java/com/simibubi/create/content/contraptions/MountedStorageManager.java b/src/main/java/com/simibubi/create/content/contraptions/MountedStorageManager.java index 240f74575..a433f3d43 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/MountedStorageManager.java +++ b/src/main/java/com/simibubi/create/content/contraptions/MountedStorageManager.java @@ -53,7 +53,7 @@ public class MountedStorageManager { } public void entityTick(AbstractContraptionEntity entity) { - fluidStorage.forEach((pos, mfs) -> mfs.tick(entity, pos, entity.level.isClientSide)); + fluidStorage.forEach((pos, mfs) -> mfs.tick(entity, pos, entity.level().isClientSide)); } public void createHandlers() { @@ -169,14 +169,14 @@ public class MountedStorageManager { } public void addStorageToWorld(StructureBlockInfo block, BlockEntity blockEntity) { - if (storage.containsKey(block.pos)) { - MountedStorage mountedStorage = storage.get(block.pos); + if (storage.containsKey(block.pos())) { + MountedStorage mountedStorage = storage.get(block.pos()); if (mountedStorage.isValid()) mountedStorage.addStorageToWorld(blockEntity); } - if (fluidStorage.containsKey(block.pos)) { - MountedFluidStorage mountedStorage = fluidStorage.get(block.pos); + if (fluidStorage.containsKey(block.pos())) { + MountedFluidStorage mountedStorage = fluidStorage.get(block.pos()); if (mountedStorage.isValid()) mountedStorage.addStorageToWorld(blockEntity); } @@ -214,7 +214,7 @@ public class MountedStorageManager { } public boolean handlePlayerStorageInteraction(Contraption contraption, Player player, BlockPos localPos) { - if (player.level.isClientSide()) { + if (player.level().isClientSide()) { BlockEntity localBE = contraption.presentBlockEntities.get(localPos); return MountedStorage.canUseAsStorage(localBE); } @@ -227,9 +227,9 @@ public class MountedStorageManager { StructureBlockInfo info = contraption.getBlocks() .get(localPos); - if (info != null && info.state.hasProperty(ChestBlock.TYPE)) { - ChestType chestType = info.state.getValue(ChestBlock.TYPE); - Direction facing = info.state.getOptionalValue(ChestBlock.FACING) + if (info != null && info.state().hasProperty(ChestBlock.TYPE)) { + ChestType chestType = info.state().getValue(ChestBlock.TYPE); + Direction facing = info.state().getOptionalValue(ChestBlock.FACING) .orElse(Direction.SOUTH); Direction connectedDirection = chestType == ChestType.LEFT ? facing.getClockWise() : facing.getCounterClockWise(); @@ -250,12 +250,12 @@ public class MountedStorageManager { Supplier stillValid = () -> contraption.entity.isAlive() && player.distanceToSqr(contraption.entity.toGlobalVector(Vec3.atCenterOf(localPos), 0)) < 64; - Component name = info != null ? info.state.getBlock() + Component name = info != null ? info.state().getBlock() .getName() : Components.literal("Container"); player.openMenu(MountedStorageInteraction.createMenuProvider(name, handler, slotCount, stillValid)); Vec3 soundPos = contraption.entity.toGlobalVector(Vec3.atCenterOf(localPos), 0); - player.level.playSound(null, new BlockPos(soundPos), SoundEvents.BARREL_OPEN, SoundSource.BLOCKS, 0.75f, 1f); + player.level().playSound(null, BlockPos.containing(soundPos), SoundEvents.BARREL_OPEN, SoundSource.BLOCKS, 0.75f, 1f); return true; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/OrientedContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/OrientedContraptionEntity.java index 41879519b..beaa25893 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/OrientedContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/OrientedContraptionEntity.java @@ -145,7 +145,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity { @Override public void stopRiding() { - if (!level.isClientSide && isAlive()) + if (!level().isClientSide && isAlive()) disassemble(); super.stopRiding(); } @@ -283,7 +283,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity { LazyOptional capability = riding.getCapability(CapabilityMinecartController.MINECART_CONTROLLER_CAPABILITY); if (capability.isPresent()) { - if (!level.isClientSide()) + if (!level().isClientSide()) capability.orElse(null) .setStalledExternally(isStalled); } else { @@ -298,7 +298,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity { } } - if (level.isClientSide) + if (level().isClientSide) return; if (!isStalled()) { @@ -373,11 +373,11 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity { if (riding instanceof AbstractMinecart) { AbstractMinecart minecartEntity = (AbstractMinecart) riding; BlockPos railPosition = minecartEntity.getCurrentRailPosition(); - BlockState blockState = level.getBlockState(railPosition); + BlockState blockState = level().getBlockState(railPosition); if (blockState.getBlock() instanceof BaseRailBlock) { BaseRailBlock abstractRailBlock = (BaseRailBlock) blockState.getBlock(); RailShape railDirection = - abstractRailBlock.getRailDirection(blockState, level, railPosition, minecartEntity); + abstractRailBlock.getRailDirection(blockState, level(), railPosition, minecartEntity); motion = VecHelper.project(motion, MinecartSim2020.getRailVec(railDirection)); } } @@ -422,12 +422,12 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity { int i = Mth.floor(furnaceCart.getX()); int j = Mth.floor(furnaceCart.getY()); int k = Mth.floor(furnaceCart.getZ()); - if (furnaceCart.level.getBlockState(new BlockPos(i, j - 1, k)) + if (furnaceCart.level().getBlockState(new BlockPos(i, j - 1, k)) .is(BlockTags.RAILS)) --j; BlockPos blockpos = new BlockPos(i, j, k); - BlockState blockstate = this.level.getBlockState(blockpos); + BlockState blockstate = this.level().getBlockState(blockpos); if (furnaceCart.canUseRail() && blockstate.is(BlockTags.RAILS)) if (fuel > 1) riding.setDeltaMovement(riding.getDeltaMovement() @@ -452,11 +452,11 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity { UUID couplingId = getCouplingId(); if (couplingId == null) return null; - MinecartController controller = CapabilityMinecartController.getIfPresent(level, couplingId); + MinecartController controller = CapabilityMinecartController.getIfPresent(level(), couplingId); if (controller == null || !controller.isPresent()) return null; UUID coupledCart = controller.getCoupledCart(true); - MinecartController coupledController = CapabilityMinecartController.getIfPresent(level, coupledCart); + MinecartController coupledController = CapabilityMinecartController.getIfPresent(level(), coupledCart); if (coupledController == null || !coupledController.isPresent()) return null; return Couple.create(controller, coupledController); @@ -505,7 +505,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity { @Override protected StructureTransform makeStructureTransform() { - BlockPos offset = new BlockPos(getAnchorVec().add(.5, .5, .5)); + BlockPos offset = BlockPos.containing(getAnchorVec().add(.5, .5, .5)); return new StructureTransform(offset, 0, -yaw + getInitialYaw(), 0); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/StructureTransform.java b/src/main/java/com/simibubi/create/content/contraptions/StructureTransform.java index 0a36efe85..3c04ed60f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/StructureTransform.java +++ b/src/main/java/com/simibubi/create/content/contraptions/StructureTransform.java @@ -103,7 +103,7 @@ public class StructureTransform { } public BlockPos applyWithoutOffset(BlockPos localPos) { - return new BlockPos(applyWithoutOffset(VecHelper.getCenterOf(localPos))); + return BlockPos.containing(applyWithoutOffset(VecHelper.getCenterOf(localPos))); } public BlockPos apply(BlockPos localPos) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/TrainCollisionPacket.java b/src/main/java/com/simibubi/create/content/contraptions/TrainCollisionPacket.java index 926e89433..fd6b518e2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/TrainCollisionPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/TrainCollisionPacket.java @@ -37,14 +37,14 @@ public class TrainCollisionPacket extends SimplePacketBase { public boolean handle(Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); - Level level = player.level; + Level level = player.level(); Entity entity = level.getEntity(contraptionEntityId); if (!(entity instanceof CarriageContraptionEntity cce)) return; player.hurt(new EntityDamageSource("create.run_over", cce), (int) damage); - player.level.playSound(player, entity.blockPosition(), SoundEvents.PLAYER_ATTACK_CRIT, SoundSource.NEUTRAL, + player.level().playSound(player, entity.blockPosition(), SoundEvents.PLAYER_ATTACK_CRIT, SoundSource.NEUTRAL, 1, .75f); }); return true; diff --git a/src/main/java/com/simibubi/create/content/contraptions/TranslatingContraption.java b/src/main/java/com/simibubi/create/content/contraptions/TranslatingContraption.java index e547f49f7..b6dacd00f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/TranslatingContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/TranslatingContraption.java @@ -27,15 +27,15 @@ public abstract class TranslatingContraption extends Contraption { public Set createColliders(Level world, Direction movementDirection) { Set colliders = new HashSet<>(); for (StructureBlockInfo info : getBlocks().values()) { - BlockPos offsetPos = info.pos.relative(movementDirection); - if (info.state.getCollisionShape(world, offsetPos) + BlockPos offsetPos = info.pos().relative(movementDirection); + if (info.state().getCollisionShape(world, offsetPos) .isEmpty()) continue; if (getBlocks().containsKey(offsetPos) - && !getBlocks().get(offsetPos).state.getCollisionShape(world, offsetPos) + && !getBlocks().get(offsetPos).state().getCollisionShape(world, offsetPos) .isEmpty()) continue; - colliders.add(info.pos); + colliders.add(info.pos()); } return colliders; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/actors/contraptionControls/ContraptionControlsMovingInteraction.java b/src/main/java/com/simibubi/create/content/contraptions/actors/contraptionControls/ContraptionControlsMovingInteraction.java index bbc5cf56f..1eb3de336 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/actors/contraptionControls/ContraptionControlsMovingInteraction.java +++ b/src/main/java/com/simibubi/create/content/contraptions/actors/contraptionControls/ContraptionControlsMovingInteraction.java @@ -21,6 +21,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; import net.minecraft.world.phys.Vec3; import net.minecraftforge.network.PacketDistributor; @@ -40,7 +41,7 @@ public class ContraptionControlsMovingInteraction extends MovingInteractionBehav return false; if (contraption instanceof ElevatorContraption ec) return elevatorInteraction(localPos, contraptionEntity, ec, ctx); - if (contraptionEntity.level.isClientSide()) { + if (contraptionEntity.level().isClientSide()) { if (contraption.presentBlockEntities.get(ctx.localPos) instanceof ContraptionControlsBlockEntity cbe) cbe.pressButton(); return true; @@ -70,7 +71,7 @@ public class ContraptionControlsMovingInteraction extends MovingInteractionBehav if (invert) { for (MutablePair pair : contraption.getActors()) { - MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.left.state); + MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.left.state()); if (behaviour == null) continue; ItemStack behaviourStack = behaviour.canBeDisabledVia(pair.right); @@ -94,8 +95,8 @@ public class ContraptionControlsMovingInteraction extends MovingInteractionBehav ContraptionControlsBlockEntity.sendStatus(player, filter, !disable); send(contraptionEntity, filter, disable); - AllSoundEvents.CONTROLLER_CLICK.play(player.level, null, - new BlockPos(contraptionEntity.toGlobalVector(Vec3.atCenterOf(localPos), 1)), 1, disable ? 0.8f : 1.5f); + AllSoundEvents.CONTROLLER_CLICK.play(player.level(), null, + BlockPos.containing(contraptionEntity.toGlobalVector(Vec3.atCenterOf(localPos), 1)), 1, disable ? 0.8f : 1.5f); return true; } @@ -107,10 +108,11 @@ public class ContraptionControlsMovingInteraction extends MovingInteractionBehav private boolean elevatorInteraction(BlockPos localPos, AbstractContraptionEntity contraptionEntity, ElevatorContraption contraption, MovementContext ctx) { - if (!contraptionEntity.level.isClientSide()) { - BlockPos pos = new BlockPos(contraptionEntity.toGlobalVector(Vec3.atCenterOf(localPos), 1)); - AllSoundEvents.CONTROLLER_CLICK.play(contraptionEntity.level, null, pos, 1, 1.5f); - AllSoundEvents.CONTRAPTION_ASSEMBLE.play(contraptionEntity.level, null, pos, 0.75f, 0.8f); + Level level = contraptionEntity.level(); + if (!level.isClientSide()) { + BlockPos pos = BlockPos.containing(contraptionEntity.toGlobalVector(Vec3.atCenterOf(localPos), 1)); + AllSoundEvents.CONTROLLER_CLICK.play(level, null, pos, 1, 1.5f); + AllSoundEvents.CONTRAPTION_ASSEMBLE.play(level, null, pos, 0.75f, 0.8f); return true; } if (!(ctx.temporaryData instanceof ElevatorFloorSelection efs)) diff --git a/src/main/java/com/simibubi/create/content/contraptions/actors/plough/PloughMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/actors/plough/PloughMovementBehaviour.java index b6bc2d6b9..041352ae5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/actors/plough/PloughMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/actors/plough/PloughMovementBehaviour.java @@ -79,7 +79,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour { if (entity.getDeltaMovement() .length() < 0.25f) return; - entity.level.getEntitiesOfClass(Player.class, new AABB(entity.blockPosition()).inflate(32)) + entity.level().getEntitiesOfClass(Player.class, new AABB(entity.blockPosition()).inflate(32)) .forEach(AllAdvancements.ANVIL_PLOUGH::awardTo); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/actors/psi/PortableStorageInterfaceMovement.java b/src/main/java/com/simibubi/create/content/contraptions/actors/psi/PortableStorageInterfaceMovement.java index 32639dd0d..d27f8c0a2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/actors/psi/PortableStorageInterfaceMovement.java +++ b/src/main/java/com/simibubi/create/content/contraptions/actors/psi/PortableStorageInterfaceMovement.java @@ -78,7 +78,7 @@ public class PortableStorageInterfaceMovement implements MovementBehaviour { return; if (context.world.isClientSide) { - BlockPos pos = new BlockPos(context.position); + BlockPos pos = BlockPos.containing(context.position); if (!findInterface(context, pos)) reset(context); return; diff --git a/src/main/java/com/simibubi/create/content/contraptions/actors/roller/RollerMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/actors/roller/RollerMovementBehaviour.java index a0bf842c2..518f5f810 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/actors/roller/RollerMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/actors/roller/RollerMovementBehaviour.java @@ -200,7 +200,7 @@ public class RollerMovementBehaviour extends BlockBreakingMovementBehaviour { if (profileForTracks != null) { for (Couple coords : profileForTracks.keys()) { float height = profileForTracks.get(coords); - BlockPos targetPosition = new BlockPos(coords.getFirst(), height, coords.getSecond()); + BlockPos targetPosition = BlockPos.containing(coords.getFirst(), height, coords.getSecond()); boolean shouldPlaceSlab = height > Math.floor(height) + .45; if (startingY == 1 && shouldPlaceSlab && context.world.getBlockState(targetPosition.above()) .getOptionalValue(SlabBlock.TYPE) @@ -256,8 +256,8 @@ public class RollerMovementBehaviour extends BlockBreakingMovementBehaviour { Axis axis = Axis.X; StructureBlockInfo info = context.contraption.getBlocks() .get(BlockPos.ZERO); - if (info != null && info.state.hasProperty(StandardBogeyBlock.AXIS)) - axis = info.state.getValue(StandardBogeyBlock.AXIS); + if (info != null && info.state().hasProperty(StandardBogeyBlock.AXIS)) + axis = info.state().getValue(StandardBogeyBlock.AXIS); Direction orientation = cce.getInitialOrientation(); Direction rollerFacing = context.state.getValue(RollerBlock.FACING); @@ -308,7 +308,7 @@ public class RollerMovementBehaviour extends BlockBreakingMovementBehaviour { for (Couple coords : profileForTracks.keys()) { float height = profileForTracks.get(coords); boolean shouldPlaceSlab = height > Math.floor(height) + .45; - BlockPos targetPosition = new BlockPos(coords.getFirst(), height, coords.getSecond()); + BlockPos targetPosition = BlockPos.containing(coords.getFirst(), height, coords.getSecond()); paveSet.add(Pair.of(targetPosition, shouldPlaceSlab)); } @@ -451,8 +451,7 @@ public class RollerMovementBehaviour extends BlockBreakingMovementBehaviour { BlockState existing = level.getBlockState(targetPos); if (existing.is(toPlace.getBlock())) return PaveResult.PASS; - if (!existing.is(BlockTags.LEAVES) && !existing.getMaterial() - .isReplaceable() + if (!existing.is(BlockTags.LEAVES) && !existing.canBeReplaced() && !existing.getCollisionShape(level, targetPos) .isEmpty()) return PaveResult.FAIL; diff --git a/src/main/java/com/simibubi/create/content/contraptions/actors/roller/TrackPaverV2.java b/src/main/java/com/simibubi/create/content/contraptions/actors/roller/TrackPaverV2.java index abcc6fae1..b716d8f25 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/actors/roller/TrackPaverV2.java +++ b/src/main/java/com/simibubi/create/content/contraptions/actors/roller/TrackPaverV2.java @@ -36,7 +36,7 @@ public class TrackPaverV2 { int extent = (int) Math.round((to - from) / direction.length()); double length = edge.getLength(); - BlockPos pos = new BlockPos(edge.getPosition(graph, Mth.clamp(from, 1 / 16f, length - 1 / 16f) / length) + BlockPos pos = BlockPos.containing(edge.getPosition(graph, Mth.clamp(from, 1 / 16f, length - 1 / 16f) / length) .subtract(0, diff.y != 0 ? 1 : 0.5, 0)); paveStraight(task, pos, direction, extent); @@ -69,7 +69,7 @@ public class TrackPaverV2 { Vec3 targetVec = mainPos.add(mainNormal.scale(flip * (int) (currentOffset / 2.0))); if (!isDiagonalTrack) { - toPlaceOn.add(new BlockPos(targetVec)); + toPlaceOn.add(BlockPos.containing(targetVec)); continue; } @@ -82,14 +82,14 @@ public class TrackPaverV2 { .add(mainNormal.normalize() .scale(flip)) .scale(.5); - toPlaceOn.add(new BlockPos(targetVec.add(sideOffset))); + toPlaceOn.add(BlockPos.containing(targetVec.add(sideOffset))); } } if (placeRow) { if (Math.abs(currentOffset % 2) == 1) targetVec = mainPos.add(mainNormal.scale(flip * (int) ((currentOffset + 1) / 2.0))); - toPlaceOn.add(new BlockPos(targetVec)); + toPlaceOn.add(BlockPos.containing(targetVec)); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/actors/seat/SeatBlock.java b/src/main/java/com/simibubi/create/content/contraptions/actors/seat/SeatBlock.java index 40ba7291c..6ead33bfa 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/actors/seat/SeatBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/actors/seat/SeatBlock.java @@ -84,7 +84,7 @@ public class SeatBlock extends Block implements ProperWaterloggedBlock { public void updateEntityAfterFallOn(BlockGetter reader, Entity entity) { BlockPos pos = entity.blockPosition(); if (entity instanceof Player || !(entity instanceof LivingEntity) || !canBePickedUp(entity) - || isSeatOccupied(entity.level, pos)) { + || isSeatOccupied(entity.level(), pos)) { if (entity.isSuppressingBounce()) { super.updateEntityAfterFallOn(reader, entity); return; @@ -101,7 +101,7 @@ public class SeatBlock extends Block implements ProperWaterloggedBlock { if (reader.getBlockState(pos) .getBlock() != this) return; - sitDown(entity.level, pos, entity); + sitDown(entity.level(), pos, entity); } @Override @@ -165,7 +165,7 @@ public class SeatBlock extends Block implements ProperWaterloggedBlock { } public static Optional getLeashed(Level level, Player player) { - List entities = player.level.getEntities((Entity) null, player.getBoundingBox() + List entities = player.level().getEntities((Entity) null, player.getBoundingBox() .inflate(10), e -> true); for (Entity e : entities) if (e instanceof Mob mob && mob.getLeashHolder() == player && SeatBlock.canBePickedUp(e)) diff --git a/src/main/java/com/simibubi/create/content/contraptions/actors/seat/SeatEntity.java b/src/main/java/com/simibubi/create/content/contraptions/actors/seat/SeatEntity.java index d7cd7df0d..b95b5733a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/actors/seat/SeatEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/actors/seat/SeatEntity.java @@ -85,9 +85,9 @@ public class SeatEntity extends Entity implements IEntityAdditionalSpawnData { @Override public void tick() { - if (level.isClientSide) + if (level().isClientSide) return; - boolean blockPresent = level.getBlockState(blockPosition()) + boolean blockPresent = level().getBlockState(blockPosition()) .getBlock() instanceof SeatBlock; if (isVehicle() && blockPresent) return; diff --git a/src/main/java/com/simibubi/create/content/contraptions/actors/trainControls/ControlsInteractionBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/actors/trainControls/ControlsInteractionBehaviour.java index 726eb424a..c513097a5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/actors/trainControls/ControlsInteractionBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/actors/trainControls/ControlsInteractionBehaviour.java @@ -34,7 +34,7 @@ public class ControlsInteractionBehaviour extends MovingInteractionBehaviour { return false; contraptionEntity.setControllingPlayer(player.getUUID()); - if (player.level.isClientSide) + if (player.level().isClientSide) DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> ControlsHandler.startControlling(contraptionEntity, localPos)); return true; diff --git a/src/main/java/com/simibubi/create/content/contraptions/actors/trainControls/ControlsMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/actors/trainControls/ControlsMovementBehaviour.java index 895a6979c..bc8504892 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/actors/trainControls/ControlsMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/actors/trainControls/ControlsMovementBehaviour.java @@ -68,8 +68,8 @@ public class ControlsMovementBehaviour implements MovementBehaviour { Direction initialOrientation = cce.getInitialOrientation() .getCounterClockWise(); boolean inverted = false; - if (info != null && info.state.hasProperty(ControlsBlock.FACING)) - inverted = !info.state.getValue(ControlsBlock.FACING) + if (info != null && info.state().hasProperty(ControlsBlock.FACING)) + inverted = !info.state().getValue(ControlsBlock.FACING) .equals(initialOrientation); if (ControlsHandler.getContraption() == entity && ControlsHandler.getControlsPos() != null diff --git a/src/main/java/com/simibubi/create/content/contraptions/bearing/BearingContraption.java b/src/main/java/com/simibubi/create/content/contraptions/bearing/BearingContraption.java index 2b36c5808..37d35bd26 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/bearing/BearingContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/bearing/BearingContraption.java @@ -68,7 +68,7 @@ public class BearingContraption extends Contraption { } private BlockState getSailBlock(Pair capture) { - BlockState state = capture.getKey().state; + BlockState state = capture.getKey().state(); if (AllBlocks.COPYCAT_PANEL.has(state) && capture.getRight() instanceof CopycatBlockEntity cbe) return cbe.getMaterial(); return state; diff --git a/src/main/java/com/simibubi/create/content/contraptions/bearing/MechanicalBearingBlockEntity.java b/src/main/java/com/simibubi/create/content/contraptions/bearing/MechanicalBearingBlockEntity.java index 98d1fc40b..6c06a7ec5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/bearing/MechanicalBearingBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/bearing/MechanicalBearingBlockEntity.java @@ -342,8 +342,7 @@ public class MechanicalBearingBlockEntity extends GeneratingKineticBlockEntity return false; BlockState attachedState = level.getBlockState(worldPosition.relative(state.getValue(BearingBlock.FACING))); - if (attachedState.getMaterial() - .isReplaceable()) + if (attachedState.canBeReplaced()) return false; TooltipHelper.addHint(tooltip, "hint.empty_bearing"); return true; diff --git a/src/main/java/com/simibubi/create/content/contraptions/bearing/SailBlock.java b/src/main/java/com/simibubi/create/content/contraptions/bearing/SailBlock.java index 334e29a46..a7096b4a2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/bearing/SailBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/bearing/SailBlock.java @@ -247,8 +247,7 @@ public class SailBlock extends WrenchableDirectionalBlock { state.getValue(SailBlock.FACING) .getAxis(), dir -> world.getBlockState(pos.relative(dir)) - .getMaterial() - .isReplaceable()); + .canBeReplaced()); if (directions.isEmpty()) return PlacementOffset.fail(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/behaviour/BellMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/behaviour/BellMovementBehaviour.java index 367d06ffc..55987d46e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/behaviour/BellMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/behaviour/BellMovementBehaviour.java @@ -38,7 +38,7 @@ public class BellMovementBehaviour implements MovementBehaviour { public static void playSound(MovementContext context) { Level world = context.world; - BlockPos pos = new BlockPos(context.position); + BlockPos pos = BlockPos.containing(context.position); Block block = context.state.getBlock(); if (block instanceof AbstractBellBlock) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/behaviour/DoorMovingInteraction.java b/src/main/java/com/simibubi/create/content/contraptions/behaviour/DoorMovingInteraction.java index d58c0d129..c4132ba4b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/behaviour/DoorMovingInteraction.java +++ b/src/main/java/com/simibubi/create/content/contraptions/behaviour/DoorMovingInteraction.java @@ -29,9 +29,9 @@ public class DoorMovingInteraction extends SimpleBlockMovingInteraction { BlockPos otherPos = currentState.getValue(DoorBlock.HALF) == DoubleBlockHalf.LOWER ? pos.above() : pos.below(); StructureBlockInfo info = contraption.getBlocks() .get(otherPos); - if (info.state.hasProperty(DoorBlock.OPEN)) { - BlockState newState = info.state.cycle(DoorBlock.OPEN); - setContraptionBlockData(contraption.entity, otherPos, new StructureBlockInfo(info.pos, newState, info.nbt)); + if (info.state().hasProperty(DoorBlock.OPEN)) { + BlockState newState = info.state().cycle(DoorBlock.OPEN); + setContraptionBlockData(contraption.entity, otherPos, new StructureBlockInfo(info.pos(), newState, info.nbt())); } currentState = currentState.cycle(DoorBlock.OPEN); @@ -45,11 +45,11 @@ public class DoorMovingInteraction extends SimpleBlockMovingInteraction { pos.relative(hinge == DoorHingeSide.LEFT ? facing.getClockWise() : facing.getCounterClockWise()); StructureBlockInfo doubleInfo = contraption.getBlocks() .get(doublePos); - if (doubleInfo != null && SlidingDoorBlock.isDoubleDoor(currentState, hinge, facing, doubleInfo.state)) + if (doubleInfo != null && SlidingDoorBlock.isDoubleDoor(currentState, hinge, facing, doubleInfo.state())) handlePlayerInteraction(null, InteractionHand.MAIN_HAND, doublePos, contraption.entity); } - float pitch = player.level.random.nextFloat() * 0.1F + 0.9F; + float pitch = player.level().random.nextFloat() * 0.1F + 0.9F; if (sound != null) playSound(player, sound, pitch); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/behaviour/MovementContext.java b/src/main/java/com/simibubi/create/content/contraptions/behaviour/MovementContext.java index b5ff9ee76..7a9185ba1 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/behaviour/MovementContext.java +++ b/src/main/java/com/simibubi/create/content/contraptions/behaviour/MovementContext.java @@ -34,10 +34,10 @@ public class MovementContext { public MovementContext(Level world, StructureBlockInfo info, Contraption contraption) { this.world = world; - this.state = info.state; - this.blockEntityData = info.nbt; + this.state = info.state(); + this.blockEntityData = info.nbt(); this.contraption = contraption; - localPos = info.pos; + localPos = info.pos(); disabled = false; firstMovement = true; diff --git a/src/main/java/com/simibubi/create/content/contraptions/behaviour/MovingInteractionBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/behaviour/MovingInteractionBehaviour.java index b6b2d698c..1d0cd6ddb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/behaviour/MovingInteractionBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/behaviour/MovingInteractionBehaviour.java @@ -16,13 +16,13 @@ public abstract class MovingInteractionBehaviour { StructureBlockInfo info, MovementContext ctx) { contraptionEntity.getContraption().getActors().remove(index); contraptionEntity.getContraption().getActors().add(index, MutablePair.of(info, ctx)); - if (contraptionEntity.level.isClientSide) + if (contraptionEntity.level().isClientSide) contraptionEntity.getContraption().deferInvalidate = true; } protected void setContraptionBlockData(AbstractContraptionEntity contraptionEntity, BlockPos pos, StructureBlockInfo info) { - if (contraptionEntity.level.isClientSide()) + if (contraptionEntity.level().isClientSide()) return; contraptionEntity.setBlock(pos, info); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/behaviour/SimpleBlockMovingInteraction.java b/src/main/java/com/simibubi/create/content/contraptions/behaviour/SimpleBlockMovingInteraction.java index 69de088b2..d3a579e1d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/behaviour/SimpleBlockMovingInteraction.java +++ b/src/main/java/com/simibubi/create/content/contraptions/behaviour/SimpleBlockMovingInteraction.java @@ -20,11 +20,11 @@ public abstract class SimpleBlockMovingInteraction extends MovingInteractionBeha StructureBlockInfo info = contraption.getBlocks() .get(localPos); - BlockState newState = handle(player, contraption, localPos, info.state); - if (info.state == newState) + BlockState newState = handle(player, contraption, localPos, info.state()); + if (info.state() == newState) return false; - setContraptionBlockData(contraptionEntity, localPos, new StructureBlockInfo(info.pos, newState, info.nbt)); + setContraptionBlockData(contraptionEntity, localPos, new StructureBlockInfo(info.pos(), newState, info.nbt())); if (updateColliders()) contraption.invalidateColliders(); return true; @@ -35,7 +35,7 @@ public abstract class SimpleBlockMovingInteraction extends MovingInteractionBeha } protected void playSound(Player player, SoundEvent sound, float pitch) { - player.level.playSound(player, player.blockPosition(), sound, SoundSource.BLOCKS, 0.3f, pitch); + player.level().playSound(player, player.blockPosition(), sound, SoundSource.BLOCKS, 0.3f, pitch); } protected abstract BlockState handle(Player player, Contraption contraption, BlockPos pos, diff --git a/src/main/java/com/simibubi/create/content/contraptions/behaviour/TrapdoorMovingInteraction.java b/src/main/java/com/simibubi/create/content/contraptions/behaviour/TrapdoorMovingInteraction.java index 226dcfa2e..374abc100 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/behaviour/TrapdoorMovingInteraction.java +++ b/src/main/java/com/simibubi/create/content/contraptions/behaviour/TrapdoorMovingInteraction.java @@ -15,7 +15,7 @@ public class TrapdoorMovingInteraction extends SimpleBlockMovingInteraction { protected BlockState handle(Player player, Contraption contraption, BlockPos pos, BlockState currentState) { SoundEvent sound = currentState.getValue(TrapDoorBlock.OPEN) ? SoundEvents.WOODEN_TRAPDOOR_CLOSE : SoundEvents.WOODEN_TRAPDOOR_OPEN; - float pitch = player.level.random.nextFloat() * 0.1F + 0.9F; + float pitch = player.level().random.nextFloat() * 0.1F + 0.9F; playSound(player, sound, pitch); return currentState.cycle(TrapDoorBlock.OPEN); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorContraption.java b/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorContraption.java index d1c1df426..1f45d19e1 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorContraption.java @@ -62,7 +62,7 @@ public class ElevatorContraption extends PulleyContraption { return; ColumnCoords coords = getGlobalColumn(); - ElevatorColumn column = ElevatorColumn.get(entity.level, coords); + ElevatorColumn column = ElevatorColumn.get(entity.level(), coords); if (column == null) return; diff --git a/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorControlsHandler.java b/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorControlsHandler.java index ed99e353b..4fcbcabbd 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorControlsHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorControlsHandler.java @@ -91,10 +91,10 @@ public class ElevatorControlsHandler { if (info == null) continue; - if (!AllBlocks.CONTRAPTION_CONTROLS.has(info.state)) + if (!AllBlocks.CONTRAPTION_CONTROLS.has(info.state())) continue; - if (!slot.testHit(info.state, rayTraceResult.getLocation() + if (!slot.testHit(info.state(), rayTraceResult.getLocation() .subtract(Vec3.atLowerCornerOf(pos)))) continue; @@ -117,8 +117,8 @@ public class ElevatorControlsHandler { if (prev != efs.currentIndex && !ec.namesList.isEmpty()) { float pitch = (efs.currentIndex) / (float) (ec.namesList.size()); pitch = Mth.lerp(pitch, 1f, 1.5f); - AllSoundEvents.SCROLL_VALUE.play(mc.player.level, mc.player, - new BlockPos(contraptionEntity.toGlobalVector(rayTraceResult.getLocation(), 1)), 1, pitch); + AllSoundEvents.SCROLL_VALUE.play(mc.player.level(), mc.player, + BlockPos.containing(contraptionEntity.toGlobalVector(rayTraceResult.getLocation(), 1)), 1, pitch); } return true; diff --git a/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorFloorListPacket.java b/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorFloorListPacket.java index fac96cced..f978fa062 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorFloorListPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorFloorListPacket.java @@ -81,7 +81,7 @@ public class ElevatorFloorListPacket extends SimplePacketBase { public boolean handle(Context context) { context.enqueueWork(() -> { ServerPlayer sender = context.getSender(); - Entity entityByID = sender.getLevel() + Entity entityByID = sender.level() .getEntity(entityId); if (!(entityByID instanceof AbstractContraptionEntity ace)) return; diff --git a/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorPulleyBlockEntity.java b/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorPulleyBlockEntity.java index faa722ffd..f13f48459 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorPulleyBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorPulleyBlockEntity.java @@ -246,8 +246,7 @@ public class ElevatorPulleyBlockEntity extends PulleyBlockEntity { BlockState ropeState = level.getBlockState(ropePos); if (!ropeState.getCollisionShape(level, ropePos) .isEmpty() - && !ropeState.getMaterial() - .isReplaceable()) { + && !ropeState.canBeReplaced()) { break; } ++i; diff --git a/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorTargetFloorPacket.java b/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorTargetFloorPacket.java index 1e6ec3afc..2e54d8a63 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorTargetFloorPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorTargetFloorPacket.java @@ -36,7 +36,7 @@ public class ElevatorTargetFloorPacket extends SimplePacketBase { public boolean handle(Context context) { context.enqueueWork(() -> { ServerPlayer sender = context.getSender(); - Entity entityByID = sender.getLevel() + Entity entityByID = sender.serverLevel() .getEntity(entityId); if (!(entityByID instanceof AbstractContraptionEntity ace)) return; @@ -45,7 +45,7 @@ public class ElevatorTargetFloorPacket extends SimplePacketBase { if (ace.distanceToSqr(sender) > 50 * 50) return; - Level level = sender.level; + Level level = sender.level(); ElevatorColumn elevatorColumn = ElevatorColumn.get(level, ec.getGlobalColumn()); if (!elevatorColumn.contacts.contains(targetY)) return; diff --git a/src/main/java/com/simibubi/create/content/contraptions/gantry/GantryContraption.java b/src/main/java/com/simibubi/create/content/contraptions/gantry/GantryContraption.java index 5b66790d9..5ec56c80e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/gantry/GantryContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/gantry/GantryContraption.java @@ -62,7 +62,7 @@ public class GantryContraption extends TranslatingContraption { @Override protected boolean shouldUpdateAfterMovement(StructureBlockInfo info) { - return super.shouldUpdateAfterMovement(info) && !AllBlocks.GANTRY_CARRIAGE.has(info.state); + return super.shouldUpdateAfterMovement(info) && !AllBlocks.GANTRY_CARRIAGE.has(info.state()); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/gantry/GantryContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/gantry/GantryContraptionEntity.java index 36e18726b..08c326bd8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/gantry/GantryContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/gantry/GantryContraptionEntity.java @@ -59,7 +59,7 @@ public class GantryContraptionEntity extends AbstractContraptionEntity { return; double prevAxisMotion = axisMotion; - if (level.isClientSide) { + if (level().isClientSide) { clientOffsetDiff *= .75f; updateClientMotion(); } @@ -69,7 +69,7 @@ public class GantryContraptionEntity extends AbstractContraptionEntity { Vec3 movementVec = getDeltaMovement(); if (ContraptionCollider.collideBlocks(this)) { - if (!level.isClientSide) + if (!level().isClientSide) disassemble(); return; } @@ -83,8 +83,8 @@ public class GantryContraptionEntity extends AbstractContraptionEntity { } if (Math.signum(prevAxisMotion) != Math.signum(axisMotion) && prevAxisMotion != 0) - contraption.stop(level); - if (!level.isClientSide && (prevAxisMotion != axisMotion || tickCount % 3 == 0)) + contraption.stop(level()); + if (!level().isClientSide && (prevAxisMotion != axisMotion || tickCount % 3 == 0)) sendPacket(); } @@ -98,11 +98,11 @@ public class GantryContraptionEntity extends AbstractContraptionEntity { Vec3 movementVec; Direction facing = ((GantryContraption) contraption).getFacing(); Vec3 currentPosition = getAnchorVec().add(.5, .5, .5); - BlockPos gantryShaftPos = new BlockPos(currentPosition).relative(facing.getOpposite()); + BlockPos gantryShaftPos = BlockPos.containing(currentPosition).relative(facing.getOpposite()); - BlockEntity be = level.getBlockEntity(gantryShaftPos); + BlockEntity be = level().getBlockEntity(gantryShaftPos); if (!(be instanceof GantryShaftBlockEntity) || !AllBlocks.GANTRY_SHAFT.has(be.getBlockState())) { - if (!level.isClientSide) { + if (!level().isClientSide) { setContraptionMotion(Vec3.ZERO); disassemble(); } @@ -116,7 +116,7 @@ public class GantryContraptionEntity extends AbstractContraptionEntity { float pinionMovementSpeed = gantryShaftBlockEntity.getPinionMovementSpeed(); if (blockState.getValue(GantryShaftBlock.POWERED) || pinionMovementSpeed == 0) { setContraptionMotion(Vec3.ZERO); - if (!level.isClientSide) + if (!level().isClientSide) disassemble(); return; } @@ -136,12 +136,12 @@ public class GantryContraptionEntity extends AbstractContraptionEntity { .getStep() < 0))) if (!gantryShaftBlockEntity.canAssembleOn()) { setContraptionMotion(Vec3.ZERO); - if (!level.isClientSide) + if (!level().isClientSide) disassemble(); return; } - if (level.isClientSide) + if (level().isClientSide) return; axisMotion = pinionMovementSpeed; @@ -175,7 +175,7 @@ public class GantryContraptionEntity extends AbstractContraptionEntity { @Override protected StructureTransform makeStructureTransform() { - return new StructureTransform(new BlockPos(getAnchorVec().add(.5, .5, .5)), 0, 0, 0); + return new StructureTransform(BlockPos.containing(getAnchorVec().add(.5, .5, .5)), 0, 0, 0); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueEntity.java b/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueEntity.java index 5c7c036ad..6b3bdd5b5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueEntity.java @@ -178,13 +178,13 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat @Override public void move(MoverType typeIn, Vec3 pos) { - if (!level.isClientSide && isAlive() && pos.lengthSqr() > 0.0D) + if (!level().isClientSide && isAlive() && pos.lengthSqr() > 0.0D) discard(); } @Override public void push(double x, double y, double z) { - if (!level.isClientSide && isAlive() && x * x + y * y + z * z > 0.0D) + if (!level().isClientSide && isAlive() && x * x + y * y + z * z > 0.0D) discard(); } @@ -307,7 +307,7 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat Vec3 origin = new Vec3(bb.minX, bb.minY, bb.minZ); Vec3 extents = new Vec3(bb.getXsize(), bb.getYsize(), bb.getZsize()); - if (!(level instanceof ServerLevel slevel)) + if (!(level() instanceof ServerLevel slevel)) return; for (Axis axis : Iterate.axes) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueHandler.java b/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueHandler.java index 87f060847..d0ed27927 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueHandler.java @@ -49,7 +49,7 @@ public class SuperGlueHandler { for (Direction direction : Iterate.directions) { BlockPos relative = pos.relative(direction); if (SuperGlueEntity.isGlued(world, pos, direction, cached) - && BlockMovementChecks.isMovementNecessary(world.getBlockState(relative), entity.level, relative)) + && BlockMovementChecks.isMovementNecessary(world.getBlockState(relative), entity.level(), relative)) AllPackets.getChannel().send(PacketDistributor.TRACKING_ENTITY_AND_SELF.with(() -> entity), new GlueEffectPacket(pos, direction, true)); } @@ -60,7 +60,7 @@ public class SuperGlueHandler { public static void glueInOffHandAppliesOnBlockPlace(EntityPlaceEvent event, BlockPos pos, Player placer) { ItemStack itemstack = placer.getOffhandItem(); - AttributeInstance reachAttribute = placer.getAttribute(ForgeMod.REACH_DISTANCE.get()); + AttributeInstance reachAttribute = placer.getAttribute(ForgeMod.BLOCK_REACH.get()); if (!AllItems.SUPER_GLUE.isIn(itemstack) || reachAttribute == null) return; if (AllItems.WRENCH.isIn(placer.getMainHandItem())) @@ -72,7 +72,7 @@ public class SuperGlueHandler { Vec3 start = placer.getEyePosition(1); Vec3 look = placer.getViewVector(1); Vec3 end = start.add(look.x * distance, look.y * distance, look.z * distance); - Level world = placer.level; + Level world = placer.level(); RayTraceWorld rayTraceWorld = new RayTraceWorld(world, (p, state) -> p.equals(pos) ? Blocks.AIR.defaultBlockState() : state); diff --git a/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueRemovalPacket.java b/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueRemovalPacket.java index 2611c5cf0..b11bbdad7 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueRemovalPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueRemovalPacket.java @@ -34,13 +34,13 @@ public class SuperGlueRemovalPacket extends SimplePacketBase { public boolean handle(Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); - Entity entity = player.level.getEntity(entityId); + Entity entity = player.level().getEntity(entityId); if (!(entity instanceof SuperGlueEntity superGlue)) return; double range = 32; if (player.distanceToSqr(superGlue.position()) > range * range) return; - AllSoundEvents.SLIME_ADDED.play(player.level, null, soundSource, 0.5F, 0.5F); + AllSoundEvents.SLIME_ADDED.play(player.level(), null, soundSource, 0.5F, 0.5F); superGlue.spawnParticles(); entity.discard(); }); diff --git a/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueSelectionHandler.java b/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueSelectionHandler.java index 13ba07060..4a5a955e9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueSelectionHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueSelectionHandler.java @@ -74,7 +74,7 @@ public class SuperGlueSelectionHandler { selected = null; if (firstPos == null) { - double range = player.getAttribute(ForgeMod.REACH_DISTANCE.get()) + double range = player.getAttribute(ForgeMod.BLOCK_REACH.get()) .getValue() + 1; Vec3 traceOrigin = RaycastHelper.getTraceOrigin(player); Vec3 traceTarget = RaycastHelper.getTraceTarget(player, range, traceOrigin); @@ -90,7 +90,7 @@ public class SuperGlueSelectionHandler { if (distanceToSqr > bestDistance) continue; selected = glueEntity; - soundSourceForRemoval = new BlockPos(vec3); + soundSourceForRemoval = BlockPos.containing(vec3); bestDistance = distanceToSqr; } @@ -252,8 +252,8 @@ public class SuperGlueSelectionHandler { public void confirm() { LocalPlayer player = Minecraft.getInstance().player; AllPackets.getChannel().sendToServer(new SuperGlueSelectionPacket(firstPos, hoveredPos)); - AllSoundEvents.SLIME_ADDED.playAt(player.level, hoveredPos, 0.5F, 0.95F, false); - player.level.playSound(player, hoveredPos, SoundEvents.ITEM_FRAME_ADD_ITEM, SoundSource.BLOCKS, 0.75f, 1); + AllSoundEvents.SLIME_ADDED.playAt(player.level(), hoveredPos, 0.5F, 0.95F, false); + player.level().playSound(player, hoveredPos, SoundEvents.ITEM_FRAME_ADD_ITEM, SoundSource.BLOCKS, 0.75f, 1); if (currentCluster != null) CreateClient.OUTLINER.showCluster(clusterOutlineSlot, currentCluster) diff --git a/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueSelectionPacket.java b/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueSelectionPacket.java index b1c3713fa..eb253d9e1 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueSelectionPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueSelectionPacket.java @@ -39,14 +39,14 @@ public class SuperGlueSelectionPacket extends SimplePacketBase { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); - double range = player.getAttribute(ForgeMod.REACH_DISTANCE.get()) + double range = player.getAttribute(ForgeMod.BLOCK_REACH.get()) .getValue() + 2; if (player.distanceToSqr(Vec3.atCenterOf(to)) > range * range) return; if (!to.closerThan(from, 25)) return; - Set group = SuperGlueSelectionHelper.searchGlueGroup(player.level, from, to, false); + Set group = SuperGlueSelectionHelper.searchGlueGroup(player.level(), from, to, false); if (group == null) return; if (!group.contains(to)) @@ -56,8 +56,8 @@ public class SuperGlueSelectionPacket extends SimplePacketBase { AABB bb = SuperGlueEntity.span(from, to); SuperGlueSelectionHelper.collectGlueFromInventory(player, 1, false); - SuperGlueEntity entity = new SuperGlueEntity(player.level, bb); - player.level.addFreshEntity(entity); + SuperGlueEntity entity = new SuperGlueEntity(player.level(), bb); + player.level().addFreshEntity(entity); entity.spawnParticles(); AllAdvancements.SUPER_GLUE.awardTo(player); diff --git a/src/main/java/com/simibubi/create/content/contraptions/minecart/CouplingCreationPacket.java b/src/main/java/com/simibubi/create/content/contraptions/minecart/CouplingCreationPacket.java index 4e2889232..cf93f8f57 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/minecart/CouplingCreationPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/minecart/CouplingCreationPacket.java @@ -32,7 +32,7 @@ public class CouplingCreationPacket extends SimplePacketBase { context.enqueueWork(() -> { ServerPlayer sender = context.getSender(); if (sender != null) - CouplingHandler.tryToCoupleCarts(sender, sender.level, id1, id2); + CouplingHandler.tryToCoupleCarts(sender, sender.level(), id1, id2); }); return true; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/minecart/CouplingPhysics.java b/src/main/java/com/simibubi/create/content/contraptions/minecart/CouplingPhysics.java index 6031c7ea2..44ad6fb59 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/minecart/CouplingPhysics.java +++ b/src/main/java/com/simibubi/create/content/contraptions/minecart/CouplingPhysics.java @@ -105,7 +105,7 @@ public class CouplingPhysics { int y = Mth.floor(vec.y()); int z = Mth.floor(vec.z()); BlockPos pos = new BlockPos(x, y - 1, z); - if (minecart.level.getBlockState(pos).is(BlockTags.RAILS)) pos = pos.below(); + if (minecart.level().getBlockState(pos).is(BlockTags.RAILS)) pos = pos.below(); BlockPos railPosition = pos; BlockState railState = world.getBlockState(railPosition.above()); if (!(railState.getBlock() instanceof BaseRailBlock)) diff --git a/src/main/java/com/simibubi/create/content/contraptions/minecart/CouplingRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/minecart/CouplingRenderer.java index bb71ac3f2..da2dc0e5d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/minecart/CouplingRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/minecart/CouplingRenderer.java @@ -51,8 +51,9 @@ public class CouplingRenderer { if (carts.getFirst() == null || carts.getSecond() == null) return; - Couple lightValues = carts.map(c -> LevelRenderer.getLightColor(world, new BlockPos(c.getBoundingBox() - .getCenter()))); + Couple lightValues = + carts.map(c -> LevelRenderer.getLightColor(world, BlockPos.containing(c.getBoundingBox() + .getCenter()))); Vec3 center = carts.getFirst() .position() diff --git a/src/main/java/com/simibubi/create/content/contraptions/minecart/MinecartSim2020.java b/src/main/java/com/simibubi/create/content/contraptions/minecart/MinecartSim2020.java index f10eab8f7..8b232476a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/minecart/MinecartSim2020.java +++ b/src/main/java/com/simibubi/create/content/contraptions/minecart/MinecartSim2020.java @@ -83,7 +83,7 @@ public class MinecartSim2020 { actualY = cartPos.getY() + 1; BaseRailBlock abstractrailblock = (BaseRailBlock) trackState.getBlock(); - RailShape railshape = abstractrailblock.getRailDirection(trackState, cart.level, cartPos, cart); + RailShape railshape = abstractrailblock.getRailDirection(trackState, cart.level(), cartPos, cart); switch (railshape) { case ASCENDING_EAST: forcedMovement = forcedMovement.add(-1 * cart.getSlopeAdjustment(), 0.0D, 0.0D); diff --git a/src/main/java/com/simibubi/create/content/contraptions/minecart/capability/MinecartController.java b/src/main/java/com/simibubi/create/content/contraptions/minecart/capability/MinecartController.java index 77677dfdb..ec7e27e9c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/minecart/capability/MinecartController.java +++ b/src/main/java/com/simibubi/create/content/contraptions/minecart/capability/MinecartController.java @@ -99,7 +99,7 @@ public class MinecartController implements INBTSerializable { if (passengers.isEmpty() || !(passengers.get(0) instanceof AbstractContraptionEntity)) { return; } - Level world = cart.level; + Level world = cart.level(); int i = Mth.floor(cart.getX()); int j = Mth.floor(cart.getY()); int k = Mth.floor(cart.getZ()); diff --git a/src/main/java/com/simibubi/create/content/contraptions/mounted/MinecartContraptionItem.java b/src/main/java/com/simibubi/create/content/contraptions/mounted/MinecartContraptionItem.java index 8574efbc7..431cf4f48 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/mounted/MinecartContraptionItem.java +++ b/src/main/java/com/simibubi/create/content/contraptions/mounted/MinecartContraptionItem.java @@ -44,7 +44,6 @@ import net.minecraft.world.level.block.DispenserBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.RailShape; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; -import net.minecraft.world.level.material.Material; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @@ -103,7 +102,7 @@ public class MinecartContraptionItem extends Item { d3 = 0.1D; } } else { - if (blockstate.getMaterial() != Material.AIR || !world.getBlockState(blockpos.below()) + if (!blockstate.isAir() || !world.getBlockState(blockpos.below()) .is(BlockTags.RAILS)) { return this.behaviourDefaultDispenseItem.dispense(source, stack); } @@ -244,7 +243,7 @@ public class MinecartContraptionItem extends Item { contraption.stop(event.getLevel()); for (MutablePair pair : contraption.getActors()) - if (AllMovementBehaviours.getBehaviour(pair.left.state)instanceof PortableStorageInterfaceMovement psim) + if (AllMovementBehaviours.getBehaviour(pair.left.state())instanceof PortableStorageInterfaceMovement psim) psim.reset(pair.right); ItemStack generatedStack = create(type, oce).setHoverName(entity.getCustomName()); diff --git a/src/main/java/com/simibubi/create/content/contraptions/mounted/MountedContraption.java b/src/main/java/com/simibubi/create/content/contraptions/mounted/MountedContraption.java index 87c5a9232..620b47097 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/mounted/MountedContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/mounted/MountedContraption.java @@ -83,11 +83,11 @@ public class MountedContraption extends Contraption { protected Pair capture(Level world, BlockPos pos) { Pair pair = super.capture(world, pos); StructureBlockInfo capture = pair.getKey(); - if (!AllBlocks.CART_ASSEMBLER.has(capture.state)) + if (!AllBlocks.CART_ASSEMBLER.has(capture.state())) return pair; Pair anchorSwap = - Pair.of(new StructureBlockInfo(pos, CartAssemblerBlock.createAnchor(capture.state), null), pair.getValue()); + Pair.of(new StructureBlockInfo(pos, CartAssemblerBlock.createAnchor(capture.state()), null), pair.getValue()); if (pos.equals(anchor) || connectedCart != null) return anchorSwap; diff --git a/src/main/java/com/simibubi/create/content/contraptions/piston/PistonContraption.java b/src/main/java/com/simibubi/create/content/contraptions/piston/PistonContraption.java index 4f435fc32..859cf4064 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/piston/PistonContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/piston/PistonContraption.java @@ -139,9 +139,9 @@ public class PistonContraption extends TranslatingContraption { bounds = new AABB(0, 0, 0, 0, 0, 0); for (StructureBlockInfo pole : poles) { - BlockPos relPos = pole.pos.relative(direction, -extensionsInFront); + BlockPos relPos = pole.pos().relative(direction, -extensionsInFront); BlockPos localPos = relPos.subtract(anchor); - getBlocks().put(localPos, new StructureBlockInfo(localPos, pole.state, null)); + getBlocks().put(localPos, new StructureBlockInfo(localPos, pole.state(), null)); //pistonExtensionCollisionBox = pistonExtensionCollisionBox.union(new AABB(localPos)); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/pulley/PulleyLighter.java b/src/main/java/com/simibubi/create/content/contraptions/pulley/PulleyLighter.java index 0b723c453..b9a5a13e9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/pulley/PulleyLighter.java +++ b/src/main/java/com/simibubi/create/content/contraptions/pulley/PulleyLighter.java @@ -17,7 +17,7 @@ public class PulleyLighter extends ContraptionLighter { GridAlignedBB bounds = GridAlignedBB.from(contraption.bounds); - Level world = contraption.entity.level; + Level world = contraption.entity.level(); BlockPos.MutableBlockPos pos = contraption.anchor.mutable(); while (!AllBlocks.ROPE_PULLEY.has(world.getBlockState(pos)) && pos.getY() < world.getMaxBuildHeight()) diff --git a/src/main/java/com/simibubi/create/content/contraptions/render/ContraptionInstanceManager.java b/src/main/java/com/simibubi/create/content/contraptions/render/ContraptionInstanceManager.java index adec03d1e..b38ab41cd 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/render/ContraptionInstanceManager.java +++ b/src/main/java/com/simibubi/create/content/contraptions/render/ContraptionInstanceManager.java @@ -63,7 +63,7 @@ public class ContraptionInstanceManager extends BlockEntityInstanceManager { if (contraption.isHiddenInPortal(context.localPos)) return null; - MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(blockInfo.state); + MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(blockInfo.state()); if (movementBehaviour != null && movementBehaviour.hasSpecialInstancedRendering()) { ActorInstance instance = movementBehaviour.createInstance(materialManager, renderWorld, context); diff --git a/src/main/java/com/simibubi/create/content/contraptions/render/ContraptionLighter.java b/src/main/java/com/simibubi/create/content/contraptions/render/ContraptionLighter.java index d1abc1719..e917aeb63 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/render/ContraptionLighter.java +++ b/src/main/java/com/simibubi/create/content/contraptions/render/ContraptionLighter.java @@ -20,12 +20,12 @@ public abstract class ContraptionLighter implements Light protected ContraptionLighter(C contraption) { this.contraption = contraption; - lightUpdater = LightUpdater.get(contraption.entity.level); + lightUpdater = LightUpdater.get(contraption.entity.level()); bounds = getContraptionBounds(); growBoundsForEdgeData(bounds); - lightVolume = new GPULightVolume(contraption.entity.level, bounds); + lightVolume = new GPULightVolume(contraption.entity.level(), bounds); lightVolume.initialize(); scheduleRebuild = true; diff --git a/src/main/java/com/simibubi/create/content/contraptions/render/ContraptionRenderDispatcher.java b/src/main/java/com/simibubi/create/content/contraptions/render/ContraptionRenderDispatcher.java index 547ba8059..a91afb300 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/render/ContraptionRenderDispatcher.java +++ b/src/main/java/com/simibubi/create/content/contraptions/render/ContraptionRenderDispatcher.java @@ -54,7 +54,7 @@ public class ContraptionRenderDispatcher { * @return true if there was a renderer associated with the given contraption. */ public static boolean invalidate(Contraption contraption) { - Level level = contraption.entity.level; + Level level = contraption.entity.level(); return WORLDS.get(level) .invalidate(contraption); @@ -94,7 +94,7 @@ public class ContraptionRenderDispatcher { public static void renderFromEntity(AbstractContraptionEntity entity, Contraption contraption, MultiBufferSource buffers) { - Level world = entity.level; + Level world = entity.level(); ContraptionRenderInfo renderInfo = WORLDS.get(world) .getRenderInfo(contraption); @@ -131,7 +131,7 @@ public class ContraptionRenderDispatcher { for (StructureTemplate.StructureBlockInfo info : c.getBlocks() .values()) // Skip individual lighting updates to prevent lag with large contraptions - renderWorld.setBlock(info.pos, info.state, Block.UPDATE_SUPPRESS_LIGHT); + renderWorld.setBlock(info.pos(), info.state(), Block.UPDATE_SUPPRESS_LIGHT); renderWorld.runLightingEngine(); return renderWorld; @@ -155,13 +155,13 @@ public class ContraptionRenderDispatcher { context.world = world; StructureTemplate.StructureBlockInfo blockInfo = actor.getLeft(); - MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(blockInfo.state); + MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(blockInfo.state()); if (movementBehaviour != null) { - if (c.isHiddenInPortal(blockInfo.pos)) + if (c.isHiddenInPortal(blockInfo.pos())) continue; m.pushPose(); TransformStack.cast(m) - .translate(blockInfo.pos); + .translate(blockInfo.pos()); movementBehaviour.renderInContraption(context, renderWorld, matrices, buffer); m.popPose(); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/sync/ContraptionInteractionPacket.java b/src/main/java/com/simibubi/create/content/contraptions/sync/ContraptionInteractionPacket.java index 51dab433e..8cdda47ac 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/sync/ContraptionInteractionPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/sync/ContraptionInteractionPacket.java @@ -49,13 +49,13 @@ public class ContraptionInteractionPacket extends SimplePacketBase { ServerPlayer sender = context.getSender(); if (sender == null) return; - Entity entityByID = sender.getLevel().getEntity(target); + Entity entityByID = sender.level().getEntity(target); if (!(entityByID instanceof AbstractContraptionEntity)) return; AbstractContraptionEntity contraptionEntity = (AbstractContraptionEntity) entityByID; AABB bb = contraptionEntity.getBoundingBox(); double boundsExtra = Math.max(bb.getXsize(), bb.getYsize()); - double d = sender.getAttribute(ForgeMod.REACH_DISTANCE.get()).getValue() + 10 + boundsExtra; + double d = sender.getAttribute(ForgeMod.BLOCK_REACH.get()).getValue() + 10 + boundsExtra; if (!sender.hasLineOfSight(entityByID)) d -= 3; d *= d; diff --git a/src/main/java/com/simibubi/create/content/decoration/MetalLadderBlock.java b/src/main/java/com/simibubi/create/content/decoration/MetalLadderBlock.java index 937ee38d1..75db82350 100644 --- a/src/main/java/com/simibubi/create/content/decoration/MetalLadderBlock.java +++ b/src/main/java/com/simibubi/create/content/decoration/MetalLadderBlock.java @@ -92,7 +92,7 @@ public class MetalLadderBlock extends LadderBlock implements IWrenchable { int range = AllConfigs.server().equipment.placementAssistRange.get(); if (player != null) { - AttributeInstance reach = player.getAttribute(ForgeMod.REACH_DISTANCE.get()); + AttributeInstance reach = player.getAttribute(ForgeMod.BLOCK_REACH.get()); if (reach != null && reach.hasModifier(ExtendoGripItem.singleRangeAttributeModifier)) range += 4; } @@ -107,8 +107,7 @@ public class MetalLadderBlock extends LadderBlock implements IWrenchable { if (!state.canSurvive(world, newPos)) return PlacementOffset.fail(); - if (newState.getMaterial() - .isReplaceable()) + if (newState.canBeReplaced()) return PlacementOffset.success(newPos, bState -> bState.setValue(FACING, state.getValue(FACING))); return PlacementOffset.fail(); } diff --git a/src/main/java/com/simibubi/create/content/decoration/copycat/CopycatPanelBlock.java b/src/main/java/com/simibubi/create/content/decoration/copycat/CopycatPanelBlock.java index a3d22fae3..a40db2cdb 100644 --- a/src/main/java/com/simibubi/create/content/decoration/copycat/CopycatPanelBlock.java +++ b/src/main/java/com/simibubi/create/content/decoration/copycat/CopycatPanelBlock.java @@ -225,8 +225,7 @@ public class CopycatPanelBlock extends WaterloggedCopycatBlock { state.getValue(FACING) .getAxis(), dir -> world.getBlockState(pos.relative(dir)) - .getMaterial() - .isReplaceable()); + .canBeReplaced()); if (directions.isEmpty()) return PlacementOffset.fail(); diff --git a/src/main/java/com/simibubi/create/content/decoration/girder/GirderBlock.java b/src/main/java/com/simibubi/create/content/decoration/girder/GirderBlock.java index 078f209bd..7d77cd6b7 100644 --- a/src/main/java/com/simibubi/create/content/decoration/girder/GirderBlock.java +++ b/src/main/java/com/simibubi/create/content/decoration/girder/GirderBlock.java @@ -332,8 +332,7 @@ public class GirderBlock extends Block implements SimpleWaterloggedBlock, IWrenc VoxelShape shape = blockState.getShape(world, relative); if (shape.isEmpty()) return false; - if (Block.isFaceFull(shape, side.getOpposite()) && blockState.getMaterial() - .isSolidBlocking()) + if (Block.isFaceFull(shape, side.getOpposite()) && blockState.isSolid()) return true; return AbstractChuteBlock.getChuteFacing(blockState) == Direction.DOWN; } diff --git a/src/main/java/com/simibubi/create/content/decoration/girder/GirderPlacementHelper.java b/src/main/java/com/simibubi/create/content/decoration/girder/GirderPlacementHelper.java index 217753ddf..21f5d0419 100644 --- a/src/main/java/com/simibubi/create/content/decoration/girder/GirderPlacementHelper.java +++ b/src/main/java/com/simibubi/create/content/decoration/girder/GirderPlacementHelper.java @@ -81,7 +81,7 @@ public class GirderPlacementHelper implements IPlacementHelper { for (Direction dir : directions) { int range = AllConfigs.server().equipment.placementAssistRange.get(); if (player != null) { - AttributeInstance reach = player.getAttribute(ForgeMod.REACH_DISTANCE.get()); + AttributeInstance reach = player.getAttribute(ForgeMod.BLOCK_REACH.get()); if (reach != null && reach.hasModifier(ExtendoGripItem.singleRangeAttributeModifier)) range += 4; } @@ -92,8 +92,7 @@ public class GirderPlacementHelper implements IPlacementHelper { BlockPos newPos = pos.relative(dir, poles + 1); BlockState newState = world.getBlockState(newPos); - if (!newState.getMaterial() - .isReplaceable()) + if (!newState.canBeReplaced()) continue; return PlacementOffset.success(newPos, diff --git a/src/main/java/com/simibubi/create/content/decoration/palettes/AllPaletteBlocks.java b/src/main/java/com/simibubi/create/content/decoration/palettes/AllPaletteBlocks.java index 3fa386acc..30727f16a 100644 --- a/src/main/java/com/simibubi/create/content/decoration/palettes/AllPaletteBlocks.java +++ b/src/main/java/com/simibubi/create/content/decoration/palettes/AllPaletteBlocks.java @@ -25,7 +25,7 @@ import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.GlassBlock; import net.minecraft.world.level.block.state.properties.WoodType; -import net.minecraft.world.level.material.MaterialColor; +import net.minecraft.world.level.material.MapColor; import net.minecraftforge.common.Tags; public class AllPaletteBlocks { @@ -73,7 +73,7 @@ public class AllPaletteBlocks { WARPED_WINDOW = woodenWindowBlock(WoodType.WARPED, Blocks.WARPED_PLANKS), ORNATE_IRON_WINDOW = customWindowBlock("ornate_iron_window", () -> Items.IRON_NUGGET, () -> AllSpriteShifts.ORNATE_IRON_WINDOW, - () -> RenderType::cutout, false, () -> MaterialColor.TERRACOTTA_LIGHT_GRAY); + () -> RenderType::cutout, false, () -> MapColor.TERRACOTTA_LIGHT_GRAY); public static final BlockEntry OAK_WINDOW_PANE = woodenWindowPane(WoodType.OAK, OAK_WINDOW), diff --git a/src/main/java/com/simibubi/create/content/decoration/palettes/AllPaletteStoneTypes.java b/src/main/java/com/simibubi/create/content/decoration/palettes/AllPaletteStoneTypes.java index 13142b06e..63c19c889 100644 --- a/src/main/java/com/simibubi/create/content/decoration/palettes/AllPaletteStoneTypes.java +++ b/src/main/java/com/simibubi/create/content/decoration/palettes/AllPaletteStoneTypes.java @@ -15,7 +15,7 @@ import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.material.MaterialColor; +import net.minecraft.world.level.material.MapColor; import net.minecraftforge.registries.ForgeRegistries; public enum AllPaletteStoneTypes { @@ -30,35 +30,35 @@ public enum AllPaletteStoneTypes { ASURINE(STANDARD_RANGE, r -> r.paletteStoneBlock("asurine", () -> Blocks.DEEPSLATE, true, true) .properties(p -> p.destroyTime(1.25f) - .color(MaterialColor.COLOR_BLUE)) + .mapColor(MapColor.COLOR_BLUE)) .register()), CRIMSITE(STANDARD_RANGE, r -> r.paletteStoneBlock("crimsite", () -> Blocks.DEEPSLATE, true, true) .properties(p -> p.destroyTime(1.25f) - .color(MaterialColor.COLOR_RED)) + .mapColor(MapColor.COLOR_RED)) .register()), LIMESTONE(STANDARD_RANGE, r -> r.paletteStoneBlock("limestone", () -> Blocks.SANDSTONE, true, false) .properties(p -> p.destroyTime(1.25f) - .color(MaterialColor.SAND)) + .mapColor(MapColor.SAND)) .register()), OCHRUM(STANDARD_RANGE, r -> r.paletteStoneBlock("ochrum", () -> Blocks.CALCITE, true, true) .properties(p -> p.destroyTime(1.25f) - .color(MaterialColor.TERRACOTTA_YELLOW)) + .mapColor(MapColor.TERRACOTTA_YELLOW)) .register()), SCORIA(STANDARD_RANGE, r -> r.paletteStoneBlock("scoria", () -> Blocks.BLACKSTONE, true, false) - .properties(p -> p.color(MaterialColor.COLOR_BROWN)) + .properties(p -> p.mapColor(MapColor.COLOR_BROWN)) .register()), SCORCHIA(STANDARD_RANGE, r -> r.paletteStoneBlock("scorchia", () -> Blocks.BLACKSTONE, true, false) - .properties(p -> p.color(MaterialColor.TERRACOTTA_GRAY)) + .properties(p -> p.mapColor(MapColor.TERRACOTTA_GRAY)) .register()), VERIDIUM(STANDARD_RANGE, r -> r.paletteStoneBlock("veridium", () -> Blocks.TUFF, true, true) .properties(p -> p.destroyTime(1.25f) - .color(MaterialColor.WARPED_NYLIUM)) + .mapColor(MapColor.WARPED_NYLIUM)) .register()) ; diff --git a/src/main/java/com/simibubi/create/content/decoration/placard/PlacardRenderer.java b/src/main/java/com/simibubi/create/content/decoration/placard/PlacardRenderer.java index 7081b98ae..ccf2b37f8 100644 --- a/src/main/java/com/simibubi/create/content/decoration/placard/PlacardRenderer.java +++ b/src/main/java/com/simibubi/create/content/decoration/placard/PlacardRenderer.java @@ -7,11 +7,11 @@ import com.simibubi.create.foundation.utility.AngleHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.core.Direction; import net.minecraft.util.Mth; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.AttachFace; @@ -46,7 +46,7 @@ public class PlacardRenderer extends SafeBlockEntityRenderer .translate(0, 0, 4.5 / 16f) .scale(blockItem ? .5f : .375f); - itemRenderer.renderStatic(heldItem, TransformType.FIXED, light, overlay, ms, buffer, 0); + itemRenderer.renderStatic(heldItem, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0); ms.popPose(); } diff --git a/src/main/java/com/simibubi/create/content/decoration/slidingDoor/SlidingDoorMovementBehaviour.java b/src/main/java/com/simibubi/create/content/decoration/slidingDoor/SlidingDoorMovementBehaviour.java index 8cd5a9c13..9c8c7193d 100644 --- a/src/main/java/com/simibubi/create/content/decoration/slidingDoor/SlidingDoorMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/decoration/slidingDoor/SlidingDoorMovementBehaviour.java @@ -49,7 +49,7 @@ public class SlidingDoorMovementBehaviour implements MovementBehaviour { .get(context.localPos); if (structureBlockInfo == null) return; - boolean open = SlidingDoorBlockEntity.isOpen(structureBlockInfo.state); + boolean open = SlidingDoorBlockEntity.isOpen(structureBlockInfo.state()); if (!context.world.isClientSide()) tickOpen(context, open); @@ -78,26 +78,26 @@ public class SlidingDoorMovementBehaviour implements MovementBehaviour { StructureBlockInfo info = contraption.getBlocks() .get(pos); - if (info == null || !info.state.hasProperty(DoorBlock.OPEN)) + if (info == null || !info.state().hasProperty(DoorBlock.OPEN)) return; toggleDoor(pos, contraption, info); if (shouldOpen) - context.world.playSound(null, new BlockPos(context.position), SoundEvents.IRON_DOOR_OPEN, + context.world.playSound(null, BlockPos.containing(context.position), SoundEvents.IRON_DOOR_OPEN, SoundSource.BLOCKS, .125f, 1); } private void toggleDoor(BlockPos pos, Contraption contraption, StructureBlockInfo info) { - BlockState newState = info.state.cycle(DoorBlock.OPEN); - contraption.entity.setBlock(pos, new StructureBlockInfo(info.pos, newState, info.nbt)); + BlockState newState = info.state().cycle(DoorBlock.OPEN); + contraption.entity.setBlock(pos, new StructureBlockInfo(info.pos(), newState, info.nbt())); BlockPos otherPos = newState.getValue(DoorBlock.HALF) == DoubleBlockHalf.LOWER ? pos.above() : pos.below(); info = contraption.getBlocks() .get(otherPos); - if (info != null && info.state.hasProperty(DoorBlock.OPEN)) { - newState = info.state.cycle(DoorBlock.OPEN); - contraption.entity.setBlock(otherPos, new StructureBlockInfo(info.pos, newState, info.nbt)); + if (info != null && info.state().hasProperty(DoorBlock.OPEN)) { + newState = info.state().cycle(DoorBlock.OPEN); + contraption.entity.setBlock(otherPos, new StructureBlockInfo(info.pos(), newState, info.nbt())); contraption.invalidateColliders(); } } diff --git a/src/main/java/com/simibubi/create/content/decoration/steamWhistle/WhistleBlock.java b/src/main/java/com/simibubi/create/content/decoration/steamWhistle/WhistleBlock.java index 5458e69af..6c09c76f3 100644 --- a/src/main/java/com/simibubi/create/content/decoration/steamWhistle/WhistleBlock.java +++ b/src/main/java/com/simibubi/create/content/decoration/steamWhistle/WhistleBlock.java @@ -156,8 +156,7 @@ public class WhistleBlock extends Block implements IBE, IWre continue; } - if (!blockState.getMaterial() - .isReplaceable()) + if (!blockState.canBeReplaced()) return; pLevel.setBlock(currentPos, AllBlocks.STEAM_WHISTLE_EXTENSION.getDefaultState() diff --git a/src/main/java/com/simibubi/create/content/equipment/armor/BacktankArmorLayer.java b/src/main/java/com/simibubi/create/content/equipment/armor/BacktankArmorLayer.java index b75568278..11bc6e2dd 100644 --- a/src/main/java/com/simibubi/create/content/equipment/armor/BacktankArmorLayer.java +++ b/src/main/java/com/simibubi/create/content/equipment/armor/BacktankArmorLayer.java @@ -63,7 +63,7 @@ public class BacktankArmorLayer .rotateY(180) .unCentre() .translate(0, 6.5f / 16, 11f / 16) - .rotate(Direction.EAST, AngleHelper.rad(2 * AnimationTickHolder.getRenderTime(entity.level) % 360)) + .rotate(Direction.EAST, AngleHelper.rad(2 * AnimationTickHolder.getRenderTime(entity.level()) % 360)) .translate(0, -6.5f / 16, -11f / 16); cogs.forEntityRender() diff --git a/src/main/java/com/simibubi/create/content/equipment/armor/BacktankUtil.java b/src/main/java/com/simibubi/create/content/equipment/armor/BacktankUtil.java index 9eb73dc03..ed3493ef4 100644 --- a/src/main/java/com/simibubi/create/content/equipment/armor/BacktankUtil.java +++ b/src/main/java/com/simibubi/create/content/equipment/armor/BacktankUtil.java @@ -63,8 +63,8 @@ public class BacktankUtil { boolean depleted = threshold == 1; MutableComponent component = Lang.translateDirect(depleted ? "backtank.depleted" : "backtank.low"); - AllSoundEvents.DENY.play(player.level, null, player.blockPosition(), 1, 1.25f); - AllSoundEvents.STEAM.play(player.level, null, player.blockPosition(), .5f, .5f); + AllSoundEvents.DENY.play(player.level(), null, player.blockPosition(), 1, 1.25f); + AllSoundEvents.STEAM.play(player.level(), null, player.blockPosition(), .5f, .5f); player.connection.send(new ClientboundSetTitlesAnimationPacket(10, 40, 10)); player.connection.send(new ClientboundSetSubtitleTextPacket( diff --git a/src/main/java/com/simibubi/create/content/equipment/armor/DivingBootsItem.java b/src/main/java/com/simibubi/create/content/equipment/armor/DivingBootsItem.java index 1f7ae2965..77e63b815 100644 --- a/src/main/java/com/simibubi/create/content/equipment/armor/DivingBootsItem.java +++ b/src/main/java/com/simibubi/create/content/equipment/armor/DivingBootsItem.java @@ -50,9 +50,9 @@ public class DivingBootsItem extends BaseArmorItem { Vec3 motion = entity.getDeltaMovement(); boolean isJumping = entity.jumping; - entity.setOnGround(entity.isOnGround() || entity.verticalCollision); + entity.setOnGround(entity.onGround() || entity.verticalCollision); - if (isJumping && entity.isOnGround()) { + if (isJumping && entity.onGround()) { motion = motion.add(0, .5f, 0); entity.setOnGround(false); } else { @@ -90,7 +90,7 @@ public class DivingBootsItem extends BaseArmorItem { double yMotion = entity.getDeltaMovement().y; double vMultiplier = yMotion < 0 ? Math.max(0, 2.5 - Math.abs(yMotion) * 2) : 1; - if (!entity.isOnGround()) { + if (!entity.onGround()) { if (entity.jumping && entity.getPersistentData() .contains("LavaGrounded")) { boolean eyeInFluid = entity.isEyeInFluid(FluidTags.LAVA); diff --git a/src/main/java/com/simibubi/create/content/equipment/armor/DivingHelmetItem.java b/src/main/java/com/simibubi/create/content/equipment/armor/DivingHelmetItem.java index 1f97c047c..fa62101a3 100644 --- a/src/main/java/com/simibubi/create/content/equipment/armor/DivingHelmetItem.java +++ b/src/main/java/com/simibubi/create/content/equipment/armor/DivingHelmetItem.java @@ -75,7 +75,7 @@ public class DivingHelmetItem extends BaseArmorItem { @SubscribeEvent public static void breatheUnderwater(LivingTickEvent event) { LivingEntity entity = event.getEntity(); - Level world = entity.level; + Level world = entity.level(); boolean second = world.getGameTime() % 20 == 0; boolean drowning = entity.getAirSupply() == 0; diff --git a/src/main/java/com/simibubi/create/content/equipment/bell/HauntedBellPulser.java b/src/main/java/com/simibubi/create/content/equipment/bell/HauntedBellPulser.java index ec80317c0..d599f97e0 100644 --- a/src/main/java/com/simibubi/create/content/equipment/bell/HauntedBellPulser.java +++ b/src/main/java/com/simibubi/create/content/equipment/bell/HauntedBellPulser.java @@ -55,9 +55,9 @@ public class HauntedBellPulser { } catch (ExecutionException e) { } - long gameTime = player.level.getGameTime(); + long gameTime = player.level().getGameTime(); if (firstPulse || gameTime % RECHARGE_TICKS != 0) - sendPulse(player.level, event.player.blockPosition(), DISTANCE, false); + sendPulse(player.level(), event.player.blockPosition(), DISTANCE, false); } public static void sendPulse(Level world, BlockPos pos, int distance, boolean canOverlap) { diff --git a/src/main/java/com/simibubi/create/content/equipment/bell/SoulBaseParticle.java b/src/main/java/com/simibubi/create/content/equipment/bell/SoulBaseParticle.java index dbde04033..d9423e5c1 100644 --- a/src/main/java/com/simibubi/create/content/equipment/bell/SoulBaseParticle.java +++ b/src/main/java/com/simibubi/create/content/equipment/bell/SoulBaseParticle.java @@ -31,7 +31,7 @@ public class SoulBaseParticle extends CustomRotationParticle { public void tick() { selectSpriteLoopingWithAge(animatedSprite); - BlockPos pos = new BlockPos(x, y, z); + BlockPos pos = BlockPos.containing(x, y, z); if (age++ >= lifetime || !SoulPulseEffect.isDark(level, pos)) remove(); } diff --git a/src/main/java/com/simibubi/create/content/equipment/bell/SoulParticle.java b/src/main/java/com/simibubi/create/content/equipment/bell/SoulParticle.java index 1c22401f9..adedd6a7a 100644 --- a/src/main/java/com/simibubi/create/content/equipment/bell/SoulParticle.java +++ b/src/main/java/com/simibubi/create/content/equipment/bell/SoulParticle.java @@ -72,7 +72,7 @@ public class SoulParticle extends CustomRotationParticle { animationStage.tick(); animationStage = animationStage.getNext(); - BlockPos pos = new BlockPos(x, y, z); + BlockPos pos = BlockPos.containing(x, y, z); if (animationStage == null) remove(); if (!SoulPulseEffect.isDark(level, pos)) { diff --git a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintAssignCompleteRecipePacket.java b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintAssignCompleteRecipePacket.java index 707fb974f..01ab7e942 100644 --- a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintAssignCompleteRecipePacket.java +++ b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintAssignCompleteRecipePacket.java @@ -32,7 +32,7 @@ public class BlueprintAssignCompleteRecipePacket extends SimplePacketBase { return; if (player.containerMenu instanceof BlueprintMenu) { BlueprintMenu c = (BlueprintMenu) player.containerMenu; - player.getLevel() + player.level() .getRecipeManager() .byKey(recipeID) .ifPresent(r -> BlueprintItem.assignCompleteRecipe(c.ghostInventory, r)); diff --git a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintEntity.java b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintEntity.java index 566f7ff85..ae143a0e8 100644 --- a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintEntity.java +++ b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintEntity.java @@ -209,7 +209,7 @@ public class BlueprintEntity extends HangingEntity @Override public boolean survives() { - if (!level.noCollision(this)) + if (!level().noCollision(this)) return false; int i = Math.max(1, this.getWidth() / 16); @@ -229,17 +229,16 @@ public class BlueprintEntity extends HangingEntity blockpos$mutable.set(blockpos) .move(newDirection, k + i1) .move(upDirection, l + j1); - BlockState blockstate = this.level.getBlockState(blockpos$mutable); - if (Block.canSupportCenter(this.level, blockpos$mutable, this.direction)) + BlockState blockstate = this.level().getBlockState(blockpos$mutable); + if (Block.canSupportCenter(this.level(), blockpos$mutable, this.direction)) continue; - if (!blockstate.getMaterial() - .isSolid() && !DiodeBlock.isDiode(blockstate)) { + if (!blockstate.isSolid() && !DiodeBlock.isDiode(blockstate)) { return false; } } } - return this.level.getEntities(this, this.getBoundingBox(), HANGING_ENTITY) + return this.level().getEntities(this, this.getBoundingBox(), HANGING_ENTITY) .isEmpty(); } @@ -255,11 +254,11 @@ public class BlueprintEntity extends HangingEntity @Override public boolean skipAttackInteraction(Entity source) { - if (!(source instanceof Player) || level.isClientSide) + if (!(source instanceof Player) || level().isClientSide) return super.skipAttackInteraction(source); Player player = (Player) source; - double attrib = player.getAttribute(ForgeMod.REACH_DISTANCE.get()) + double attrib = player.getAttribute(ForgeMod.BLOCK_REACH.get()) .getValue() + (player.isCreative() ? 0 : -0.5F); Vec3 eyePos = source.getEyePosition(1); @@ -285,7 +284,7 @@ public class BlueprintEntity extends HangingEntity @Override public void dropItem(@Nullable Entity p_110128_1_) { - if (!level.getGameRules() + if (!level().getGameRules() .getBoolean(GameRules.RULE_DOENTITYDROPS)) return; @@ -324,7 +323,7 @@ public class BlueprintEntity extends HangingEntity public void lerpTo(double p_180426_1_, double p_180426_3_, double p_180426_5_, float p_180426_7_, float p_180426_8_, int p_180426_9_, boolean p_180426_10_) { BlockPos blockpos = - this.pos.offset(p_180426_1_ - this.getX(), p_180426_3_ - this.getY(), p_180426_5_ - this.getZ()); + this.pos.offset(BlockPos.containing(p_180426_1_ - this.getX(), p_180426_3_ - this.getY(), p_180426_5_ - this.getZ())); this.setPos((double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ()); } @@ -351,7 +350,7 @@ public class BlueprintEntity extends HangingEntity BlueprintSection section = getSectionAt(vec); ItemStackHandler items = section.getItems(); - if (!holdingWrench && !level.isClientSide && !items.getStackInSlot(9) + if (!holdingWrench && !level().isClientSide && !items.getStackInSlot(9) .isEmpty()) { IItemHandlerModifiable playerInv = new InvWrapper(player.getInventory()); @@ -373,7 +372,7 @@ public class BlueprintEntity extends HangingEntity } for (int slot = 0; slot < playerInv.getSlots(); slot++) { - if (!FilterItem.test(level, playerInv.getStackInSlot(slot), requestedItem)) + if (!FilterItem.test(level(), playerInv.getStackInSlot(slot), requestedItem)) continue; ItemStack currentItem = playerInv.extractItem(slot, 1, false); if (stacksTaken.containsKey(slot)) @@ -393,9 +392,9 @@ public class BlueprintEntity extends HangingEntity CraftingContainer craftingInventory = new BlueprintCraftingInventory(craftingGrid); if (!recipe.isPresent()) - recipe = level.getRecipeManager() - .getRecipeFor(RecipeType.CRAFTING, craftingInventory, level); - ItemStack result = recipe.filter(r -> r.matches(craftingInventory, level)) + recipe = level().getRecipeManager() + .getRecipeFor(RecipeType.CRAFTING, craftingInventory, level()); + ItemStack result = recipe.filter(r -> r.matches(craftingInventory, level())) .map(r -> r.assemble(craftingInventory)) .orElse(ItemStack.EMPTY); @@ -405,13 +404,13 @@ public class BlueprintEntity extends HangingEntity success = false; } else { amountCrafted += result.getCount(); - result.onCraftedBy(player.level, player, 1); + result.onCraftedBy(player.level(), player, 1); ForgeEventFactory.firePlayerCraftingEvent(player, result, craftingInventory); - NonNullList nonnulllist = level.getRecipeManager() - .getRemainingItemsFor(RecipeType.CRAFTING, craftingInventory, level); + NonNullList nonnulllist = level().getRecipeManager() + .getRemainingItemsFor(RecipeType.CRAFTING, craftingInventory, level()); if (firstPass) - level.playSound(null, player.blockPosition(), SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, + level().playSound(null, player.blockPosition(), SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, .2f, 1f + Create.RANDOM.nextFloat()); player.getInventory() .placeItemBackInInventory(result); @@ -434,7 +433,7 @@ public class BlueprintEntity extends HangingEntity } int i = section.index; - if (!level.isClientSide && player instanceof ServerPlayer) { + if (!level().isClientSide && player instanceof ServerPlayer) { NetworkHooks.openScreen((ServerPlayer) player, section, buf -> { buf.writeVarInt(getId()); buf.writeVarInt(i); @@ -530,7 +529,7 @@ public class BlueprintEntity extends HangingEntity list.put(index + "", inventory.serializeNBT()); list.putBoolean("InferredIcon", inferredIcon); cachedDisplayItems = null; - if (!level.isClientSide) + if (!level().isClientSide) syncPersistentDataWithTracking(BlueprintEntity.this); } @@ -539,7 +538,7 @@ public class BlueprintEntity extends HangingEntity } public Level getBlueprintWorld() { - return level; + return level(); } @Override diff --git a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintRenderer.java b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintRenderer.java index a560e74ce..e10002a9b 100644 --- a/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintRenderer.java +++ b/src/main/java/com/simibubi/create/content/equipment/blueprint/BlueprintRenderer.java @@ -14,12 +14,12 @@ import com.simibubi.create.foundation.utility.Couple; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.Sheets; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Blocks; @@ -106,7 +106,7 @@ public class BlueprintRenderer extends EntityRenderer { Minecraft.getInstance() .getItemRenderer() - .renderStatic(stack, TransformType.GUI, itemLight, OverlayTexture.NO_OVERLAY, squashedMS, buffer, 0); + .renderStatic(stack, ItemDisplayContext.GUI, itemLight, OverlayTexture.NO_OVERLAY, squashedMS, buffer, 0); squashedMS.popPose(); }); squashedMS.popPose(); diff --git a/src/main/java/com/simibubi/create/content/equipment/clipboard/ClipboardBlock.java b/src/main/java/com/simibubi/create/content/equipment/clipboard/ClipboardBlock.java index 7a3b750c1..24de58e47 100644 --- a/src/main/java/com/simibubi/create/content/equipment/clipboard/ClipboardBlock.java +++ b/src/main/java/com/simibubi/create/content/equipment/clipboard/ClipboardBlock.java @@ -80,8 +80,7 @@ public class ClipboardBlock extends FaceAttachedHorizontalDirectionalBlock public boolean canSurvive(BlockState pState, LevelReader pLevel, BlockPos pPos) { return !pLevel.getBlockState(pPos.relative(getConnectedDirection(pState).getOpposite())) - .getMaterial() - .isReplaceable(); + .canBeReplaced(); } @Override diff --git a/src/main/java/com/simibubi/create/content/equipment/clipboard/ClipboardEditPacket.java b/src/main/java/com/simibubi/create/content/equipment/clipboard/ClipboardEditPacket.java index 85a92e8ce..c2541f6f3 100644 --- a/src/main/java/com/simibubi/create/content/equipment/clipboard/ClipboardEditPacket.java +++ b/src/main/java/com/simibubi/create/content/equipment/clipboard/ClipboardEditPacket.java @@ -47,7 +47,7 @@ public class ClipboardEditPacket extends SimplePacketBase { ServerPlayer sender = context.getSender(); if (targetedBlock != null) { - Level world = sender.level; + Level world = sender.level(); if (world == null || !world.isLoaded(targetedBlock)) return; if (!targetedBlock.closerThan(sender.blockPosition(), 20)) diff --git a/src/main/java/com/simibubi/create/content/equipment/clipboard/ClipboardScreen.java b/src/main/java/com/simibubi/create/content/equipment/clipboard/ClipboardScreen.java index 696ba720f..499d5a103 100644 --- a/src/main/java/com/simibubi/create/content/equipment/clipboard/ClipboardScreen.java +++ b/src/main/java/com/simibubi/create/content/equipment/clipboard/ClipboardScreen.java @@ -34,7 +34,7 @@ import net.minecraft.SharedConstants; import net.minecraft.Util; import net.minecraft.client.StringSplitter; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.font.TextFieldHelper; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.PageButton; @@ -524,7 +524,7 @@ public class ClipboardScreen extends AbstractSimiScreen { return; pCursorPos = convertLocalToScreen(pCursorPos); if (!pIsEndOfText) { - GuiComponent.fill(pPoseStack, pCursorPos.x, pCursorPos.y - 1, pCursorPos.x + 1, pCursorPos.y + 9, + GuiGraphics.fill(pPoseStack, pCursorPos.x, pCursorPos.y - 1, pCursorPos.x + 1, pCursorPos.y + 9, -16777216); } else { font.draw(pPoseStack, "_", (float) pCursorPos.x, (float) pCursorPos.y, 0); diff --git a/src/main/java/com/simibubi/create/content/equipment/extendoGrip/ExtendoGripInteractionPacket.java b/src/main/java/com/simibubi/create/content/equipment/extendoGrip/ExtendoGripInteractionPacket.java index 9df32850a..ccaa02f18 100644 --- a/src/main/java/com/simibubi/create/content/equipment/extendoGrip/ExtendoGripInteractionPacket.java +++ b/src/main/java/com/simibubi/create/content/equipment/extendoGrip/ExtendoGripInteractionPacket.java @@ -56,10 +56,10 @@ public class ExtendoGripInteractionPacket extends SimplePacketBase { ServerPlayer sender = context.getSender(); if (sender == null) return; - Entity entityByID = sender.getLevel() + Entity entityByID = sender.level() .getEntity(target); if (entityByID != null && ExtendoGripItem.isHoldingExtendoGrip(sender)) { - double d = sender.getAttribute(ForgeMod.REACH_DISTANCE.get()) + double d = sender.getAttribute(ForgeMod.BLOCK_REACH.get()) .getValue(); if (!sender.hasLineOfSight(entityByID)) d -= 3; diff --git a/src/main/java/com/simibubi/create/content/equipment/extendoGrip/ExtendoGripItem.java b/src/main/java/com/simibubi/create/content/equipment/extendoGrip/ExtendoGripItem.java index 0d1c46cb8..abfacd852 100644 --- a/src/main/java/com/simibubi/create/content/equipment/extendoGrip/ExtendoGripItem.java +++ b/src/main/java/com/simibubi/create/content/equipment/extendoGrip/ExtendoGripItem.java @@ -64,10 +64,10 @@ public class ExtendoGripItem extends Item { private static final Supplier> rangeModifier = Suppliers.memoize(() -> // Holding an ExtendoGrip - ImmutableMultimap.of(ForgeMod.REACH_DISTANCE.get(), singleRangeAttributeModifier)); + ImmutableMultimap.of(ForgeMod.BLOCK_REACH.get(), singleRangeAttributeModifier)); private static final Supplier> doubleRangeModifier = Suppliers.memoize(() -> // Holding two ExtendoGrips o.O - ImmutableMultimap.of(ForgeMod.REACH_DISTANCE.get(), doubleRangeAttributeModifier)); + ImmutableMultimap.of(ForgeMod.BLOCK_REACH.get(), doubleRangeAttributeModifier)); private static DamageSource lastActiveDamageSource; @@ -148,7 +148,7 @@ public class ExtendoGripItem extends Item { return; // Modified version of GameRenderer#getMouseOver - double d0 = player.getAttribute(ForgeMod.REACH_DISTANCE.get()) + double d0 = player.getAttribute(ForgeMod.BLOCK_REACH.get()) .getValue(); if (!player.isCreative()) d0 -= 0.5f; @@ -194,7 +194,7 @@ public class ExtendoGripItem extends Item { private static void findAndDamageExtendoGrip(Player player) { if (player == null) return; - if (player.level.isClientSide) + if (player.level().isClientSide) return; InteractionHand hand = InteractionHand.MAIN_HAND; ItemStack extendo = player.getMainHandItem(); @@ -258,7 +258,7 @@ public class ExtendoGripItem extends Item { // Server ignores entity interaction further than 6m if (entity.distanceToSqr(target) < 36) return false; - if (!entity.level.isClientSide) + if (!entity.level().isClientSide) return false; if (!(entity instanceof Player)) return false; diff --git a/src/main/java/com/simibubi/create/content/equipment/extendoGrip/ExtendoGripItemRenderer.java b/src/main/java/com/simibubi/create/content/equipment/extendoGrip/ExtendoGripItemRenderer.java index e79655ef9..72d638afd 100644 --- a/src/main/java/com/simibubi/create/content/equipment/extendoGrip/ExtendoGripItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/equipment/extendoGrip/ExtendoGripItemRenderer.java @@ -11,8 +11,8 @@ import com.simibubi.create.foundation.item.render.PartialItemModelRenderer; import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.util.Mth; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.Vec3; @@ -28,12 +28,12 @@ public class ExtendoGripItemRenderer extends CustomRenderedItemModelRenderer { private static final Vec3 COG_ROTATION_OFFSET = new Vec3(0, 1 / 16f, 0); @Override - protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, TransformType transformType, + protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, ItemDisplayContext transformType, PoseStack ms, MultiBufferSource buffer, int light, int overlay) { TransformStack stacker = TransformStack.cast(ms); float animation = 0.25f; - boolean leftHand = transformType == TransformType.FIRST_PERSON_LEFT_HAND; - boolean rightHand = transformType == TransformType.FIRST_PERSON_RIGHT_HAND; + boolean leftHand = transformType == ItemDisplayContext.FIRST_PERSON_LEFT_HAND; + boolean rightHand = transformType == ItemDisplayContext.FIRST_PERSON_RIGHT_HAND; if (leftHand || rightHand) animation = Mth.lerp(AnimationTickHolder.getPartialTicks(), ExtendoGripRenderHandler.lastMainHandAnimation, diff --git a/src/main/java/com/simibubi/create/content/equipment/extendoGrip/ExtendoGripRenderHandler.java b/src/main/java/com/simibubi/create/content/equipment/extendoGrip/ExtendoGripRenderHandler.java index c79c8e7fe..150c32019 100644 --- a/src/main/java/com/simibubi/create/content/equipment/extendoGrip/ExtendoGripRenderHandler.java +++ b/src/main/java/com/simibubi/create/content/equipment/extendoGrip/ExtendoGripRenderHandler.java @@ -12,12 +12,12 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.renderer.ItemInHandRenderer; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.renderer.entity.player.PlayerRenderer; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.ForgeHooksClient; @@ -110,8 +110,8 @@ public class ExtendoGripRenderHandler { ms.pushPose(); ms.translate(flip * -0.1f, 0, -0.3f); ItemInHandRenderer firstPersonRenderer = mc.getEntityRenderDispatcher().getItemInHandRenderer(); - TransformType transform = - rightHand ? TransformType.FIRST_PERSON_RIGHT_HAND : TransformType.FIRST_PERSON_LEFT_HAND; + ItemDisplayContext transform = + rightHand ? ItemDisplayContext.FIRST_PERSON_RIGHT_HAND : ItemDisplayContext.FIRST_PERSON_LEFT_HAND; firstPersonRenderer.renderItem(mc.player, notInOffhand ? heldItem : offhandItem, transform, !rightHand, event.getPoseStack(), event.getMultiBufferSource(), event.getPackedLight()); diff --git a/src/main/java/com/simibubi/create/content/equipment/goggles/GogglesModel.java b/src/main/java/com/simibubi/create/content/equipment/goggles/GogglesModel.java index 0dec2de7b..f19986ef3 100644 --- a/src/main/java/com/simibubi/create/content/equipment/goggles/GogglesModel.java +++ b/src/main/java/com/simibubi/create/content/equipment/goggles/GogglesModel.java @@ -3,8 +3,8 @@ package com.simibubi.create.content.equipment.goggles; import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.AllPartialModels; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraftforge.client.model.BakedModelWrapper; public class GogglesModel extends BakedModelWrapper { @@ -14,11 +14,11 @@ public class GogglesModel extends BakedModelWrapper { } @Override - public BakedModel applyTransform(TransformType cameraTransformType, PoseStack mat, boolean leftHanded) { - if (cameraTransformType == TransformType.HEAD) + public BakedModel applyTransform(ItemDisplayContext cameraItemDisplayContext, PoseStack mat, boolean leftHanded) { + if (cameraItemDisplayContext == ItemDisplayContext.HEAD) return AllPartialModels.GOGGLES.get() - .applyTransform(cameraTransformType, mat, leftHanded); - return super.applyTransform(cameraTransformType, mat, leftHanded); + .applyTransform(cameraItemDisplayContext, mat, leftHanded); + return super.applyTransform(cameraItemDisplayContext, mat, leftHanded); } } diff --git a/src/main/java/com/simibubi/create/content/equipment/potatoCannon/BuiltinPotatoProjectileTypes.java b/src/main/java/com/simibubi/create/content/equipment/potatoCannon/BuiltinPotatoProjectileTypes.java index 4bebe12f3..b62b9efb6 100644 --- a/src/main/java/com/simibubi/create/content/equipment/potatoCannon/BuiltinPotatoProjectileTypes.java +++ b/src/main/java/com/simibubi/create/content/equipment/potatoCannon/BuiltinPotatoProjectileTypes.java @@ -160,7 +160,7 @@ public class BuiltinPotatoProjectileTypes { .soundPitch(1.1f) .onEntityHit(ray -> { Entity entity = ray.getEntity(); - Level world = entity.level; + Level world = entity.level(); if (!(entity instanceof ZombieVillager) || !((ZombieVillager) entity).hasEffect(MobEffects.WEAKNESS)) return foodEffects(Foods.GOLDEN_APPLE, false).test(ray); @@ -271,7 +271,7 @@ public class BuiltinPotatoProjectileTypes { private static Predicate potion(MobEffect effect, int level, int ticks, boolean recoverable) { return ray -> { Entity entity = ray.getEntity(); - if (entity.level.isClientSide) + if (entity.level().isClientSide) return true; if (entity instanceof LivingEntity) applyEffect((LivingEntity) entity, new MobEffectInstance(effect, ticks, level - 1)); @@ -282,7 +282,7 @@ public class BuiltinPotatoProjectileTypes { private static Predicate foodEffects(FoodProperties food, boolean recoverable) { return ray -> { Entity entity = ray.getEntity(); - if (entity.level.isClientSide) + if (entity.level().isClientSide) return true; if (entity instanceof LivingEntity) { @@ -315,8 +315,7 @@ public class BuiltinPotatoProjectileTypes { Direction face = ray.getDirection(); BlockPos placePos = hitPos.relative(face); if (!world.getBlockState(placePos) - .getMaterial() - .isReplaceable()) + .canBeReplaced()) return false; if (!(cropBlock.get() instanceof IPlantable)) return false; @@ -345,8 +344,7 @@ public class BuiltinPotatoProjectileTypes { Direction face = ray.getDirection(); BlockPos placePos = hitPos.relative(face); if (!world.getBlockState(placePos) - .getMaterial() - .isReplaceable()) + .canBeReplaced()) return false; if (face == Direction.UP) { diff --git a/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoCannonItemRenderer.java b/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoCannonItemRenderer.java index 184402aba..ecfba8036 100644 --- a/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoCannonItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoCannonItemRenderer.java @@ -14,11 +14,11 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.util.Mth; import net.minecraft.world.entity.HumanoidArm; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; public class PotatoCannonItemRenderer extends CustomRenderedItemModelRenderer { @@ -27,7 +27,7 @@ public class PotatoCannonItemRenderer extends CustomRenderedItemModelRenderer { @Override protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, - TransformType transformType, PoseStack ms, MultiBufferSource buffer, int light, int overlay) { + ItemDisplayContext transformType, PoseStack ms, MultiBufferSource buffer, int light, int overlay) { ItemRenderer itemRenderer = Minecraft.getInstance() .getItemRenderer(); renderer.render(model.getOriginalModel(), light); @@ -53,7 +53,7 @@ public class PotatoCannonItemRenderer extends CustomRenderedItemModelRenderer { renderer.render(COG.get(), light); ms.popPose(); - if (transformType == TransformType.GUI) { + if (transformType == ItemDisplayContext.GUI) { PotatoCannonItem.getAmmoforPreview(stack) .ifPresent(ammo -> { PoseStack localMs = new PoseStack(); @@ -61,7 +61,7 @@ public class PotatoCannonItemRenderer extends CustomRenderedItemModelRenderer { localMs.scale(.5f, .5f, .5f); TransformStack.cast(localMs) .rotateY(-34); - itemRenderer.renderStatic(ammo, TransformType.GUI, light, OverlayTexture.NO_OVERLAY, localMs, buffer, 0); + itemRenderer.renderStatic(ammo, ItemDisplayContext.GUI, light, OverlayTexture.NO_OVERLAY, localMs, buffer, 0); }); } diff --git a/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoProjectileEntity.java b/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoProjectileEntity.java index 105e37f58..2175ba6a3 100644 --- a/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoProjectileEntity.java +++ b/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoProjectileEntity.java @@ -208,7 +208,7 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements if (this.isOnFire() && !targetIsEnderman) target.setSecondsOnFire(5); - boolean onServer = !level.isClientSide; + boolean onServer = !level().isClientSide; if (onServer && !target.hurt(causePotatoDamage(), damage)) { target.setRemainingFireTicks(k); kill(); @@ -223,7 +223,7 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements recoverItem(); if (!(target instanceof LivingEntity)) { - playHitSound(level, position()); + playHitSound(level(), position()); kill(); return; } @@ -274,7 +274,7 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements } public static void playHitSound(Level world, Vec3 location) { - AllSoundEvents.POTATO_HIT.playOnServer(world, new BlockPos(location)); + AllSoundEvents.POTATO_HIT.playOnServer(world, BlockPos.containing(location)); } public static void playLaunchSound(Level world, Vec3 location, float pitch) { @@ -285,7 +285,7 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements protected void onHitBlock(BlockHitResult ray) { Vec3 hit = ray.getLocation(); pop(hit); - if (!getProjectileType().onBlockHit(level, ray) && !level.isClientSide) + if (!getProjectileType().onBlockHit(level(), ray) && !level().isClientSide) if (random.nextDouble() <= recoveryChance) recoverItem(); super.onHitBlock(ray); @@ -307,12 +307,12 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements if (!stack.isEmpty()) { for (int i = 0; i < 7; i++) { Vec3 m = VecHelper.offsetRandomly(Vec3.ZERO, this.random, .25f); - level.addParticle(new ItemParticleOption(ParticleTypes.ITEM, stack), hit.x, hit.y, hit.z, m.x, m.y, + level().addParticle(new ItemParticleOption(ParticleTypes.ITEM, stack), hit.x, hit.y, hit.z, m.x, m.y, m.z); } } - if (!level.isClientSide) - playHitSound(level, position()); + if (!level().isClientSide) + playHitSound(level(), position()); } private DamageSource causePotatoDamage() { diff --git a/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoProjectileRenderer.java b/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoProjectileRenderer.java index 94cb36917..6cfa9c433 100644 --- a/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoProjectileRenderer.java +++ b/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoProjectileRenderer.java @@ -4,11 +4,11 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; public class PotatoProjectileRenderer extends EntityRenderer { @@ -31,7 +31,7 @@ public class PotatoProjectileRenderer extends EntityRenderer open GUI if (player.isShiftKeyDown()) { - if (player.level.isClientSide) { + if (player.level().isClientSide) { DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> { openWandGUI(wand, context.getHand()); }); @@ -210,7 +210,7 @@ public class SymmetryWandItem extends Item { return; symmetry.process(blockSet); - BlockPos to = new BlockPos(mirrorPos); + BlockPos to = BlockPos.containing(mirrorPos); List targets = new ArrayList<>(); targets.add(pos); @@ -231,8 +231,7 @@ public class SymmetryWandItem extends Item { } BlockState toReplace = world.getBlockState(position); - if (!toReplace.getMaterial() - .isReplaceable()) + if (!toReplace.canBeReplaced()) continue; if (toReplace.getDestroySpeed(world, position) == -1) continue; @@ -296,7 +295,7 @@ public class SymmetryWandItem extends Item { symmetry.process(blockSet); - BlockPos to = new BlockPos(mirrorPos); + BlockPos to = BlockPos.containing(mirrorPos); List targets = new ArrayList<>(); targets.add(pos); @@ -308,7 +307,7 @@ public class SymmetryWandItem extends Item { continue; BlockState blockstate = world.getBlockState(position); - if (blockstate.getMaterial() != Material.AIR) { + if (!blockstate.isAir()) { targets.add(position); world.levelEvent(2001, position, Block.getId(blockstate)); world.setBlock(position, air, 3); diff --git a/src/main/java/com/simibubi/create/content/equipment/symmetryWand/SymmetryWandItemRenderer.java b/src/main/java/com/simibubi/create/content/equipment/symmetryWand/SymmetryWandItemRenderer.java index af0d648d7..2379f2a3e 100644 --- a/src/main/java/com/simibubi/create/content/equipment/symmetryWand/SymmetryWandItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/equipment/symmetryWand/SymmetryWandItemRenderer.java @@ -11,8 +11,8 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.util.Mth; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; public class SymmetryWandItemRenderer extends CustomRenderedItemModelRenderer { @@ -22,7 +22,7 @@ public class SymmetryWandItemRenderer extends CustomRenderedItemModelRenderer { protected static final PartialModel CORE_GLOW = new PartialModel(Create.asResource("item/wand_of_symmetry/core_glow")); @Override - protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, ItemTransforms.TransformType transformType, + protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, ItemDisplayContext transformType, PoseStack ms, MultiBufferSource buffer, int light, int overlay) { float worldTime = AnimationTickHolder.getRenderTime() / 20; int maxLight = LightTexture.FULL_BRIGHT; diff --git a/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxDisposeAllPacket.java b/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxDisposeAllPacket.java index e9a6fb2ff..1890dadb0 100644 --- a/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxDisposeAllPacket.java +++ b/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxDisposeAllPacket.java @@ -36,7 +36,7 @@ public class ToolboxDisposeAllPacket extends SimplePacketBase { public boolean handle(Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); - Level world = player.level; + Level world = player.level(); BlockEntity blockEntity = world.getBlockEntity(toolboxPos); double maxRange = ToolboxHandler.getMaxRange(player); diff --git a/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxEquipPacket.java b/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxEquipPacket.java index 13c8c3284..a63c4befa 100644 --- a/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxEquipPacket.java +++ b/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxEquipPacket.java @@ -45,7 +45,7 @@ public class ToolboxEquipPacket extends SimplePacketBase { public boolean handle(Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); - Level world = player.level; + Level world = player.level(); if (toolboxPos == null) { ToolboxHandler.unequip(player, hotbarSlot, false); diff --git a/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxHandler.java b/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxHandler.java index 8a799f183..31a5666bf 100644 --- a/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxHandler.java +++ b/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxHandler.java @@ -118,7 +118,7 @@ public class ToolboxHandler { public static void unequip(Player player, int hotbarSlot, boolean keepItems) { CompoundTag compound = player.getPersistentData() .getCompound("CreateToolboxData"); - Level world = player.level; + Level world = player.level(); String key = String.valueOf(hotbarSlot); if (!compound.contains(key)) return; @@ -136,7 +136,7 @@ public class ToolboxHandler { } public static boolean withinRange(Player player, ToolboxBlockEntity box) { - if (player.level != box.getLevel()) + if (player.level() != box.getLevel()) return false; double maxRange = getMaxRange(player); return distance(player.position(), box.getBlockPos()) < maxRange * maxRange; diff --git a/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxHandlerClient.java b/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxHandlerClient.java index 21505db29..5ed272a49 100644 --- a/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxHandlerClient.java +++ b/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxHandlerClient.java @@ -28,7 +28,6 @@ import net.minecraft.world.level.GameType; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; @@ -51,7 +50,7 @@ public class ToolboxHandlerClient { LocalPlayer player = mc.player; if (player == null) return false; - Level level = player.level; + Level level = player.level(); HitResult hitResult = mc.hitResult; if (hitResult == null || hitResult.getType() == HitResult.Type.MISS) @@ -60,7 +59,7 @@ public class ToolboxHandlerClient { return false; ItemStack result = ItemStack.EMPTY; - List toolboxes = ToolboxHandler.getNearest(player.level, player, 8); + List toolboxes = ToolboxHandler.getNearest(player.level(), player, 8); if (toolboxes.isEmpty()) return false; @@ -68,7 +67,7 @@ public class ToolboxHandlerClient { if (hitResult.getType() == HitResult.Type.BLOCK) { BlockPos pos = ((BlockHitResult) hitResult).getBlockPos(); BlockState state = level.getBlockState(pos); - if (state.getMaterial() == Material.AIR) + if (state.isAir()) return false; result = state.getCloneItemStack(hitResult, level, pos, player); @@ -113,9 +112,9 @@ public class ToolboxHandlerClient { LocalPlayer player = mc.player; if (player == null) return; - Level level = player.level; + Level level = player.level(); - List toolboxes = ToolboxHandler.getNearest(player.level, player, 8); + List toolboxes = ToolboxHandler.getNearest(player.level(), player, 8); toolboxes.sort(Comparator.comparing(ToolboxBlockEntity::getUniqueId)); CompoundTag compound = player.getPersistentData() diff --git a/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxMenu.java b/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxMenu.java index 8dacb716f..8dca8ec49 100644 --- a/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxMenu.java +++ b/src/main/java/com/simibubi/create/content/equipment/toolbox/ToolboxMenu.java @@ -91,7 +91,7 @@ public class ToolboxMenu extends MenuBase { } if (type == ClickType.PICKUP && carried.isEmpty() && itemInClickedSlot.isEmpty()) - if (!player.level.isClientSide) { + if (!player.level().isClientSide) { contentHolder.inventory.filters.set(index / STACKS_PER_COMPARTMENT, ItemStack.EMPTY); contentHolder.sendData(); } @@ -152,7 +152,7 @@ public class ToolboxMenu extends MenuBase { @Override public void removed(Player playerIn) { super.removed(playerIn); - if (!playerIn.level.isClientSide) + if (!playerIn.level().isClientSide) contentHolder.stopOpen(playerIn); } diff --git a/src/main/java/com/simibubi/create/content/equipment/wrench/WrenchItemRenderer.java b/src/main/java/com/simibubi/create/content/equipment/wrench/WrenchItemRenderer.java index 0086cf19b..c988b45ce 100644 --- a/src/main/java/com/simibubi/create/content/equipment/wrench/WrenchItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/equipment/wrench/WrenchItemRenderer.java @@ -11,7 +11,7 @@ import com.simibubi.create.foundation.item.render.PartialItemModelRenderer; import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; public class WrenchItemRenderer extends CustomRenderedItemModelRenderer { @@ -19,7 +19,7 @@ public class WrenchItemRenderer extends CustomRenderedItemModelRenderer { protected static final PartialModel GEAR = new PartialModel(Create.asResource("item/wrench/gear")); @Override - protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, ItemTransforms.TransformType transformType, + protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, ItemDisplayContext transformType, PoseStack ms, MultiBufferSource buffer, int light, int overlay) { renderer.render(model.getOriginalModel(), light); diff --git a/src/main/java/com/simibubi/create/content/equipment/zapper/ShootableGadgetRenderHandler.java b/src/main/java/com/simibubi/create/content/equipment/zapper/ShootableGadgetRenderHandler.java index 6fe2c13a4..a5c77c248 100644 --- a/src/main/java/com/simibubi/create/content/equipment/zapper/ShootableGadgetRenderHandler.java +++ b/src/main/java/com/simibubi/create/content/equipment/zapper/ShootableGadgetRenderHandler.java @@ -9,11 +9,11 @@ import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.renderer.ItemInHandRenderer; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.entity.player.PlayerRenderer; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.HumanoidArm; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.Vec3; import net.minecraftforge.client.event.RenderHandEvent; @@ -131,8 +131,8 @@ public abstract class ShootableGadgetRenderHandler { ms.mulPose(Axis.ZP.rotationDegrees(flip * f5 * -20.0F)); transformTool(ms, flip, equipProgress, recoil, pt); firstPersonRenderer.renderItem(mc.player, heldItem, - rightHand ? ItemTransforms.TransformType.FIRST_PERSON_RIGHT_HAND - : ItemTransforms.TransformType.FIRST_PERSON_LEFT_HAND, + rightHand ? ItemDisplayContext.FIRST_PERSON_RIGHT_HAND + : ItemDisplayContext.FIRST_PERSON_LEFT_HAND, !rightHand, ms, buffer, light); ms.popPose(); diff --git a/src/main/java/com/simibubi/create/content/equipment/zapper/ZapperInteractionHandler.java b/src/main/java/com/simibubi/create/content/equipment/zapper/ZapperInteractionHandler.java index cbccf8228..9a930b0f7 100644 --- a/src/main/java/com/simibubi/create/content/equipment/zapper/ZapperInteractionHandler.java +++ b/src/main/java/com/simibubi/create/content/equipment/zapper/ZapperInteractionHandler.java @@ -49,14 +49,14 @@ public class ZapperInteractionHandler { .add(0, player.getEyeHeight(), 0); Vec3 range = player.getLookAngle() .scale(getRange(stack)); - BlockHitResult raytrace = player.level + BlockHitResult raytrace = player.level() .clip(new ClipContext(start, start.add(range), Block.OUTLINE, Fluid.NONE, player)); BlockPos pos = raytrace.getBlockPos(); if (pos == null) return false; - player.level.destroyBlockProgress(player.getId(), pos, -1); - BlockState newState = player.level.getBlockState(pos); + player.level().destroyBlockProgress(player.getId(), pos, -1); + BlockState newState = player.level().getBlockState(pos); if (BlockHelper.getRequiredItem(newState) .isEmpty()) @@ -79,7 +79,7 @@ public class ZapperInteractionHandler { newState = newState.setValue(BlockStateProperties.WATERLOGGED, false); CompoundTag data = null; - BlockEntity blockEntity = player.level.getBlockEntity(pos); + BlockEntity blockEntity = player.level().getBlockEntity(pos); if (blockEntity != null) { data = blockEntity.saveWithFullMetadata(); data.remove("x"); @@ -88,7 +88,7 @@ public class ZapperInteractionHandler { data.remove("id"); } CompoundTag tag = stack.getOrCreateTag(); - if (tag.contains("BlockUsed") && NbtUtils.readBlockState(player.level.holderLookup(Registries.BLOCK), stack.getTag() + if (tag.contains("BlockUsed") && NbtUtils.readBlockState(player.level().holderLookup(Registries.BLOCK), stack.getTag() .getCompound("BlockUsed")) == newState && Objects.equals(data, tag.get("BlockData"))) { return false; } @@ -99,7 +99,7 @@ public class ZapperInteractionHandler { else tag.put("BlockData", data); - AllSoundEvents.CONFIRM.playOnServer(player.level, player.blockPosition()); + AllSoundEvents.CONFIRM.playOnServer(player.level(), player.blockPosition()); return true; } diff --git a/src/main/java/com/simibubi/create/content/equipment/zapper/ZapperItemRenderer.java b/src/main/java/com/simibubi/create/content/equipment/zapper/ZapperItemRenderer.java index a77d87407..c017fa6fa 100644 --- a/src/main/java/com/simibubi/create/content/equipment/zapper/ZapperItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/equipment/zapper/ZapperItemRenderer.java @@ -8,11 +8,11 @@ import com.simibubi.create.foundation.item.render.PartialItemModelRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.NbtUtils; import net.minecraft.util.Mth; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.CrossCollisionBlock; import net.minecraft.world.level.block.state.BlockState; @@ -20,10 +20,10 @@ import net.minecraft.world.level.block.state.BlockState; public abstract class ZapperItemRenderer extends CustomRenderedItemModelRenderer { @Override - protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, TransformType transformType, + protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, ItemDisplayContext transformType, PoseStack ms, MultiBufferSource buffer, int light, int overlay) { // Block indicator - if (transformType == TransformType.GUI && stack.hasTag() && stack.getTag() + if (transformType == ItemDisplayContext.GUI && stack.hasTag() && stack.getTag() .contains("BlockUsed")) renderBlockUsed(stack, ms, buffer, light, overlay); } @@ -47,7 +47,7 @@ public abstract class ZapperItemRenderer extends CustomRenderedItemModelRenderer Minecraft.getInstance() .getItemRenderer() - .render(new ItemStack(state.getBlock()), TransformType.NONE, false, ms, buffer, light, overlay, + .render(new ItemStack(state.getBlock()), ItemDisplayContext.NONE, false, ms, buffer, light, overlay, modelForState); ms.popPose(); } diff --git a/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/DynamicBrush.java b/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/DynamicBrush.java index a2f81cab5..a7aacdef3 100644 --- a/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/DynamicBrush.java +++ b/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/DynamicBrush.java @@ -107,8 +107,7 @@ public class DynamicBrush extends Brush { continue; if (stateToReplace.getBlock() != state.getBlock() && !fuzzy) continue; - if (stateToReplace.getMaterial() - .isReplaceable()) + if (stateToReplace.canBeReplaced()) continue; if (BlockHelper.hasBlockSolidSide(stateAboveStateToReplace, world, currentPos.relative(targetFace), targetFace.getOpposite()) && surface) @@ -126,13 +125,11 @@ public class DynamicBrush extends Brush { BlockState stateToPlaceOn = world.getBlockState(currentPos.relative(targetFace.getOpposite())); // Criteria - if (stateToPlaceOn.getMaterial() - .isReplaceable()) + if (stateToPlaceOn.canBeReplaced()) continue; if (stateToPlaceOn.getBlock() != state.getBlock() && !fuzzy) continue; - if (!stateToPlaceAt.getMaterial() - .isReplaceable()) + if (!stateToPlaceAt.canBeReplaced()) continue; affectedPositions.add(currentPos); diff --git a/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/TerrainTools.java b/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/TerrainTools.java index b8014073d..c56212938 100644 --- a/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/TerrainTools.java +++ b/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/TerrainTools.java @@ -92,7 +92,7 @@ public enum TerrainTools { } public static boolean isReplaceable(BlockState toReplace) { - return toReplace.getMaterial().isReplaceable(); + return toReplace.canBeReplaced(); } } diff --git a/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/WorldshaperItemRenderer.java b/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/WorldshaperItemRenderer.java index f68d51435..ce66cee73 100644 --- a/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/WorldshaperItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/WorldshaperItemRenderer.java @@ -15,9 +15,9 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.util.Mth; import net.minecraft.world.entity.HumanoidArm; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; public class WorldshaperItemRenderer extends ZapperItemRenderer { @@ -27,7 +27,7 @@ public class WorldshaperItemRenderer extends ZapperItemRenderer { protected static final PartialModel ACCELERATOR = new PartialModel(Create.asResource("item/handheld_worldshaper/accelerator")); @Override - protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, ItemTransforms.TransformType transformType, + protected void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, ItemDisplayContext transformType, PoseStack ms, MultiBufferSource buffer, int light, int overlay) { super.render(stack, model, renderer, transformType, ms, buffer, light, overlay); diff --git a/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/WorldshaperRenderHandler.java b/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/WorldshaperRenderHandler.java index 8d8ef054d..48c5d2358 100644 --- a/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/WorldshaperRenderHandler.java +++ b/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/WorldshaperRenderHandler.java @@ -79,7 +79,7 @@ public class WorldshaperRenderHandler { .add(0, player.getEyeHeight(), 0); Vec3 range = player.getLookAngle() .scale(128); - BlockHitResult raytrace = player.level + BlockHitResult raytrace = player.level() .clip(new ClipContext(start, start.add(range), Block.OUTLINE, Fluid.NONE, player)); if (raytrace == null || raytrace.getType() == Type.MISS) { renderedPositions = null; @@ -89,7 +89,7 @@ public class WorldshaperRenderHandler { BlockPos pos = raytrace.getBlockPos() .offset(brush.getOffset(player.getLookAngle(), raytrace.getDirection(), placement)); renderedPositions = - () -> brush.addToGlobalPositions(player.level, pos, raytrace.getDirection(), new ArrayList<>(), tool); + () -> brush.addToGlobalPositions(player.level(), pos, raytrace.getDirection(), new ArrayList<>(), tool); } } diff --git a/src/main/java/com/simibubi/create/content/fluids/FlowSource.java b/src/main/java/com/simibubi/create/content/fluids/FlowSource.java index 5f3e94212..93f37122b 100644 --- a/src/main/java/com/simibubi/create/content/fluids/FlowSource.java +++ b/src/main/java/com/simibubi/create/content/fluids/FlowSource.java @@ -8,9 +8,9 @@ import com.simibubi.create.foundation.utility.BlockFace; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; @@ -72,7 +72,7 @@ public abstract class FlowSource { return; BlockEntity blockEntity = world.getBlockEntity(location.getConnectedPos()); if (blockEntity != null) - fluidHandler = blockEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, + fluidHandler = blockEntity.getCapability(ForgeCapabilities.FLUID_HANDLER, location.getOppositeFace()); } diff --git a/src/main/java/com/simibubi/create/content/fluids/FluidPropagator.java b/src/main/java/com/simibubi/create/content/fluids/FluidPropagator.java index bad5e0007..5d9098a95 100644 --- a/src/main/java/com/simibubi/create/content/fluids/FluidPropagator.java +++ b/src/main/java/com/simibubi/create/content/fluids/FluidPropagator.java @@ -35,8 +35,8 @@ import net.minecraft.world.level.block.LiquidBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; public class FluidPropagator { @@ -181,8 +181,7 @@ public class FluidPropagator { return false; if (hasFluidCapability(reader, connectedPos, side.getOpposite())) return false; - if (!(connectedState.getMaterial() - .isReplaceable() && connectedState.getDestroySpeed(reader, connectedPos) != -1) + if (!(connectedState.canBeReplaced() && connectedState.getDestroySpeed(reader, connectedPos) != -1) && !connectedState.hasProperty(BlockStateProperties.WATERLOGGED)) return false; return true; @@ -205,7 +204,7 @@ public class FluidPropagator { if (blockEntity == null) return false; LazyOptional capability = - blockEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side); + blockEntity.getCapability(ForgeCapabilities.FLUID_HANDLER, side); return capability.isPresent(); } diff --git a/src/main/java/com/simibubi/create/content/fluids/OpenEndedPipe.java b/src/main/java/com/simibubi/create/content/fluids/OpenEndedPipe.java index d2bea4eb2..9471b6c23 100644 --- a/src/main/java/com/simibubi/create/content/fluids/OpenEndedPipe.java +++ b/src/main/java/com/simibubi/create/content/fluids/OpenEndedPipe.java @@ -149,8 +149,7 @@ public class OpenEndedPipe extends FlowSource { return drainBlock; } - if (!waterlog && !state.getMaterial() - .isReplaceable()) + if (!waterlog && !state.canBeReplaced()) return empty; if (fluidState.isEmpty() || !fluidState.isSource()) return empty; @@ -183,8 +182,7 @@ public class OpenEndedPipe extends FlowSource { FluidState fluidState = state.getFluidState(); boolean waterlog = state.hasProperty(WATERLOGGED); - if (!waterlog && !state.getMaterial() - .isReplaceable()) + if (!waterlog && !state.canBeReplaced()) return false; if (fluid.isEmpty()) return false; diff --git a/src/main/java/com/simibubi/create/content/fluids/drain/ItemDrainBlock.java b/src/main/java/com/simibubi/create/content/fluids/drain/ItemDrainBlock.java index 3ca89cfc2..5cd049aa3 100644 --- a/src/main/java/com/simibubi/create/content/fluids/drain/ItemDrainBlock.java +++ b/src/main/java/com/simibubi/create/content/fluids/drain/ItemDrainBlock.java @@ -32,7 +32,7 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; +import net.minecraftforge.common.capabilities.ForgeCapabilities; public class ItemDrainBlock extends Block implements IWrenchable, IBE { @@ -46,7 +46,7 @@ public class ItemDrainBlock extends Block implements IWrenchable, IBE tooltip, boolean isPlayerSneaking) { - return containedFluidTooltip(tooltip, isPlayerSneaking, getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)); + return containedFluidTooltip(tooltip, isPlayerSneaking, getCapability(ForgeCapabilities.FLUID_HANDLER)); } } diff --git a/src/main/java/com/simibubi/create/content/fluids/drain/ItemDrainRenderer.java b/src/main/java/com/simibubi/create/content/fluids/drain/ItemDrainRenderer.java index e0e27a18a..2ac238835 100644 --- a/src/main/java/com/simibubi/create/content/fluids/drain/ItemDrainRenderer.java +++ b/src/main/java/com/simibubi/create/content/fluids/drain/ItemDrainRenderer.java @@ -16,12 +16,12 @@ import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.core.Direction; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; @@ -116,7 +116,7 @@ public class ItemDrainRenderer extends SmartBlockEntityRenderer 0 && level.getBlockState(worldPosition.below(ceil)) - .getMaterial() - .isReplaceable()) { + .canBeReplaced()) { isMoving = true; drainer.reset(); filler.reset(); diff --git a/src/main/java/com/simibubi/create/content/fluids/particle/BasinFluidParticle.java b/src/main/java/com/simibubi/create/content/fluids/particle/BasinFluidParticle.java index 7e0141c83..68b370e68 100644 --- a/src/main/java/com/simibubi/create/content/fluids/particle/BasinFluidParticle.java +++ b/src/main/java/com/simibubi/create/content/fluids/particle/BasinFluidParticle.java @@ -34,7 +34,7 @@ public class BasinFluidParticle extends FluidStackParticle { quadSize = 0; lifetime = 60; Vec3 currentPos = new Vec3(x, y, z); - basinPos = new BlockPos(currentPos); + basinPos = BlockPos.containing(currentPos); centerOfBasin = VecHelper.getCenterOf(basinPos); if (vx != 0) { diff --git a/src/main/java/com/simibubi/create/content/fluids/pump/PumpBlockEntity.java b/src/main/java/com/simibubi/create/content/fluids/pump/PumpBlockEntity.java index 3d7aca5a9..58ab21c99 100644 --- a/src/main/java/com/simibubi/create/content/fluids/pump/PumpBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/fluids/pump/PumpBlockEntity.java @@ -33,8 +33,8 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; public class PumpBlockEntity extends KineticBlockEntity { @@ -288,7 +288,7 @@ public class PumpBlockEntity extends KineticBlockEntity { // fluid handler endpoint if (blockEntity != null) { LazyOptional capability = - blockEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, face.getOpposite()); + blockEntity.getCapability(ForgeCapabilities.FLUID_HANDLER, face.getOpposite()); if (capability.isPresent()) return true; } diff --git a/src/main/java/com/simibubi/create/content/fluids/spout/SpoutBlockEntity.java b/src/main/java/com/simibubi/create/content/fluids/spout/SpoutBlockEntity.java index 56af6c4e8..6f110f19d 100644 --- a/src/main/java/com/simibubi/create/content/fluids/spout/SpoutBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/fluids/spout/SpoutBlockEntity.java @@ -35,9 +35,9 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; public class SpoutBlockEntity extends SmartBlockEntity implements IHaveGoggleInformation { @@ -184,7 +184,7 @@ public class SpoutBlockEntity extends SmartBlockEntity implements IHaveGoggleInf @Override public LazyOptional getCapability(Capability cap, Direction side) { - if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY && side != Direction.DOWN) + if (cap == ForgeCapabilities.FLUID_HANDLER && side != Direction.DOWN) return tank.getCapability() .cast(); return super.getCapability(cap, side); @@ -253,6 +253,6 @@ public class SpoutBlockEntity extends SmartBlockEntity implements IHaveGoggleInf @Override public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { return containedFluidTooltip(tooltip, isPlayerSneaking, - getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)); + getCapability(ForgeCapabilities.FLUID_HANDLER)); } } diff --git a/src/main/java/com/simibubi/create/content/fluids/tank/FluidTankBlock.java b/src/main/java/com/simibubi/create/content/fluids/tank/FluidTankBlock.java index 203f80496..b2b29a87f 100644 --- a/src/main/java/com/simibubi/create/content/fluids/tank/FluidTankBlock.java +++ b/src/main/java/com/simibubi/create/content/fluids/tank/FluidTankBlock.java @@ -49,10 +49,10 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.ForgeSoundType; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; public class FluidTankBlock extends Block implements IWrenchable, IBE { @@ -159,7 +159,7 @@ public class FluidTankBlock extends Block implements IWrenchable, IBE tankCapability = be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY); + LazyOptional tankCapability = be.getCapability(ForgeCapabilities.FLUID_HANDLER); if (!tankCapability.isPresent()) return InteractionResult.PASS; IFluidHandler fluidTank = tankCapability.orElse(null); diff --git a/src/main/java/com/simibubi/create/content/fluids/tank/FluidTankBlockEntity.java b/src/main/java/com/simibubi/create/content/fluids/tank/FluidTankBlockEntity.java index 9fed91f5a..998c62cd6 100644 --- a/src/main/java/com/simibubi/create/content/fluids/tank/FluidTankBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/fluids/tank/FluidTankBlockEntity.java @@ -29,11 +29,11 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidType; import net.minecraftforge.fluids.IFluidTank; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; import net.minecraftforge.fluids.capability.templates.FluidTank; @@ -377,7 +377,7 @@ public class FluidTankBlockEntity extends SmartBlockEntity implements IHaveGoggl if (controllerBE.boiler.addToGoggleTooltip(tooltip, isPlayerSneaking, controllerBE.getTotalTankSize())) return true; return containedFluidTooltip(tooltip, isPlayerSneaking, - controllerBE.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)); + controllerBE.getCapability(ForgeCapabilities.FLUID_HANDLER)); } @Override @@ -479,7 +479,7 @@ public class FluidTankBlockEntity extends SmartBlockEntity implements IHaveGoggl public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { if (!fluidCapability.isPresent()) refreshCapability(); - if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + if (cap == ForgeCapabilities.FLUID_HANDLER) return fluidCapability.cast(); return super.getCapability(cap, side); } diff --git a/src/main/java/com/simibubi/create/content/fluids/tank/FluidTankItem.java b/src/main/java/com/simibubi/create/content/fluids/tank/FluidTankItem.java index b5df74db5..3dc6d500c 100644 --- a/src/main/java/com/simibubi/create/content/fluids/tank/FluidTankItem.java +++ b/src/main/java/com/simibubi/create/content/fluids/tank/FluidTankItem.java @@ -104,8 +104,7 @@ public class FluidTankItem extends BlockItem { BlockState blockState = world.getBlockState(offsetPos); if (FluidTankBlock.isTank(blockState)) continue; - if (!blockState.getMaterial() - .isReplaceable()) + if (!blockState.canBeReplaced()) return; tanksToPlace++; } diff --git a/src/main/java/com/simibubi/create/content/fluids/transfer/FluidFillingBehaviour.java b/src/main/java/com/simibubi/create/content/fluids/transfer/FluidFillingBehaviour.java index 398619387..ad75bd7bd 100644 --- a/src/main/java/com/simibubi/create/content/fluids/transfer/FluidFillingBehaviour.java +++ b/src/main/java/com/simibubi/create/content/fluids/transfer/FluidFillingBehaviour.java @@ -35,7 +35,6 @@ import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; -import net.minecraft.world.level.material.Material; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.ticks.LevelTickAccess; import net.minecraft.world.ticks.LevelTicks; @@ -281,14 +280,13 @@ public class FluidFillingBehaviour extends FluidManipulationBehaviour { } // From FlowingFluidBlock#isBlocked - protected boolean canBeReplacedByFluid(BlockGetter world, BlockPos pos, BlockState state) { - Block block = state.getBlock(); - if (!(block instanceof DoorBlock) && !state.is(BlockTags.SIGNS) && block != Blocks.LADDER - && block != Blocks.SUGAR_CANE && block != Blocks.BUBBLE_COLUMN) { - Material material = state.getMaterial(); - if (material != Material.PORTAL && material != Material.STRUCTURAL_AIR && material != Material.WATER_PLANT - && material != Material.REPLACEABLE_WATER_PLANT) { - return !material.blocksMotion(); + protected boolean canBeReplacedByFluid(BlockGetter world, BlockPos pos, BlockState pState) { + Block block = pState.getBlock(); + if (!(block instanceof DoorBlock) && !pState.is(BlockTags.SIGNS) && !pState.is(Blocks.LADDER) + && !pState.is(Blocks.SUGAR_CANE) && !pState.is(Blocks.BUBBLE_COLUMN)) { + if (!pState.is(Blocks.NETHER_PORTAL) && !pState.is(Blocks.END_PORTAL) && !pState.is(Blocks.END_GATEWAY) + && !pState.is(Blocks.STRUCTURE_VOID)) { + return !pState.blocksMotion(); } else { return false; } diff --git a/src/main/java/com/simibubi/create/content/fluids/transfer/GenericItemEmptying.java b/src/main/java/com/simibubi/create/content/fluids/transfer/GenericItemEmptying.java index d9e3d9aa4..5f4ed03c1 100644 --- a/src/main/java/com/simibubi/create/content/fluids/transfer/GenericItemEmptying.java +++ b/src/main/java/com/simibubi/create/content/fluids/transfer/GenericItemEmptying.java @@ -11,9 +11,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.PotionItem; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.level.Level; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.items.ItemStackHandler; @@ -33,7 +33,7 @@ public class GenericItemEmptying { return true; LazyOptional capability = - stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); + stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM); IFluidHandlerItem tank = capability.orElse(null); if (tank == null) return false; @@ -67,7 +67,7 @@ public class GenericItemEmptying { ItemStack split = stack.copy(); split.setCount(1); LazyOptional capability = - split.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); + split.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM); IFluidHandlerItem tank = capability.orElse(null); if (tank == null) return Pair.of(resultingFluid, resultingItem); diff --git a/src/main/java/com/simibubi/create/content/fluids/transfer/GenericItemFilling.java b/src/main/java/com/simibubi/create/content/fluids/transfer/GenericItemFilling.java index 4a7ad0580..55d351cba 100644 --- a/src/main/java/com/simibubi/create/content/fluids/transfer/GenericItemFilling.java +++ b/src/main/java/com/simibubi/create/content/fluids/transfer/GenericItemFilling.java @@ -15,9 +15,9 @@ import net.minecraft.world.item.alchemy.Potions; import net.minecraft.world.level.Level; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluids; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fluids.capability.wrappers.FluidBucketWrapper; @@ -58,7 +58,7 @@ public class GenericItemFilling { return false; LazyOptional capability = - stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); + stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM); IFluidHandlerItem tank = capability.orElse(null); if (tank == null) return false; @@ -79,7 +79,7 @@ public class GenericItemFilling { return 1000; LazyOptional capability = - stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); + stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM); IFluidHandlerItem tank = capability.orElse(null); if (tank == null) return -1; @@ -134,7 +134,7 @@ public class GenericItemFilling { ItemStack split = stack.copy(); split.setCount(1); LazyOptional capability = - split.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); + split.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM); IFluidHandlerItem tank = capability.orElse(null); if (tank == null) return ItemStack.EMPTY; diff --git a/src/main/java/com/simibubi/create/content/kinetics/base/BlockBreakingKineticBlockEntity.java b/src/main/java/com/simibubi/create/content/kinetics/base/BlockBreakingKineticBlockEntity.java index b2159fd7b..1163bb611 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/base/BlockBreakingKineticBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/kinetics/base/BlockBreakingKineticBlockEntity.java @@ -129,8 +129,7 @@ public abstract class BlockBreakingKineticBlockEntity extends KineticBlockEntity } public static boolean isBreakable(BlockState stateToBreak, float blockHardness) { - return !(stateToBreak.getMaterial() - .isLiquid() || stateToBreak.getBlock() instanceof AirBlock || blockHardness == -1); + return !(stateToBreak.liquid() || stateToBreak.getBlock() instanceof AirBlock || blockHardness == -1); } public void onBlockBroken(BlockState stateToBreak) { diff --git a/src/main/java/com/simibubi/create/content/kinetics/belt/BeltBlock.java b/src/main/java/com/simibubi/create/content/kinetics/belt/BeltBlock.java index 92656133a..224988808 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/belt/BeltBlock.java +++ b/src/main/java/com/simibubi/create/content/kinetics/belt/BeltBlock.java @@ -85,7 +85,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.extensions.common.IClientBlockExtensions; import net.minecraftforge.common.Tags; -import net.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.items.IItemHandler; public class BeltBlock extends HorizontalKineticBlock @@ -209,7 +209,7 @@ public class BeltBlock extends HorizontalKineticBlock return; withBlockEntityDo(worldIn, pos, be -> { ItemEntity itemEntity = (ItemEntity) entityIn; - IItemHandler handler = be.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + IItemHandler handler = be.getCapability(ForgeCapabilities.ITEM_HANDLER) .orElse(null); if (handler == null) return; diff --git a/src/main/java/com/simibubi/create/content/kinetics/belt/BeltBlockEntity.java b/src/main/java/com/simibubi/create/content/kinetics/belt/BeltBlockEntity.java index 5cea7e684..d0c2f0ac4 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/belt/BeltBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/kinetics/belt/BeltBlockEntity.java @@ -55,9 +55,9 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.model.data.ModelData; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; public class BeltBlockEntity extends KineticBlockEntity { @@ -185,7 +185,7 @@ public class BeltBlockEntity extends KineticBlockEntity { public LazyOptional getCapability(Capability cap, Direction side) { if (!isRemoved() && !itemHandler.isPresent()) initializeItemHandler(); - if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + if (cap == ForgeCapabilities.ITEM_HANDLER) { if (side == Direction.UP || BeltBlock.canAccessFromSide(side, getBlockState())) { return itemHandler.cast(); } diff --git a/src/main/java/com/simibubi/create/content/kinetics/belt/BeltHelper.java b/src/main/java/com/simibubi/create/content/kinetics/belt/BeltHelper.java index 07430e5e7..333b57e03 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/belt/BeltHelper.java +++ b/src/main/java/com/simibubi/create/content/kinetics/belt/BeltHelper.java @@ -12,12 +12,12 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; +import net.minecraftforge.common.capabilities.ForgeCapabilities; public class BeltHelper { public static boolean isItemUpright(ItemStack stack) { - return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY) + return stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM) .isPresent() || AllItemTags.UPRIGHT_ON_BELT.matches(stack); } diff --git a/src/main/java/com/simibubi/create/content/kinetics/belt/BeltRenderer.java b/src/main/java/com/simibubi/create/content/kinetics/belt/BeltRenderer.java index baeb34e6d..83e490f0e 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/belt/BeltRenderer.java +++ b/src/main/java/com/simibubi/create/content/kinetics/belt/BeltRenderer.java @@ -27,7 +27,6 @@ import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.core.Direction; @@ -36,6 +35,7 @@ import net.minecraft.core.Vec3i; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; @@ -288,7 +288,7 @@ public class BeltRenderer extends SafeBlockEntityRenderer { } ms.scale(.5f, .5f, .5f); - itemRenderer.renderStatic(null, transported.stack, TransformType.FIXED, false, ms, buffer, be.getLevel(), stackLight, overlay, 0); + itemRenderer.renderStatic(null, transported.stack, ItemDisplayContext.FIXED, false, ms, buffer, be.getLevel(), stackLight, overlay, 0); ms.popPose(); if (!renderUpright) { diff --git a/src/main/java/com/simibubi/create/content/kinetics/belt/BeltSlicer.java b/src/main/java/com/simibubi/create/content/kinetics/belt/BeltSlicer.java index f2f59e6a7..6fcaf8aa0 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/belt/BeltSlicer.java +++ b/src/main/java/com/simibubi/create/content/kinetics/belt/BeltSlicer.java @@ -67,7 +67,7 @@ public class BeltSlicer { if (beltLength == 2) return InteractionResult.FAIL; - BlockPos beltVector = new BlockPos(BeltHelper.getBeltVector(state)); + BlockPos beltVector = BlockPos.containing(BeltHelper.getBeltVector(state)); BeltPart part = state.getValue(BeltBlock.PART); List beltChain = BeltBlock.getBeltChain(world, controllerBE.getBlockPos()); boolean creative = player.isCreative(); @@ -246,7 +246,7 @@ public class BeltSlicer { if (beltLength == BeltConnectorItem.maxLength()) return InteractionResult.FAIL; - BlockPos beltVector = new BlockPos(BeltHelper.getBeltVector(state)); + BlockPos beltVector = BlockPos.containing(BeltHelper.getBeltVector(state)); BeltPart part = state.getValue(BeltBlock.PART); Direction facing = state.getValue(BeltBlock.HORIZONTAL_FACING); List beltChain = BeltBlock.getBeltChain(world, controllerBE.getBlockPos()); @@ -261,8 +261,7 @@ public class BeltSlicer { // Merge Belts / Extend at End BlockState nextState = world.getBlockState(next); - if (!nextState.getMaterial() - .isReplaceable()) { + if (!nextState.canBeReplaced()) { if (!AllBlocks.BELT.has(nextState)) return InteractionResult.FAIL; if (!beltStatesCompatible(state, nextState)) diff --git a/src/main/java/com/simibubi/create/content/kinetics/belt/behaviour/DirectBeltInputBehaviour.java b/src/main/java/com/simibubi/create/content/kinetics/belt/behaviour/DirectBeltInputBehaviour.java index f48f69cf0..c24a316aa 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/belt/behaviour/DirectBeltInputBehaviour.java +++ b/src/main/java/com/simibubi/create/content/kinetics/belt/behaviour/DirectBeltInputBehaviour.java @@ -19,8 +19,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; @@ -64,7 +64,7 @@ public class DirectBeltInputBehaviour extends BlockEntityBehaviour { } private ItemStack defaultInsertionCallback(TransportedItemStack inserted, Direction side, boolean simulate) { - LazyOptional lazy = blockEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side); + LazyOptional lazy = blockEntity.getCapability(ForgeCapabilities.ITEM_HANDLER, side); if (!lazy.isPresent()) return inserted.stack; return ItemHandlerHelper.insertItemStacked(lazy.orElse(null), inserted.stack.copy(), simulate); diff --git a/src/main/java/com/simibubi/create/content/kinetics/belt/item/BeltConnectorHandler.java b/src/main/java/com/simibubi/create/content/kinetics/belt/item/BeltConnectorHandler.java index 29e88f305..f4b184fe8 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/belt/item/BeltConnectorHandler.java +++ b/src/main/java/com/simibubi/create/content/kinetics/belt/item/BeltConnectorHandler.java @@ -71,8 +71,7 @@ public class BeltConnectorHandler { BlockPos selected = ((BlockHitResult) rayTrace).getBlockPos(); if (world.getBlockState(selected) - .getMaterial() - .isReplaceable()) + .canBeReplaced()) return; if (!ShaftBlock.isShaft(world.getBlockState(selected))) selected = selected.relative(((BlockHitResult) rayTrace).getDirection()); diff --git a/src/main/java/com/simibubi/create/content/kinetics/belt/item/BeltConnectorItem.java b/src/main/java/com/simibubi/create/content/kinetics/belt/item/BeltConnectorItem.java index a2b78fcf4..70941826f 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/belt/item/BeltConnectorItem.java +++ b/src/main/java/com/simibubi/create/content/kinetics/belt/item/BeltConnectorItem.java @@ -111,7 +111,7 @@ public class BeltConnectorItem extends BlockItem { } public static void createBelts(Level world, BlockPos start, BlockPos end) { - world.playSound(null, new BlockPos(VecHelper.getCenterOf(start.offset(end)) + world.playSound(null, BlockPos.containing(VecHelper.getCenterOf(start.offset(end)) .scale(.5f)), SoundEvents.WOOL_PLACE, SoundSource.BLOCKS, 0.5F, 1F); BeltSlope slope = getSlopeBetween(start, end); @@ -141,8 +141,7 @@ public class BeltConnectorItem extends BlockItem { if (pulley && shaftState.getValue(AbstractSimpleShaftBlock.AXIS) == Axis.Y) slope = BeltSlope.SIDEWAYS; - if (!existingBlock.getMaterial() - .isReplaceable()) + if (!existingBlock.canBeReplaced()) world.destroyBlock(pos, false); KineticBlockEntity.switchToBlockState(world, pos, @@ -247,15 +246,14 @@ public class BeltConnectorItem extends BlockItem { if (Math.signum(speed1) != Math.signum(speed2) && speed1 != 0 && speed2 != 0) return false; - BlockPos step = new BlockPos(Math.signum(diff.getX()), Math.signum(diff.getY()), Math.signum(diff.getZ())); + BlockPos step = BlockPos.containing(Math.signum(diff.getX()), Math.signum(diff.getY()), Math.signum(diff.getZ())); int limit = 1000; for (BlockPos currentPos = first.offset(step); !currentPos.equals(second) && limit-- > 0; currentPos = currentPos.offset(step)) { BlockState blockState = world.getBlockState(currentPos); if (ShaftBlock.isShaft(blockState) && blockState.getValue(AbstractSimpleShaftBlock.AXIS) == shaftAxis) continue; - if (!blockState.getMaterial() - .isReplaceable()) + if (!blockState.canBeReplaced()) return false; } diff --git a/src/main/java/com/simibubi/create/content/kinetics/crafter/MechanicalCrafterBlock.java b/src/main/java/com/simibubi/create/content/kinetics/crafter/MechanicalCrafterBlock.java index 34e6f4814..968608871 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/crafter/MechanicalCrafterBlock.java +++ b/src/main/java/com/simibubi/create/content/kinetics/crafter/MechanicalCrafterBlock.java @@ -35,8 +35,8 @@ import net.minecraft.world.level.block.state.StateDefinition.Builder; import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemStackHandler; @@ -193,7 +193,7 @@ public class MechanicalCrafterBlock extends HorizontalKineticBlock } LazyOptional capability = - crafter.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY); + crafter.getCapability(ForgeCapabilities.ITEM_HANDLER); if (!capability.isPresent()) return InteractionResult.PASS; ItemStack remainder = diff --git a/src/main/java/com/simibubi/create/content/kinetics/crafter/MechanicalCrafterRenderer.java b/src/main/java/com/simibubi/create/content/kinetics/crafter/MechanicalCrafterRenderer.java index fd0577c14..411710b7e 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/crafter/MechanicalCrafterRenderer.java +++ b/src/main/java/com/simibubi/create/content/kinetics/crafter/MechanicalCrafterRenderer.java @@ -23,11 +23,11 @@ import com.simibubi.create.foundation.utility.Pointing; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.util.Mth; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; @@ -76,7 +76,7 @@ public class MechanicalCrafterRenderer extends SafeBlockEntityRenderer LazyOptional getCapability(Capability cap, Direction side) { - if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + if (cap == ForgeCapabilities.ITEM_HANDLER) return handler.cast(); return super.getCapability(cap, side); } diff --git a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerActorInstance.java b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerActorInstance.java index 7ec5e1a2b..d7f10491e 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerActorInstance.java +++ b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerActorInstance.java @@ -88,7 +88,7 @@ public class DeployerActorInstance extends ActorInstance { } else if (context.contraption.stalled || context.position == null || context.data.contains("StationaryTimer")) { factor = Mth.sin(AnimationTickHolder.getRenderTime() * .5f) * .25f + .25f; } else { - Vec3 center = VecHelper.getCenterOf(new BlockPos(context.position)); + Vec3 center = VecHelper.getCenterOf(BlockPos.containing(context.position)); double distance = context.position.distanceTo(center); double nextDistance = context.position.add(context.motion) .distanceTo(center); diff --git a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerBlock.java b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerBlock.java index 3b0195743..cb7573195 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerBlock.java +++ b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerBlock.java @@ -192,8 +192,7 @@ public class DeployerBlock extends DirectionalAxisKineticBlock implements IBE world.getBlockState(pos.relative(dir)) - .getMaterial() - .isReplaceable()); + .canBeReplaced()); if (directions.isEmpty()) return PlacementOffset.fail(); diff --git a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerBlockEntity.java b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerBlockEntity.java index 26363adb3..25c028fa6 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerBlockEntity.java @@ -314,7 +314,7 @@ public class DeployerBlockEntity extends KineticBlockEntity { deployerBlockEntity.sendData(); award(AllAdvancements.FIST_BUMP); - BlockPos soundLocation = new BlockPos(Vec3.atCenterOf(worldPosition) + BlockPos soundLocation = BlockPos.containing(Vec3.atCenterOf(worldPosition) .add(Vec3.atCenterOf(deployerBlockEntity.getBlockPos())) .scale(.5f)); level.playSound(null, soundLocation, SoundEvents.PLAYER_ATTACK_NODAMAGE, SoundSource.BLOCKS, .75f, .75f); diff --git a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerFakePlayer.java b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerFakePlayer.java index a1242ce8b..bedf82b0f 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerFakePlayer.java +++ b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerFakePlayer.java @@ -142,8 +142,8 @@ public class DeployerFakePlayer extends FakePlayer { @Override public void remove(RemovalReason p_150097_) { - if (blockBreakingProgress != null && !level.isClientSide) - level.destroyBlockProgress(getId(), blockBreakingProgress.getKey(), -1); + if (blockBreakingProgress != null && !level().isClientSide) + level().destroyBlockProgress(getId(), blockBreakingProgress.getKey(), -1); super.remove(p_150097_); } diff --git a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerHandler.java b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerHandler.java index c6f8a6d8d..26b00dd69 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerHandler.java +++ b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerHandler.java @@ -64,7 +64,6 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluids; -import net.minecraft.world.level.material.Material; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; @@ -143,12 +142,12 @@ public class DeployerHandler { Vec3 rayOrigin = vec.add(extensionVector.scale(3 / 2f + 1 / 64f)); Vec3 rayTarget = vec.add(extensionVector.scale(5 / 2f - 1 / 64f)); player.setPos(rayOrigin.x, rayOrigin.y, rayOrigin.z); - BlockPos pos = new BlockPos(vec); + BlockPos pos = BlockPos.containing(vec); ItemStack stack = player.getMainHandItem(); Item item = stack.getItem(); // Check for entities - final ServerLevel world = player.getLevel(); + final Level world = player.level(); List entities = world.getEntitiesOfClass(Entity.class, new AABB(clickedPos)) .stream() .filter(e -> !(e instanceof AbstractContraptionEntity)) @@ -310,7 +309,7 @@ public class DeployerHandler { BlockPos newPos = result.getBlockPos(); if (!BaseFireBlock.canBePlacedAt(world, clickedPos, newFace)) newFace = Direction.UP; - if (clickedState.getMaterial() == Material.AIR) + if (clickedState.isAir()) newPos = newPos.relative(face.getOpposite()); result = new BlockHitResult(result.getLocation(), newFace, newPos, result.isInside()); itemusecontext = new UseOnContext(player, hand, result); @@ -357,7 +356,7 @@ public class DeployerHandler { public static boolean tryHarvestBlock(ServerPlayer player, ServerPlayerGameMode interactionManager, BlockPos pos) { // <> PlayerInteractionManager#tryHarvestBlock - ServerLevel world = player.getLevel(); + ServerLevel world = player.serverLevel(); BlockState blockstate = world.getBlockState(pos); GameType gameType = interactionManager.getGameModeForPlayer(); diff --git a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerMovementBehaviour.java b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerMovementBehaviour.java index 305dbde12..49da98849 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerMovementBehaviour.java @@ -115,8 +115,7 @@ public class DeployerMovementBehaviour implements MovementBehaviour { if (!filter.hasTag()) return; if (!world.getBlockState(pos) - .getMaterial() - .isReplaceable()) + .canBeReplaced()) return; CompoundTag tag = filter.getTag(); diff --git a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerRenderer.java b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerRenderer.java index b89fe89ac..e9470f565 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerRenderer.java +++ b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerRenderer.java @@ -31,7 +31,6 @@ import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.core.BlockPos; @@ -39,6 +38,7 @@ import net.minecraft.core.Direction; import net.minecraft.core.Direction.AxisDirection; import net.minecraft.util.Mth; import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; @@ -87,7 +87,7 @@ public class DeployerRenderer extends SafeBlockEntityRenderer world.getBlockState(pos.relative(dir)) - .getMaterial() - .isReplaceable()); + .canBeReplaced()); if (directions.isEmpty()) return PlacementOffset.fail(); diff --git a/src/main/java/com/simibubi/create/content/kinetics/fan/AirFlowParticle.java b/src/main/java/com/simibubi/create/content/kinetics/fan/AirFlowParticle.java index 5ea39e902..71c881c6d 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/fan/AirFlowParticle.java +++ b/src/main/java/com/simibubi/create/content/kinetics/fan/AirFlowParticle.java @@ -158,7 +158,7 @@ public class AirFlowParticle extends SimpleAnimatedParticle { } public int getLightColor(float partialTick) { - BlockPos blockpos = new BlockPos(this.x, this.y, this.z); + BlockPos blockpos = BlockPos.containing(this.x, this.y, this.z); return this.level.isLoaded(blockpos) ? LevelRenderer.getLightColor(level, blockpos) : 0; } diff --git a/src/main/java/com/simibubi/create/content/kinetics/fan/FanProcessing.java b/src/main/java/com/simibubi/create/content/kinetics/fan/FanProcessing.java index e460cd473..8b91661ec 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/fan/FanProcessing.java +++ b/src/main/java/com/simibubi/create/content/kinetics/fan/FanProcessing.java @@ -75,14 +75,14 @@ public class FanProcessing { CompoundTag processing = compound.getCompound("Processing"); if (Type.valueOf(processing.getString("Type")) != type) - return type.canProcess(entity.getItem(), entity.level); + return type.canProcess(entity.getItem(), entity.level()); else if (processing.getInt("Time") >= 0) return true; else if (processing.getInt("Time") == -1) return false; } } - return type.canProcess(entity.getItem(), entity.level); + return type.canProcess(entity.getItem(), entity.level()); } public static boolean isWashable(ItemStack stack, Level world) { @@ -100,7 +100,7 @@ public class FanProcessing { public static boolean applyProcessing(ItemEntity entity, Type type) { if (decrementProcessingTime(entity, type) != 0) return false; - List stacks = process(entity.getItem(), type, entity.level); + List stacks = process(entity.getItem(), type, entity.level()); if (stacks == null) return false; if (stacks.isEmpty()) { @@ -109,9 +109,9 @@ public class FanProcessing { } entity.setItem(stacks.remove(0)); for (ItemStack additional : stacks) { - ItemEntity entityIn = new ItemEntity(entity.level, entity.getX(), entity.getY(), entity.getZ(), additional); + ItemEntity entityIn = new ItemEntity(entity.level(), entity.getX(), entity.getY(), entity.getZ(), additional); entityIn.setDeltaMovement(entity.getDeltaMovement()); - entity.level.addFreshEntity(entityIn); + entity.level().addFreshEntity(entityIn); } return true; } diff --git a/src/main/java/com/simibubi/create/content/kinetics/mechanicalArm/ArmInteractionPoint.java b/src/main/java/com/simibubi/create/content/kinetics/mechanicalArm/ArmInteractionPoint.java index 562c59606..a0f5e849e 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/mechanicalArm/ArmInteractionPoint.java +++ b/src/main/java/com/simibubi/create/content/kinetics/mechanicalArm/ArmInteractionPoint.java @@ -16,8 +16,8 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; @@ -96,7 +96,7 @@ public class ArmInteractionPoint { BlockEntity be = level.getBlockEntity(pos); if (be == null) return null; - cachedHandler = be.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.UP); + cachedHandler = be.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.UP); } return cachedHandler.orElse(null); } diff --git a/src/main/java/com/simibubi/create/content/kinetics/mechanicalArm/ArmPlacementPacket.java b/src/main/java/com/simibubi/create/content/kinetics/mechanicalArm/ArmPlacementPacket.java index d5c053b80..8e33af2ec 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/mechanicalArm/ArmPlacementPacket.java +++ b/src/main/java/com/simibubi/create/content/kinetics/mechanicalArm/ArmPlacementPacket.java @@ -51,7 +51,7 @@ public class ArmPlacementPacket extends SimplePacketBase { ServerPlayer player = context.getSender(); if (player == null) return; - Level world = player.level; + Level world = player.level(); if (world == null || !world.isLoaded(pos)) return; BlockEntity blockEntity = world.getBlockEntity(pos); diff --git a/src/main/java/com/simibubi/create/content/kinetics/mechanicalArm/ArmRenderer.java b/src/main/java/com/simibubi/create/content/kinetics/mechanicalArm/ArmRenderer.java index 159ac1749..10bf67486 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/mechanicalArm/ArmRenderer.java +++ b/src/main/java/com/simibubi/create/content/kinetics/mechanicalArm/ArmRenderer.java @@ -16,11 +16,11 @@ import com.simibubi.create.foundation.utility.Iterate; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.util.Mth; import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; @@ -102,7 +102,7 @@ public class ArmRenderer extends KineticBlockEntityRenderer { .mul(msLocal.last() .pose()); - itemRenderer.renderStatic(item, TransformType.FIXED, light, overlay, ms, buffer, 0); + itemRenderer.renderStatic(item, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0); ms.popPose(); } diff --git a/src/main/java/com/simibubi/create/content/kinetics/millstone/MillstoneBlock.java b/src/main/java/com/simibubi/create/content/kinetics/millstone/MillstoneBlock.java index 9d28f3124..63c685251 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/millstone/MillstoneBlock.java +++ b/src/main/java/com/simibubi/create/content/kinetics/millstone/MillstoneBlock.java @@ -25,8 +25,8 @@ import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; @@ -88,7 +88,7 @@ public class MillstoneBlock extends KineticBlock implements IBE capability = millstone.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY); + LazyOptional capability = millstone.getCapability(ForgeCapabilities.ITEM_HANDLER); if (!capability.isPresent()) return; diff --git a/src/main/java/com/simibubi/create/content/kinetics/mixer/MechanicalMixerBlockEntity.java b/src/main/java/com/simibubi/create/content/kinetics/mixer/MechanicalMixerBlockEntity.java index b5f6454ad..5f9f7c03b 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/mixer/MechanicalMixerBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/kinetics/mixer/MechanicalMixerBlockEntity.java @@ -41,6 +41,7 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.crafting.IShapedRecipe; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; @@ -230,7 +231,7 @@ public class MechanicalMixerBlockEntity extends BasinOperatingBlockEntity { return matchingRecipes; IItemHandler availableItems = basinBlockEntity - .getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + .getCapability(ForgeCapabilities.ITEM_HANDLER) .orElse(null); if (availableItems == null) return matchingRecipes; diff --git a/src/main/java/com/simibubi/create/content/kinetics/press/PressingBehaviour.java b/src/main/java/com/simibubi/create/content/kinetics/press/PressingBehaviour.java index 38200d4d4..bc0fc6f17 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/press/PressingBehaviour.java +++ b/src/main/java/com/simibubi/create/content/kinetics/press/PressingBehaviour.java @@ -149,7 +149,7 @@ public class PressingBehaviour extends BeltProcessingBehaviour { for (ItemEntity itemEntity : level.getEntitiesOfClass(ItemEntity.class, new AABB(worldPosition.below()).deflate(.125f))) { - if (!itemEntity.isAlive() || !itemEntity.isOnGround()) + if (!itemEntity.isAlive() || !itemEntity.onGround()) continue; if (!specifics.tryProcessInWorld(itemEntity, true)) continue; @@ -226,7 +226,7 @@ public class PressingBehaviour extends BeltProcessingBehaviour { for (Entity entity : level.getEntities(null, bb)) { if (!(entity instanceof ItemEntity itemEntity)) continue; - if (!entity.isAlive() || !entity.isOnGround()) + if (!entity.isAlive() || !entity.onGround()) continue; entityScanCooldown = 0; diff --git a/src/main/java/com/simibubi/create/content/kinetics/saw/SawBlock.java b/src/main/java/com/simibubi/create/content/kinetics/saw/SawBlock.java index d7bcabb60..2c485916c 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/saw/SawBlock.java +++ b/src/main/java/com/simibubi/create/content/kinetics/saw/SawBlock.java @@ -172,11 +172,11 @@ public class SawBlock extends DirectionalAxisKineticBlock implements IBE { + withBlockEntityDo(entityIn.level(), pos, be -> { if (be.getSpeed() == 0) return; be.insertItem((ItemEntity) entityIn); @@ -241,8 +241,7 @@ public class SawBlock extends DirectionalAxisKineticBlock implements IBE world.getBlockState(pos.relative(dir)) - .getMaterial() - .isReplaceable()); + .canBeReplaced()); if (directions.isEmpty()) return PlacementOffset.fail(); diff --git a/src/main/java/com/simibubi/create/content/kinetics/saw/SawBlockEntity.java b/src/main/java/com/simibubi/create/content/kinetics/saw/SawBlockEntity.java index 6f1d5fbf4..a7b361c6f 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/saw/SawBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/kinetics/saw/SawBlockEntity.java @@ -64,8 +64,8 @@ import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.registries.ForgeRegistries; @@ -268,7 +268,7 @@ public class SawBlockEntity extends BlockBreakingKineticBlockEntity { @Override public LazyOptional getCapability(Capability cap, Direction side) { - if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && side != Direction.DOWN) + if (cap == ForgeCapabilities.ITEM_HANDLER && side != Direction.DOWN) return invProvider.cast(); return super.getCapability(cap, side); } diff --git a/src/main/java/com/simibubi/create/content/kinetics/saw/SawRenderer.java b/src/main/java/com/simibubi/create/content/kinetics/saw/SawRenderer.java index 5d8977553..f35dbd64b 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/saw/SawRenderer.java +++ b/src/main/java/com/simibubi/create/content/kinetics/saw/SawRenderer.java @@ -23,12 +23,12 @@ import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.Direction; import net.minecraft.util.Mth; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.state.BlockState; @@ -134,7 +134,7 @@ public class SawRenderer extends SafeBlockEntityRenderer { if (alongZ) ms.mulPose(Axis.YP.rotationDegrees(90)); ms.mulPose(Axis.XP.rotationDegrees(90)); - itemRenderer.renderStatic(stack, ItemTransforms.TransformType.FIXED, light, overlay, ms, buffer, 0); + itemRenderer.renderStatic(stack, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0); break; } diff --git a/src/main/java/com/simibubi/create/content/kinetics/simpleRelays/CogwheelBlockItem.java b/src/main/java/com/simibubi/create/content/kinetics/simpleRelays/CogwheelBlockItem.java index 921d95748..a63c7aa68 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/simpleRelays/CogwheelBlockItem.java +++ b/src/main/java/com/simibubi/create/content/kinetics/simpleRelays/CogwheelBlockItem.java @@ -95,8 +95,7 @@ public class CogwheelBlockItem extends BlockItem { continue; if (!world.getBlockState(newPos) - .getMaterial() - .isReplaceable()) + .canBeReplaced()) continue; return PlacementOffset.success(newPos, s -> s.setValue(AXIS, axis)); @@ -137,8 +136,7 @@ public class CogwheelBlockItem extends BlockItem { continue; if (!world.getBlockState(newPos) - .getMaterial() - .isReplaceable()) + .canBeReplaced()) continue; return PlacementOffset.success(newPos, s -> s.setValue(AXIS, dir.getAxis())); @@ -173,8 +171,7 @@ public class CogwheelBlockItem extends BlockItem { BlockPos newPos = pos.relative(dir) .relative(closest); if (!world.getBlockState(newPos) - .getMaterial() - .isReplaceable()) + .canBeReplaced()) continue; if (!CogWheelBlock.isValidCogwheelPosition(ICogWheel.isLargeCog(state), world, newPos, axis)) @@ -237,8 +234,7 @@ public class CogwheelBlockItem extends BlockItem { .relative(d); if (!world.getBlockState(newPos) - .getMaterial() - .isReplaceable()) + .canBeReplaced()) continue; if (!CogWheelBlock.isValidCogwheelPosition(false, world, newPos, newAxis)) @@ -291,8 +287,7 @@ public class CogwheelBlockItem extends BlockItem { BlockPos newPos = pos.relative(d); if (!world.getBlockState(newPos) - .getMaterial() - .isReplaceable()) + .canBeReplaced()) continue; if (!CogWheelBlock.isValidCogwheelPosition(false, world, newPos, newAxis)) diff --git a/src/main/java/com/simibubi/create/content/kinetics/speedController/SpeedControllerBlock.java b/src/main/java/com/simibubi/create/content/kinetics/speedController/SpeedControllerBlock.java index 911951c6c..b44628784 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/speedController/SpeedControllerBlock.java +++ b/src/main/java/com/simibubi/create/content/kinetics/speedController/SpeedControllerBlock.java @@ -94,8 +94,7 @@ public class SpeedControllerBlock extends HorizontalAxisKineticBlock implements public PlacementOffset getOffset(Player player, Level world, BlockState state, BlockPos pos, BlockHitResult ray) { BlockPos newPos = pos.above(); if (!world.getBlockState(newPos) - .getMaterial() - .isReplaceable()) + .canBeReplaced()) return PlacementOffset.fail(); Axis newAxis = state.getValue(HORIZONTAL_AXIS) == Axis.X ? Axis.Z : Axis.X; diff --git a/src/main/java/com/simibubi/create/content/kinetics/steamEngine/SteamEngineBlock.java b/src/main/java/com/simibubi/create/content/kinetics/steamEngine/SteamEngineBlock.java index 92f8f6d53..d209a8c65 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/steamEngine/SteamEngineBlock.java +++ b/src/main/java/com/simibubi/create/content/kinetics/steamEngine/SteamEngineBlock.java @@ -196,7 +196,7 @@ public class SteamEngineBlock extends FaceAttachedHorizontalDirectionalBlock } BlockState newState = world.getBlockState(shaftPos); - if (!newState.getMaterial().isReplaceable()) + if (!newState.canBeReplaced()) return PlacementOffset.fail(); Axis axis = shaft.getValue(ShaftBlock.AXIS); diff --git a/src/main/java/com/simibubi/create/content/kinetics/steamEngine/SteamJetParticle.java b/src/main/java/com/simibubi/create/content/kinetics/steamEngine/SteamJetParticle.java index 7bca4dd11..3e76dfa79 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/steamEngine/SteamJetParticle.java +++ b/src/main/java/com/simibubi/create/content/kinetics/steamEngine/SteamJetParticle.java @@ -99,7 +99,7 @@ public class SteamJetParticle extends SimpleAnimatedParticle { @Override public int getLightColor(float partialTick) { - BlockPos blockpos = new BlockPos(this.x, this.y, this.z); + BlockPos blockpos = BlockPos.containing(this.x, this.y, this.z); return this.level.isLoaded(blockpos) ? LevelRenderer.getLightColor(level, blockpos) : 0; } diff --git a/src/main/java/com/simibubi/create/content/kinetics/turntable/TurntableBlock.java b/src/main/java/com/simibubi/create/content/kinetics/turntable/TurntableBlock.java index 57efdd765..3480404c9 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/turntable/TurntableBlock.java +++ b/src/main/java/com/simibubi/create/content/kinetics/turntable/TurntableBlock.java @@ -43,7 +43,7 @@ public class TurntableBlock extends KineticBlock implements IBE 0) return; diff --git a/src/main/java/com/simibubi/create/content/kinetics/turntable/TurntableHandler.java b/src/main/java/com/simibubi/create/content/kinetics/turntable/TurntableHandler.java index 5fca562e3..4f880fe1c 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/turntable/TurntableHandler.java +++ b/src/main/java/com/simibubi/create/content/kinetics/turntable/TurntableHandler.java @@ -18,7 +18,7 @@ public class TurntableHandler { if (!AllBlocks.TURNTABLE.has(mc.level.getBlockState(pos))) return; - if (!mc.player.isOnGround()) + if (!mc.player.onGround()) return; if (mc.isPaused()) return; diff --git a/src/main/java/com/simibubi/create/content/kinetics/waterwheel/LargeWaterWheelBlock.java b/src/main/java/com/simibubi/create/content/kinetics/waterwheel/LargeWaterWheelBlock.java index 1d8ecc2c6..f899f7399 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/waterwheel/LargeWaterWheelBlock.java +++ b/src/main/java/com/simibubi/create/content/kinetics/waterwheel/LargeWaterWheelBlock.java @@ -63,8 +63,7 @@ public class LargeWaterWheelBlock extends RotatedPillarKineticBlock implements I continue; BlockState occupiedState = context.getLevel() .getBlockState(pos.offset(offset)); - if (!occupiedState.getMaterial() - .isReplaceable()) + if (!occupiedState.canBeReplaced()) return null; } } @@ -119,8 +118,7 @@ public class LargeWaterWheelBlock extends RotatedPillarKineticBlock implements I .setValue(WaterWheelStructuralBlock.FACING, targetSide.getOpposite()); if (occupiedState == requiredStructure) continue; - if (!occupiedState.getMaterial() - .isReplaceable()) { + if (!occupiedState.canBeReplaced()) { pLevel.destroyBlock(pPos, false); return; } diff --git a/src/main/java/com/simibubi/create/content/legacy/ChromaticCompoundItem.java b/src/main/java/com/simibubi/create/content/legacy/ChromaticCompoundItem.java index c79c2f07d..ef9195da5 100644 --- a/src/main/java/com/simibubi/create/content/legacy/ChromaticCompoundItem.java +++ b/src/main/java/com/simibubi/create/content/legacy/ChromaticCompoundItem.java @@ -67,7 +67,7 @@ public class ChromaticCompoundItem extends Item { @Override public boolean onEntityItemUpdate(ItemStack stack, ItemEntity entity) { - Level world = entity.level; + Level world = entity.level(); CompoundTag itemData = entity.getItem() .getOrCreateTag(); Vec3 positionVec = entity.position(); @@ -162,7 +162,7 @@ public class ChromaticCompoundItem extends Item { if (r.nextFloat() > rate) return false; - BlockPos randomOffset = new BlockPos(VecHelper.offsetRandomly(positionVec, r, range)); + BlockPos randomOffset = BlockPos.containing(VecHelper.offsetRandomly(positionVec, r, range)); BlockState state = world.getBlockState(randomOffset); TransportedItemStackHandlerBehaviour behaviour = diff --git a/src/main/java/com/simibubi/create/content/legacy/NoGravMagicalDohickyItem.java b/src/main/java/com/simibubi/create/content/legacy/NoGravMagicalDohickyItem.java index fa2fd441d..2fc2de212 100644 --- a/src/main/java/com/simibubi/create/content/legacy/NoGravMagicalDohickyItem.java +++ b/src/main/java/com/simibubi/create/content/legacy/NoGravMagicalDohickyItem.java @@ -19,7 +19,7 @@ public class NoGravMagicalDohickyItem extends Item { @Override public boolean onEntityItemUpdate(ItemStack stack, ItemEntity entity) { - Level world = entity.level; + Level world = entity.level(); Vec3 pos = entity.position(); CompoundTag persistentData = entity.getPersistentData(); diff --git a/src/main/java/com/simibubi/create/content/logistics/chute/AbstractChuteBlock.java b/src/main/java/com/simibubi/create/content/logistics/chute/AbstractChuteBlock.java index 351f5b458..aff986cb8 100644 --- a/src/main/java/com/simibubi/create/content/logistics/chute/AbstractChuteBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/chute/AbstractChuteBlock.java @@ -87,12 +87,15 @@ public abstract class AbstractChuteBlock extends Block implements IWrenchable, I super.updateEntityAfterFallOn(worldIn, entityIn); if (!(entityIn instanceof ItemEntity)) return; - if (entityIn.level.isClientSide) + if (entityIn.level().isClientSide) return; if (!entityIn.isAlive()) return; - DirectBeltInputBehaviour input = BlockEntityBehaviour.get(entityIn.level, new BlockPos(entityIn.position() - .add(0, 0.5f, 0)).below(), DirectBeltInputBehaviour.TYPE); + DirectBeltInputBehaviour input = BlockEntityBehaviour.get(entityIn.level(), + BlockPos.containing(entityIn.position() + .add(0, 0.5f, 0)) + .below(), + DirectBeltInputBehaviour.TYPE); if (input == null) return; if (!input.canInsertFromSide(Direction.UP)) diff --git a/src/main/java/com/simibubi/create/content/logistics/chute/ChuteBlockEntity.java b/src/main/java/com/simibubi/create/content/logistics/chute/ChuteBlockEntity.java index 0a1a4fd5f..c06e5f710 100644 --- a/src/main/java/com/simibubi/create/content/logistics/chute/ChuteBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/chute/ChuteBlockEntity.java @@ -50,8 +50,8 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; @@ -492,7 +492,7 @@ public class ChuteBlockEntity extends SmartBlockEntity implements IHaveGoggleInf if (side != Direction.DOWN || !(be instanceof SmartChuteBlockEntity) || getItemMotion() > 0) return LazyOptional.empty(); } - return be.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite()); + return be.getCapability(ForgeCapabilities.ITEM_HANDLER, side.getOpposite()); } public void setItem(ItemStack stack) { @@ -732,7 +732,7 @@ public class ChuteBlockEntity extends SmartBlockEntity implements IHaveGoggleInf @Override public LazyOptional getCapability(Capability cap, @Nullable Direction side) { - if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + if (cap == ForgeCapabilities.ITEM_HANDLER) return lazyHandler.cast(); return super.getCapability(cap, side); } diff --git a/src/main/java/com/simibubi/create/content/logistics/chute/ChuteItem.java b/src/main/java/com/simibubi/create/content/logistics/chute/ChuteItem.java index 0ece9042e..9e3aa1b1e 100644 --- a/src/main/java/com/simibubi/create/content/logistics/chute/ChuteItem.java +++ b/src/main/java/com/simibubi/create/content/logistics/chute/ChuteItem.java @@ -35,8 +35,7 @@ public class ChuteItem extends BlockItem { .above(); BlockState blockState = world.getBlockState(correctPos); - if (blockState.getMaterial() - .isReplaceable()) + if (blockState.canBeReplaced()) context = BlockPlaceContext.at(context, correctPos, face); else { if (!(blockState.getBlock() instanceof ChuteBlock) || world.isClientSide) diff --git a/src/main/java/com/simibubi/create/content/logistics/chute/ChuteRenderer.java b/src/main/java/com/simibubi/create/content/logistics/chute/ChuteRenderer.java index c04a44e1c..f9a162d84 100644 --- a/src/main/java/com/simibubi/create/content/logistics/chute/ChuteRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/chute/ChuteRenderer.java @@ -7,10 +7,10 @@ import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRender import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.core.Direction; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.level.block.state.BlockState; public class ChuteRenderer extends SafeBlockEntityRenderer { @@ -45,7 +45,7 @@ public class ChuteRenderer extends SafeBlockEntityRenderer { ms.scale(itemScale, itemScale, itemScale); msr.rotateX(itemPosition * 180); msr.rotateY(itemPosition * 180); - itemRenderer.renderStatic(be.item, TransformType.FIXED, light, overlay, ms, buffer, 0); + itemRenderer.renderStatic(be.item, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0); ms.popPose(); } diff --git a/src/main/java/com/simibubi/create/content/logistics/chute/SmartChuteBlockEntity.java b/src/main/java/com/simibubi/create/content/logistics/chute/SmartChuteBlockEntity.java index 0ac591938..05618057a 100644 --- a/src/main/java/com/simibubi/create/content/logistics/chute/SmartChuteBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/chute/SmartChuteBlockEntity.java @@ -59,8 +59,7 @@ public class SmartChuteBlockEntity extends ChuteBlockEntity { boolean up = getItemMotion() < 0; BlockPos chutePos = worldPosition.relative(up ? Direction.UP : Direction.DOWN); BlockState blockState = level.getBlockState(chutePos); - return !AbstractChuteBlock.isChute(blockState) && !blockState.getMaterial() - .isReplaceable(); + return !AbstractChuteBlock.isChute(blockState) && !blockState.canBeReplaced(); } } diff --git a/src/main/java/com/simibubi/create/content/logistics/crate/CreativeCrateBlockEntity.java b/src/main/java/com/simibubi/create/content/logistics/crate/CreativeCrateBlockEntity.java index 0d23295a4..fe2351061 100644 --- a/src/main/java/com/simibubi/create/content/logistics/crate/CreativeCrateBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/crate/CreativeCrateBlockEntity.java @@ -15,8 +15,8 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; public class CreativeCrateBlockEntity extends CrateBlockEntity { @@ -46,7 +46,7 @@ public class CreativeCrateBlockEntity extends CrateBlockEntity { @Override public LazyOptional getCapability(Capability cap, Direction side) { - if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + if (cap == ForgeCapabilities.ITEM_HANDLER) return itemHandler.cast(); return super.getCapability(cap, side); } diff --git a/src/main/java/com/simibubi/create/content/logistics/depot/DepotBlockEntity.java b/src/main/java/com/simibubi/create/content/logistics/depot/DepotBlockEntity.java index af3356704..c054f9204 100644 --- a/src/main/java/com/simibubi/create/content/logistics/depot/DepotBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/depot/DepotBlockEntity.java @@ -11,8 +11,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.CapabilityItemHandler; public class DepotBlockEntity extends SmartBlockEntity { @@ -30,7 +30,7 @@ public class DepotBlockEntity extends SmartBlockEntity { @Override public LazyOptional getCapability(Capability cap, Direction side) { - if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + if (cap == ForgeCapabilities.ITEM_HANDLER) return depotBehaviour.getItemCapability(cap, side); return super.getCapability(cap, side); } diff --git a/src/main/java/com/simibubi/create/content/logistics/depot/DepotRenderer.java b/src/main/java/com/simibubi/create/content/logistics/depot/DepotRenderer.java index 36ce13267..143f6d6dd 100644 --- a/src/main/java/com/simibubi/create/content/logistics/depot/DepotRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/depot/DepotRenderer.java @@ -13,12 +13,13 @@ import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; +import net.minecraft.client.renderer.block.model.ItemDisplayContext; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.core.Direction; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.Vec3; @@ -131,7 +132,7 @@ public class DepotRenderer extends SafeBlockEntityRenderer { ms.translate(0, -3 / 16f, 0); msr.rotateX(90); } - itemRenderer.renderStatic(itemStack, TransformType.FIXED, light, overlay, ms, buffer, 0); + itemRenderer.renderStatic(itemStack, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0); ms.popPose(); if (!renderUpright) { diff --git a/src/main/java/com/simibubi/create/content/logistics/depot/EjectorBlock.java b/src/main/java/com/simibubi/create/content/logistics/depot/EjectorBlock.java index a75404840..2175b885c 100644 --- a/src/main/java/com/simibubi/create/content/logistics/depot/EjectorBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/depot/EjectorBlock.java @@ -124,7 +124,7 @@ public class EjectorBlock extends HorizontalKineticBlock implements IBE { msr.translateBack(itemRotOffset); Minecraft.getInstance() .getItemRenderer() - .renderStatic(intAttached.getValue(), TransformType.GROUND, light, overlay, ms, buffer, 0); + .renderStatic(intAttached.getValue(), ItemDisplayContext.GROUND, light, overlay, ms, buffer, 0); ms.popPose(); } diff --git a/src/main/java/com/simibubi/create/content/logistics/depot/SharedDepotBlockMethods.java b/src/main/java/com/simibubi/create/content/logistics/depot/SharedDepotBlockMethods.java index 9fea80749..18f105944 100644 --- a/src/main/java/com/simibubi/create/content/logistics/depot/SharedDepotBlockMethods.java +++ b/src/main/java/com/simibubi/create/content/logistics/depot/SharedDepotBlockMethods.java @@ -79,7 +79,7 @@ public class SharedDepotBlockMethods { return; if (!entityIn.isAlive()) return; - if (entityIn.level.isClientSide) + if (entityIn.level().isClientSide) return; ItemEntity itemEntity = (ItemEntity) entityIn; diff --git a/src/main/java/com/simibubi/create/content/logistics/filter/ItemAttribute.java b/src/main/java/com/simibubi/create/content/logistics/filter/ItemAttribute.java index 67d38c959..6708baf29 100644 --- a/src/main/java/com/simibubi/create/content/logistics/filter/ItemAttribute.java +++ b/src/main/java/com/simibubi/create/content/logistics/filter/ItemAttribute.java @@ -46,7 +46,7 @@ import net.minecraft.world.level.block.ComposterBlock; import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fml.ModContainer; import net.minecraftforge.fml.ModList; import net.minecraftforge.forgespi.language.IModInfo; @@ -132,7 +132,7 @@ public interface ItemAttribute { DUMMY(s -> false), PLACEABLE(s -> s.getItem() instanceof BlockItem), CONSUMABLE(ItemStack::isEdible), - FLUID_CONTAINER(s -> s.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY) + FLUID_CONTAINER(s -> s.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM) .isPresent()), ENCHANTED(ItemStack::isEnchanted), MAX_ENCHANTED(StandardTraits::maxEnchanted), diff --git a/src/main/java/com/simibubi/create/content/logistics/filter/attribute/FluidContentsAttribute.java b/src/main/java/com/simibubi/create/content/logistics/filter/attribute/FluidContentsAttribute.java index 45c2a8402..4859953b3 100644 --- a/src/main/java/com/simibubi/create/content/logistics/filter/attribute/FluidContentsAttribute.java +++ b/src/main/java/com/simibubi/create/content/logistics/filter/attribute/FluidContentsAttribute.java @@ -12,8 +12,8 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.material.Fluid; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.registries.ForgeRegistries; @@ -68,7 +68,7 @@ public class FluidContentsAttribute implements ItemAttribute { List fluids = new ArrayList<>(); LazyOptional capability = - stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); + stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM); capability.ifPresent((cap) -> { for(int i = 0; i < cap.getTanks(); i++) { diff --git a/src/main/java/com/simibubi/create/content/logistics/funnel/FunnelMovementBehaviour.java b/src/main/java/com/simibubi/create/content/logistics/funnel/FunnelMovementBehaviour.java index 9178f3684..8f7e741c6 100644 --- a/src/main/java/com/simibubi/create/content/logistics/funnel/FunnelMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/logistics/funnel/FunnelMovementBehaviour.java @@ -67,7 +67,7 @@ public class FunnelMovementBehaviour implements MovementBehaviour { .isEmpty()) return; - if (!world.getEntitiesOfClass(ItemEntity.class, new AABB(new BlockPos(entityPos))) + if (!world.getEntitiesOfClass(ItemEntity.class, new AABB(BlockPos.containing(entityPos))) .isEmpty()) return; diff --git a/src/main/java/com/simibubi/create/content/logistics/tunnel/BeltTunnelBlockEntity.java b/src/main/java/com/simibubi/create/content/logistics/tunnel/BeltTunnelBlockEntity.java index 86ab58df7..412050156 100644 --- a/src/main/java/com/simibubi/create/content/logistics/tunnel/BeltTunnelBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/tunnel/BeltTunnelBlockEntity.java @@ -34,9 +34,9 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; public class BeltTunnelBlockEntity extends SmartBlockEntity { @@ -190,7 +190,7 @@ public class BeltTunnelBlockEntity extends SmartBlockEntity { @Override public LazyOptional getCapability(Capability capability, Direction side) { - if (capability != CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + if (capability != ForgeCapabilities.ITEM_HANDLER) return super.getCapability(capability, side); if (!this.cap.isPresent()) { diff --git a/src/main/java/com/simibubi/create/content/logistics/tunnel/BrassTunnelBlockEntity.java b/src/main/java/com/simibubi/create/content/logistics/tunnel/BrassTunnelBlockEntity.java index b2f248fea..bef8d050a 100644 --- a/src/main/java/com/simibubi/create/content/logistics/tunnel/BrassTunnelBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/tunnel/BrassTunnelBlockEntity.java @@ -52,8 +52,8 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; @@ -730,7 +730,7 @@ public class BrassTunnelBlockEntity extends BeltTunnelBlockEntity implements IHa @Override public LazyOptional getCapability(Capability capability, Direction side) { - if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + if (capability == ForgeCapabilities.ITEM_HANDLER) return tunnelCapability.cast(); return super.getCapability(capability, side); } @@ -739,7 +739,7 @@ public class BrassTunnelBlockEntity extends BeltTunnelBlockEntity implements IHa if (!beltCapability.isPresent()) { BlockEntity blockEntity = level.getBlockEntity(worldPosition.below()); if (blockEntity != null) - beltCapability = blockEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY); + beltCapability = blockEntity.getCapability(ForgeCapabilities.ITEM_HANDLER); } return beltCapability; } diff --git a/src/main/java/com/simibubi/create/content/logistics/vault/ItemVaultBlock.java b/src/main/java/com/simibubi/create/content/logistics/vault/ItemVaultBlock.java index 134d6f0e0..2d2977230 100644 --- a/src/main/java/com/simibubi/create/content/logistics/vault/ItemVaultBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/vault/ItemVaultBlock.java @@ -31,8 +31,8 @@ import net.minecraft.world.level.block.state.StateDefinition.Builder; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.Property; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.ForgeSoundType; -import net.minecraftforge.items.CapabilityItemHandler; public class ItemVaultBlock extends Block implements IWrenchable, IBE { @@ -160,7 +160,7 @@ public class ItemVaultBlock extends Block implements IWrenchable, IBE vte.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)) + .map(vte -> vte.getCapability(ForgeCapabilities.ITEM_HANDLER)) .map(lo -> lo.map(ItemHelper::calcRedstoneFromInventory) .orElse(0)) .orElse(0); diff --git a/src/main/java/com/simibubi/create/content/logistics/vault/ItemVaultItem.java b/src/main/java/com/simibubi/create/content/logistics/vault/ItemVaultItem.java index 4c29eaa5f..e12e8fb6e 100644 --- a/src/main/java/com/simibubi/create/content/logistics/vault/ItemVaultItem.java +++ b/src/main/java/com/simibubi/create/content/logistics/vault/ItemVaultItem.java @@ -99,8 +99,7 @@ public class ItemVaultItem extends BlockItem { BlockState blockState = world.getBlockState(offsetPos); if (ItemVaultBlock.isVault(blockState)) continue; - if (!blockState.getMaterial() - .isReplaceable()) + if (!blockState.canBeReplaced()) return; tanksToPlace++; } diff --git a/src/main/java/com/simibubi/create/content/processing/AssemblyOperatorBlockItem.java b/src/main/java/com/simibubi/create/content/processing/AssemblyOperatorBlockItem.java index 0538cb5f6..c7372f71c 100644 --- a/src/main/java/com/simibubi/create/content/processing/AssemblyOperatorBlockItem.java +++ b/src/main/java/com/simibubi/create/content/processing/AssemblyOperatorBlockItem.java @@ -30,8 +30,7 @@ public class AssemblyOperatorBlockItem extends BlockItem { if (operatesOn(placedOnState) && context.getClickedFace() == Direction.UP) { if (context.getLevel() .getBlockState(placedOnPos.above(2)) - .getMaterial() - .isReplaceable()) + .canBeReplaced()) context = adjustContext(context, placedOnPos); else return InteractionResult.FAIL; diff --git a/src/main/java/com/simibubi/create/content/processing/basin/BasinBlock.java b/src/main/java/com/simibubi/create/content/processing/basin/BasinBlock.java index 941cd5a99..8120b56fc 100644 --- a/src/main/java/com/simibubi/create/content/processing/basin/BasinBlock.java +++ b/src/main/java/com/simibubi/create/content/processing/basin/BasinBlock.java @@ -42,8 +42,8 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.EntityCollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemHandlerHelper; @@ -96,7 +96,7 @@ public class BasinBlock extends Block implements IBE, IWrencha return InteractionResult.SUCCESS; if (heldItem.getItem() .equals(Items.SPONGE) - && !be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + && !be.getCapability(ForgeCapabilities.FLUID_HANDLER) .map(iFluidHandler -> iFluidHandler.drain(Integer.MAX_VALUE, IFluidHandler.FluidAction.EXECUTE)) .orElse(FluidStack.EMPTY) .isEmpty()) { diff --git a/src/main/java/com/simibubi/create/content/processing/basin/BasinBlockEntity.java b/src/main/java/com/simibubi/create/content/processing/basin/BasinBlockEntity.java index a8aa3c9a2..68ba9af62 100644 --- a/src/main/java/com/simibubi/create/content/processing/basin/BasinBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/processing/basin/BasinBlockEntity.java @@ -59,13 +59,12 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; import net.minecraftforge.fluids.capability.templates.FluidTank; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemHandlerHelper; @@ -228,9 +227,9 @@ public class BasinBlockEntity extends SmartBlockEntity implements IHaveGoggleInf @Nonnull @Override public LazyOptional getCapability(@Nonnull Capability cap, Direction side) { - if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + if (cap == ForgeCapabilities.ITEM_HANDLER) return itemCapability.cast(); - if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + if (cap == ForgeCapabilities.FLUID_HANDLER) return fluidCapability.cast(); return super.getCapability(cap, side); } @@ -380,11 +379,11 @@ public class BasinBlockEntity extends SmartBlockEntity implements IHaveGoggleInf } IItemHandler targetInv = be == null ? null - : be.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, direction.getOpposite()) + : be.getCapability(ForgeCapabilities.ITEM_HANDLER, direction.getOpposite()) .orElse(inserter == null ? null : inserter.getInventory()); IFluidHandler targetTank = be == null ? null - : be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, direction.getOpposite()) + : be.getCapability(ForgeCapabilities.FLUID_HANDLER, direction.getOpposite()) .orElse(null); boolean update = false; @@ -525,10 +524,10 @@ public class BasinBlockEntity extends SmartBlockEntity implements IHaveGoggleInf InvManipulationBehaviour inserter = be == null ? null : BlockEntityBehaviour.get(level, be.getBlockPos(), InvManipulationBehaviour.TYPE); IItemHandler targetInv = be == null ? null - : be.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, direction.getOpposite()) + : be.getCapability(ForgeCapabilities.ITEM_HANDLER, direction.getOpposite()) .orElse(inserter == null ? null : inserter.getInventory()); IFluidHandler targetTank = be == null ? null - : be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, direction.getOpposite()) + : be.getCapability(ForgeCapabilities.FLUID_HANDLER, direction.getOpposite()) .orElse(null); boolean externalTankNotPresent = targetTank == null; diff --git a/src/main/java/com/simibubi/create/content/processing/basin/BasinRecipe.java b/src/main/java/com/simibubi/create/content/processing/basin/BasinRecipe.java index ddcf9ecaa..591ee71a8 100644 --- a/src/main/java/com/simibubi/create/content/processing/basin/BasinRecipe.java +++ b/src/main/java/com/simibubi/create/content/processing/basin/BasinRecipe.java @@ -26,10 +26,9 @@ import net.minecraft.world.item.crafting.CraftingRecipe; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.level.Level; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; public class BasinRecipe extends ProcessingRecipe { @@ -62,9 +61,9 @@ public class BasinRecipe extends ProcessingRecipe { private static boolean apply(BasinBlockEntity basin, Recipe recipe, boolean test) { boolean isBasinRecipe = recipe instanceof BasinRecipe; - IItemHandler availableItems = basin.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + IItemHandler availableItems = basin.getCapability(ForgeCapabilities.ITEM_HANDLER) .orElse(null); - IFluidHandler availableFluids = basin.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + IFluidHandler availableFluids = basin.getCapability(ForgeCapabilities.FLUID_HANDLER) .orElse(null); if (availableItems == null || availableFluids == null) diff --git a/src/main/java/com/simibubi/create/content/processing/basin/BasinRenderer.java b/src/main/java/com/simibubi/create/content/processing/basin/BasinRenderer.java index 4a42ecab6..9e4120e07 100644 --- a/src/main/java/com/simibubi/create/content/processing/basin/BasinRenderer.java +++ b/src/main/java/com/simibubi/create/content/processing/basin/BasinRenderer.java @@ -13,13 +13,13 @@ import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Direction.Axis; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; @@ -135,7 +135,7 @@ public class BasinRenderer extends SmartBlockEntityRenderer { protected void renderItem(PoseStack ms, MultiBufferSource buffer, int light, int overlay, ItemStack stack) { Minecraft.getInstance() .getItemRenderer() - .renderStatic(stack, TransformType.GROUND, light, overlay, ms, buffer, 0); + .renderStatic(stack, ItemDisplayContext.GROUND, light, overlay, ms, buffer, 0); } protected float renderFluids(BasinBlockEntity basin, float partialTicks, PoseStack ms, MultiBufferSource buffer, diff --git a/src/main/java/com/simibubi/create/content/processing/burner/BlazeBurnerBlockItem.java b/src/main/java/com/simibubi/create/content/processing/burner/BlazeBurnerBlockItem.java index 04b088c79..26604b691 100644 --- a/src/main/java/com/simibubi/create/content/processing/burner/BlazeBurnerBlockItem.java +++ b/src/main/java/com/simibubi/create/content/processing/burner/BlazeBurnerBlockItem.java @@ -117,7 +117,7 @@ public class BlazeBurnerBlockItem extends BlockItem { if (!(entity instanceof Blaze)) return InteractionResult.PASS; - Level world = player.level; + Level world = player.level(); spawnCaptureEffects(world, entity.position()); if (world.isClientSide) return InteractionResult.FAIL; @@ -152,7 +152,7 @@ public class BlazeBurnerBlockItem extends BlockItem { return; } - BlockPos soundPos = new BlockPos(vec); + BlockPos soundPos = BlockPos.containing(vec); world.playSound(null, soundPos, SoundEvents.BLAZE_HURT, SoundSource.HOSTILE, .25f, .75f); world.playSound(null, soundPos, SoundEvents.FIRE_EXTINGUISH, SoundSource.HOSTILE, .5f, .75f); } diff --git a/src/main/java/com/simibubi/create/content/processing/burner/BlazeBurnerHandler.java b/src/main/java/com/simibubi/create/content/processing/burner/BlazeBurnerHandler.java index 6d63f2890..d491f2048 100644 --- a/src/main/java/com/simibubi/create/content/processing/burner/BlazeBurnerHandler.java +++ b/src/main/java/com/simibubi/create/content/processing/burner/BlazeBurnerHandler.java @@ -44,8 +44,9 @@ public class BlazeBurnerHandler { .getType() != HitResult.Type.BLOCK) return; - BlockEntity blockEntity = projectile.level.getBlockEntity(new BlockPos(event.getRayTraceResult() - .getLocation())); + BlockEntity blockEntity = projectile.level() + .getBlockEntity(BlockPos.containing(event.getRayTraceResult() + .getLocation())); if (!(blockEntity instanceof BlazeBurnerBlockEntity)) { return; } @@ -54,7 +55,7 @@ public class BlazeBurnerHandler { projectile.setDeltaMovement(Vec3.ZERO); projectile.discard(); - Level world = projectile.level; + Level world = projectile.level(); if (world.isClientSide) return; @@ -74,7 +75,7 @@ public class BlazeBurnerHandler { public static void splashExtinguishesBurner(ProjectileImpactEvent event) { Projectile projectile = event.getProjectile(); - if (projectile.level.isClientSide) + if (projectile.level().isClientSide) return; if (!(projectile instanceof ThrownPotion)) return; @@ -89,7 +90,7 @@ public class BlazeBurnerHandler { if (potion == Potions.WATER && PotionUtils.getMobEffects(stack) .isEmpty()) { BlockHitResult result = (BlockHitResult) event.getRayTraceResult(); - Level world = entity.level; + Level world = entity.level(); Direction face = result.getDirection(); BlockPos pos = result.getBlockPos() .relative(face); diff --git a/src/main/java/com/simibubi/create/content/processing/burner/BlazeBurnerInteractionBehaviour.java b/src/main/java/com/simibubi/create/content/processing/burner/BlazeBurnerInteractionBehaviour.java index 72462cd3f..0473f856d 100644 --- a/src/main/java/com/simibubi/create/content/processing/burner/BlazeBurnerInteractionBehaviour.java +++ b/src/main/java/com/simibubi/create/content/processing/burner/BlazeBurnerInteractionBehaviour.java @@ -40,8 +40,8 @@ public class BlazeBurnerInteractionBehaviour extends MovingInteractionBehaviour StructureBlockInfo info = carriageContraption.getBlocks() .get(localPos); - if (info == null || !info.state.hasProperty(BlazeBurnerBlock.HEAT_LEVEL) - || info.state.getValue(BlazeBurnerBlock.HEAT_LEVEL) == HeatLevel.NONE) + if (info == null || !info.state().hasProperty(BlazeBurnerBlock.HEAT_LEVEL) + || info.state().getValue(BlazeBurnerBlock.HEAT_LEVEL) == HeatLevel.NONE) return false; Direction assemblyDirection = carriageContraption.getAssemblyDirection(); @@ -52,19 +52,19 @@ public class BlazeBurnerInteractionBehaviour extends MovingInteractionBehaviour Train train = carriageEntity.getCarriage().train; if (train == null) return false; - if (player.level.isClientSide) + if (player.level().isClientSide) return true; if (train.runtime.getSchedule() != null) { if (train.runtime.paused && !train.runtime.completed) { train.runtime.paused = false; - AllSoundEvents.CONFIRM.playOnServer(player.level, player.blockPosition(), 1, 1); + AllSoundEvents.CONFIRM.playOnServer(player.level(), player.blockPosition(), 1, 1); player.displayClientMessage(Lang.translateDirect("schedule.continued"), true); return true; } if (!itemInHand.isEmpty()) { - AllSoundEvents.DENY.playOnServer(player.level, player.blockPosition(), 1, 1); + AllSoundEvents.DENY.playOnServer(player.level(), player.blockPosition(), 1, 1); player.displayClientMessage(Lang.translateDirect("schedule.remove_with_empty_hand"), true); return true; } @@ -85,14 +85,14 @@ public class BlazeBurnerInteractionBehaviour extends MovingInteractionBehaviour return false; if (schedule.entries.isEmpty()) { - AllSoundEvents.DENY.playOnServer(player.level, player.blockPosition(), 1, 1); + AllSoundEvents.DENY.playOnServer(player.level(), player.blockPosition(), 1, 1); player.displayClientMessage(Lang.translateDirect("schedule.no_stops"), true); return true; } train.runtime.setSchedule(schedule, false); AllAdvancements.CONDUCTOR.awardTo(player); - AllSoundEvents.CONFIRM.playOnServer(player.level, player.blockPosition(), 1, 1); + AllSoundEvents.CONFIRM.playOnServer(player.level(), player.blockPosition(), 1, 1); player.displayClientMessage(Lang.translateDirect("schedule.applied_to_train") .withStyle(ChatFormatting.GREEN), true); itemInHand.shrink(1); @@ -101,7 +101,7 @@ public class BlazeBurnerInteractionBehaviour extends MovingInteractionBehaviour } player.displayClientMessage(Lang.translateDirect("schedule.non_controlling_seat"), true); - AllSoundEvents.DENY.playOnServer(player.level, player.blockPosition(), 1, 1); + AllSoundEvents.DENY.playOnServer(player.level(), player.blockPosition(), 1, 1); return true; } diff --git a/src/main/java/com/simibubi/create/content/redstone/displayLink/DisplayLinkBlockItem.java b/src/main/java/com/simibubi/create/content/redstone/displayLink/DisplayLinkBlockItem.java index e1a7857e0..c3ee8b76f 100644 --- a/src/main/java/com/simibubi/create/content/redstone/displayLink/DisplayLinkBlockItem.java +++ b/src/main/java/com/simibubi/create/content/redstone/displayLink/DisplayLinkBlockItem.java @@ -79,8 +79,7 @@ public class DisplayLinkBlockItem extends BlockItem { CompoundTag teTag = new CompoundTag(); BlockPos selectedPos = NbtUtils.readBlockPos(tag.getCompound("SelectedPos")); - BlockPos placedPos = pos.relative(pContext.getClickedFace(), state.getMaterial() - .isReplaceable() ? 0 : 1); + BlockPos placedPos = pos.relative(pContext.getClickedFace(), state.canBeReplaced() ? 0 : 1); if (!selectedPos.closerThan(placedPos, AllConfigs.server().logistics.displayLinkRange.get())) { player.displayClientMessage(Lang.translateDirect("display_link.too_far") diff --git a/src/main/java/com/simibubi/create/content/redstone/link/RedstoneLinkBlock.java b/src/main/java/com/simibubi/create/content/redstone/link/RedstoneLinkBlock.java index 170168159..4e8bf06df 100644 --- a/src/main/java/com/simibubi/create/content/redstone/link/RedstoneLinkBlock.java +++ b/src/main/java/com/simibubi/create/content/redstone/link/RedstoneLinkBlock.java @@ -166,8 +166,7 @@ public class RedstoneLinkBlock extends WrenchableDirectionalBlock implements IBE BlockPos neighbourPos = pos.relative(state.getValue(FACING) .getOpposite()); BlockState neighbour = worldIn.getBlockState(neighbourPos); - return !neighbour.getMaterial() - .isReplaceable(); + return !neighbour.canBeReplaced(); } @Override diff --git a/src/main/java/com/simibubi/create/content/redstone/link/controller/LecternControllerBlockEntity.java b/src/main/java/com/simibubi/create/content/redstone/link/controller/LecternControllerBlockEntity.java index 1c0cd29ba..2cc5ed736 100644 --- a/src/main/java/com/simibubi/create/content/redstone/link/controller/LecternControllerBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/redstone/link/controller/LecternControllerBlockEntity.java @@ -172,7 +172,7 @@ public class LecternControllerBlockEntity extends SmartBlockEntity { public static boolean playerInRange(Player player, Level world, BlockPos pos) { //double modifier = world.isRemote ? 0 : 1.0; - double reach = 0.4*player.getAttributeValue(ForgeMod.REACH_DISTANCE.get());// + modifier; + double reach = 0.4*player.getAttributeValue(ForgeMod.BLOCK_REACH.get());// + modifier; return player.distanceToSqr(Vec3.atCenterOf(pos)) < reach*reach; } diff --git a/src/main/java/com/simibubi/create/content/redstone/link/controller/LecternControllerRenderer.java b/src/main/java/com/simibubi/create/content/redstone/link/controller/LecternControllerRenderer.java index 355f26380..110ff10eb 100644 --- a/src/main/java/com/simibubi/create/content/redstone/link/controller/LecternControllerRenderer.java +++ b/src/main/java/com/simibubi/create/content/redstone/link/controller/LecternControllerRenderer.java @@ -10,9 +10,9 @@ import com.simibubi.create.foundation.utility.AngleHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.core.Direction; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; public class LecternControllerRenderer extends SafeBlockEntityRenderer { @@ -25,7 +25,7 @@ public class LecternControllerRenderer extends SafeBlockEntityRenderer { @@ -52,8 +51,8 @@ public class SmartObserverBlock extends DirectedDirectionalBlock implements IBE< @Override public BlockState getStateForPlacement(BlockPlaceContext context) { BlockState state = defaultBlockState(); - Capability itemCap = CapabilityItemHandler.ITEM_HANDLER_CAPABILITY; - Capability fluidCap = CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY; + Capability itemCap = ForgeCapabilities.ITEM_HANDLER; + Capability fluidCap = ForgeCapabilities.FLUID_HANDLER; Direction preferredFacing = null; for (Direction face : context.getNearestLookingDirections()) { diff --git a/src/main/java/com/simibubi/create/content/redstone/thresholdSwitch/ThresholdSwitchBlock.java b/src/main/java/com/simibubi/create/content/redstone/thresholdSwitch/ThresholdSwitchBlock.java index b88499c03..37cbe1d40 100644 --- a/src/main/java/com/simibubi/create/content/redstone/thresholdSwitch/ThresholdSwitchBlock.java +++ b/src/main/java/com/simibubi/create/content/redstone/thresholdSwitch/ThresholdSwitchBlock.java @@ -30,10 +30,9 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; public class ThresholdSwitchBlock extends DirectedDirectionalBlock implements IBE { @@ -102,8 +101,8 @@ public class ThresholdSwitchBlock extends DirectedDirectionalBlock implements IB @Override public BlockState getStateForPlacement(BlockPlaceContext context) { BlockState state = defaultBlockState(); - Capability itemCap = CapabilityItemHandler.ITEM_HANDLER_CAPABILITY; - Capability fluidCap = CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY; + Capability itemCap = ForgeCapabilities.ITEM_HANDLER; + Capability fluidCap = ForgeCapabilities.FLUID_HANDLER; Direction preferredFacing = null; for (Direction face : context.getNearestLookingDirections()) { diff --git a/src/main/java/com/simibubi/create/content/schematics/SchematicAndQuillItem.java b/src/main/java/com/simibubi/create/content/schematics/SchematicAndQuillItem.java index f3b9fc908..a72b0ad2c 100644 --- a/src/main/java/com/simibubi/create/content/schematics/SchematicAndQuillItem.java +++ b/src/main/java/com/simibubi/create/content/schematics/SchematicAndQuillItem.java @@ -58,7 +58,7 @@ public class SchematicAndQuillItem extends Item { Vec3 vec3 = new Vec3(entity.getX() - aabb.minX, entity.getY() - aabb.minY, entity.getZ() - aabb.minZ); CompoundTag compoundtag = new CompoundTag(); entity.save(compoundtag); - BlockPos blockpos = new BlockPos(vec3); + BlockPos blockpos = BlockPos.containing(vec3); CompoundTag entityTag = new CompoundTag(); entityTag.put("pos", newDoubleList(vec3.x, vec3.y, vec3.z)); diff --git a/src/main/java/com/simibubi/create/content/schematics/SchematicProcessor.java b/src/main/java/com/simibubi/create/content/schematics/SchematicProcessor.java index 131338652..e34a4747b 100644 --- a/src/main/java/com/simibubi/create/content/schematics/SchematicProcessor.java +++ b/src/main/java/com/simibubi/create/content/schematics/SchematicProcessor.java @@ -32,12 +32,12 @@ public class SchematicProcessor extends StructureProcessor { @Override public StructureTemplate.StructureBlockInfo process(LevelReader world, BlockPos pos, BlockPos anotherPos, StructureTemplate.StructureBlockInfo rawInfo, StructureTemplate.StructureBlockInfo info, StructurePlaceSettings settings, @Nullable StructureTemplate template) { - if (info.nbt != null && info.state.hasBlockEntity()) { - BlockEntity be = ((EntityBlock) info.state.getBlock()).newBlockEntity(info.pos, info.state); + if (info.nbt() != null && info.state().hasBlockEntity()) { + BlockEntity be = ((EntityBlock) info.state().getBlock()).newBlockEntity(info.pos(), info.state()); if (be != null) { - CompoundTag nbt = NBTProcessors.process(be, info.nbt, false); - if (nbt != info.nbt) - return new StructureTemplate.StructureBlockInfo(info.pos, info.state, nbt); + CompoundTag nbt = NBTProcessors.process(be, info.nbt(), false); + if (nbt != info.nbt()) + return new StructureTemplate.StructureBlockInfo(info.pos(), info.state(), nbt); } } return info; diff --git a/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java b/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java index 62266c992..e842044ae 100644 --- a/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java +++ b/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java @@ -146,7 +146,7 @@ public class ServerSchematicLoader { // Open Stream OutputStream writer = Files.newOutputStream(uploadPath); - activeUploads.put(playerSchematicId, new SchematicUploadEntry(writer, size, player.getLevel(), pos)); + activeUploads.put(playerSchematicId, new SchematicUploadEntry(writer, size, player.level(), pos)); // Notify Block Entity table.startUpload(schematic); diff --git a/src/main/java/com/simibubi/create/content/schematics/cannon/SchematicannonBlockEntity.java b/src/main/java/com/simibubi/create/content/schematics/cannon/SchematicannonBlockEntity.java index 7db7d29c2..54f48c434 100644 --- a/src/main/java/com/simibubi/create/content/schematics/cannon/SchematicannonBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/schematics/cannon/SchematicannonBlockEntity.java @@ -57,8 +57,8 @@ import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; import net.minecraft.world.phys.AABB; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.wrapper.EmptyHandler; @@ -135,7 +135,7 @@ public class SchematicannonBlockEntity extends SmartBlockEntity implements MenuP BlockEntity blockEntity = level.getBlockEntity(worldPosition.relative(facing)); if (blockEntity != null) { LazyOptional capability = - blockEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()); + blockEntity.getCapability(ForgeCapabilities.ITEM_HANDLER, facing.getOpposite()); if (capability.isPresent()) { attachedInventories.add(capability); } diff --git a/src/main/java/com/simibubi/create/content/schematics/cannon/SchematicannonRenderer.java b/src/main/java/com/simibubi/create/content/schematics/cannon/SchematicannonRenderer.java index e6b311793..62c509f82 100644 --- a/src/main/java/com/simibubi/create/content/schematics/cannon/SchematicannonRenderer.java +++ b/src/main/java/com/simibubi/create/content/schematics/cannon/SchematicannonRenderer.java @@ -17,13 +17,13 @@ import com.simibubi.create.foundation.render.SuperByteBuffer; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; @@ -187,7 +187,7 @@ public class SchematicannonRenderer extends SafeBlockEntityRenderer { ServerPlayer sender = context.getSender(); boolean clientSide = sender == null; - Train train = Create.RAILWAYS.sided(clientSide ? null : sender.level).trains.get(trainId); + Train train = Create.RAILWAYS.sided(clientSide ? null : sender.level()).trains.get(trainId); if (train == null) return; diff --git a/src/main/java/com/simibubi/create/content/trains/TrainHUD.java b/src/main/java/com/simibubi/create/content/trains/TrainHUD.java index 52e452142..d49eab92b 100644 --- a/src/main/java/com/simibubi/create/content/trains/TrainHUD.java +++ b/src/main/java/com/simibubi/create/content/trains/TrainHUD.java @@ -17,7 +17,7 @@ import com.simibubi.create.infrastructure.config.AllConfigs; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -138,7 +138,7 @@ public class TrainHUD { int h = AllGuiTextures.TRAIN_HUD_SPEED.height; AllGuiTextures.TRAIN_HUD_SPEED.bind(); - GuiComponent.blit(poseStack, 0, 0, 0, AllGuiTextures.TRAIN_HUD_SPEED.startX, + GuiGraphics.blit(poseStack, 0, 0, 0, AllGuiTextures.TRAIN_HUD_SPEED.startX, AllGuiTextures.TRAIN_HUD_SPEED.startY, w, h, 256, 256); int promptSize = (int) displayedPromptSize.getValue(partialTicks); @@ -149,7 +149,7 @@ public class TrainHUD { AllGuiTextures.TRAIN_PROMPT_L.render(poseStack, -3, 0); AllGuiTextures.TRAIN_PROMPT_R.render(poseStack, promptSize, 0); - GuiComponent.blit(poseStack, 0, 0, 0, AllGuiTextures.TRAIN_PROMPT.startX + (128 - promptSize / 2f), + GuiGraphics.blit(poseStack, 0, 0, 0, AllGuiTextures.TRAIN_PROMPT.startX + (128 - promptSize / 2f), AllGuiTextures.TRAIN_PROMPT.startY, promptSize, AllGuiTextures.TRAIN_PROMPT.height, 256, 256); poseStack.popPose(); @@ -171,7 +171,7 @@ public class TrainHUD { w = (int) (AllGuiTextures.TRAIN_HUD_THROTTLE.width * (1 - displayedThrottle.getValue(partialTicks))); AllGuiTextures.TRAIN_HUD_THROTTLE.bind(); int invW = AllGuiTextures.TRAIN_HUD_THROTTLE.width - w; - GuiComponent.blit(poseStack, invW, 0, 0, AllGuiTextures.TRAIN_HUD_THROTTLE.startX + invW, + GuiGraphics.blit(poseStack, invW, 0, 0, AllGuiTextures.TRAIN_HUD_THROTTLE.startX + invW, AllGuiTextures.TRAIN_HUD_THROTTLE.startY, w, h, 256, 256); AllGuiTextures.TRAIN_HUD_THROTTLE_POINTER.render(poseStack, Math.max(1, AllGuiTextures.TRAIN_HUD_THROTTLE.width - w) - 3, -2); @@ -184,8 +184,8 @@ public class TrainHUD { Direction initialOrientation = cce.getInitialOrientation() .getCounterClockWise(); boolean inverted = false; - if (info != null && info.state.hasProperty(ControlsBlock.FACING)) - inverted = !info.state.getValue(ControlsBlock.FACING) + if (info != null && info.state().hasProperty(ControlsBlock.FACING)) + inverted = !info.state().getValue(ControlsBlock.FACING) .equals(initialOrientation); boolean reversing = ControlsHandler.currentlyPressed.contains(1); diff --git a/src/main/java/com/simibubi/create/content/trains/TrainHUDUpdatePacket.java b/src/main/java/com/simibubi/create/content/trains/TrainHUDUpdatePacket.java index c0c97fceb..150950bed 100644 --- a/src/main/java/com/simibubi/create/content/trains/TrainHUDUpdatePacket.java +++ b/src/main/java/com/simibubi/create/content/trains/TrainHUDUpdatePacket.java @@ -50,7 +50,7 @@ public class TrainHUDUpdatePacket extends SimplePacketBase { context.enqueueWork(() -> { ServerPlayer sender = context.getSender(); boolean clientSide = sender == null; - Train train = Create.RAILWAYS.sided(clientSide ? null : sender.level).trains.get(trainId); + Train train = Create.RAILWAYS.sided(clientSide ? null : sender.level()).trains.get(trainId); if (train == null) return; diff --git a/src/main/java/com/simibubi/create/content/trains/bogey/BogeyInstance.java b/src/main/java/com/simibubi/create/content/trains/bogey/BogeyInstance.java index 1c68ef95e..015377c4c 100644 --- a/src/main/java/com/simibubi/create/content/trains/bogey/BogeyInstance.java +++ b/src/main/java/com/simibubi/create/content/trains/bogey/BogeyInstance.java @@ -45,7 +45,7 @@ public final class BogeyInstance { } public void updateLight(BlockAndTintGetter world, CarriageContraptionEntity entity) { - var lightPos = new BlockPos(getLightPos(entity)); + var lightPos = BlockPos.containing(getLightPos(entity)); commonRenderer .ifPresent(bogeyRenderer -> bogeyRenderer.updateLight(world.getBrightness(LightLayer.BLOCK, lightPos), world.getBrightness(LightLayer.SKY, lightPos))); diff --git a/src/main/java/com/simibubi/create/content/trains/display/FlapDisplayBlock.java b/src/main/java/com/simibubi/create/content/trains/display/FlapDisplayBlock.java index 9abf42398..4cb8d49d4 100644 --- a/src/main/java/com/simibubi/create/content/trains/display/FlapDisplayBlock.java +++ b/src/main/java/com/simibubi/create/content/trains/display/FlapDisplayBlock.java @@ -357,8 +357,7 @@ public class FlapDisplayBlock extends HorizontalKineticBlock state.getValue(FlapDisplayBlock.HORIZONTAL_FACING) .getAxis(), dir -> world.getBlockState(pos.relative(dir)) - .getMaterial() - .isReplaceable()); + .canBeReplaced()); return directions.isEmpty() ? PlacementOffset.fail() : PlacementOffset.success(pos.relative(directions.get(0)), s -> AllBlocks.DISPLAY_BOARD.get() diff --git a/src/main/java/com/simibubi/create/content/trains/entity/ArrivalSoundQueue.java b/src/main/java/com/simibubi/create/content/trains/entity/ArrivalSoundQueue.java index ed33925d5..6c89d7581 100644 --- a/src/main/java/com/simibubi/create/content/trains/entity/ArrivalSoundQueue.java +++ b/src/main/java/com/simibubi/create/content/trains/entity/ArrivalSoundQueue.java @@ -74,9 +74,9 @@ public class ArrivalSoundQueue { .get(blockPos); if (info == null) continue; - BlockState state = info.state; - if (state.getBlock() instanceof WhistleBlock && info.nbt != null) { - int pitch = info.nbt.getInt("Pitch"); + BlockState state = info.state(); + if (state.getBlock() instanceof WhistleBlock && info.nbt() != null) { + int pitch = info.nbt().getInt("Pitch"); WhistleSize size = state.getValue(WhistleBlock.SIZE); return Pair.of(size == WhistleSize.LARGE, (size == WhistleSize.SMALL ? 12 : 0) - pitch); } @@ -123,7 +123,7 @@ public class ArrivalSoundQueue { public static void play(CarriageContraptionEntity entity, StructureBlockInfo info) { if (info == null) return; - BlockState state = info.state; + BlockState state = info.state(); if (state.getBlock() instanceof BellBlock) { if (AllBlocks.HAUNTED_BELL.has(state)) @@ -139,8 +139,8 @@ public class ArrivalSoundQueue { .get(), 1, f); } - if (state.getBlock() instanceof WhistleBlock && info.nbt != null) { - int pitch = info.nbt.getInt("Pitch"); + if (state.getBlock() instanceof WhistleBlock && info.nbt() != null) { + int pitch = info.nbt().getInt("Pitch"); WhistleSize size = state.getValue(WhistleBlock.SIZE); float f = (float) Math.pow(2, ((size == WhistleSize.SMALL ? 12 : 0) - pitch) / 12.0); playSimple(entity, @@ -154,7 +154,7 @@ public class ArrivalSoundQueue { } private static void playSimple(CarriageContraptionEntity entity, SoundEvent event, float volume, float pitch) { - entity.level.playSound(null, entity, event, SoundSource.NEUTRAL, 5 * volume, pitch); + entity.level().playSound(null, entity, event, SoundSource.NEUTRAL, 5 * volume, pitch); } } diff --git a/src/main/java/com/simibubi/create/content/trains/entity/Carriage.java b/src/main/java/com/simibubi/create/content/trains/entity/Carriage.java index 86a2c3eee..b340e4848 100644 --- a/src/main/java/com/simibubi/create/content/trains/entity/Carriage.java +++ b/src/main/java/com/simibubi/create/content/trains/entity/Carriage.java @@ -270,7 +270,7 @@ public class Carriage { if (discard) iterator.remove(); else if (dimensionalCarriageEntity.positionAnchor != null && CarriageEntityHandler - .isActiveChunk(currentLevel, new BlockPos(dimensionalCarriageEntity.positionAnchor))) + .isActiveChunk(currentLevel, BlockPos.containing(dimensionalCarriageEntity.positionAnchor))) dimensionalCarriageEntity.createEntity(currentLevel, anyAvailableEntity() == null); } else { @@ -670,7 +670,7 @@ public class Carriage { Entity entity = this.entity.get(); if (!(entity instanceof CarriageContraptionEntity cce)) return; - if (!(entity.level instanceof ServerLevel sLevel)) + if (!(entity.level() instanceof ServerLevel sLevel)) return; Set loadedPassengers = new HashSet<>(); @@ -697,7 +697,7 @@ public class Carriage { .getPlayer(tag.getUUID("PlayerPassenger")); } else { - passenger = EntityType.loadEntityRecursive(tag, entity.level, e -> { + passenger = EntityType.loadEntityRecursive(tag, entity.level(), e -> { e.moveTo(positionAnchor); return e; }); @@ -706,7 +706,7 @@ public class Carriage { } if (passenger != null) { - ResourceKey passengerDimension = passenger.level.dimension(); + ResourceKey passengerDimension = passenger.level().dimension(); if (!passengerDimension.equals(sLevel.dimension()) && passenger instanceof ServerPlayer sp) continue; cce.addSittingPassenger(passenger, seatId); @@ -756,7 +756,7 @@ public class Carriage { DimensionalCarriageEntity otherDce = other.getValue(); if (otherDce == this) continue; - if (sp.level.dimension() + if (sp.level().dimension() .equals(other.getKey())) continue; Vec3 loc = otherDce.pivot == null ? otherDce.positionAnchor : otherDce.pivot.getLocation(); @@ -779,7 +779,7 @@ public class Carriage { return; cc.portalCutoffMin = minAllowedLocalCoord(); cc.portalCutoffMax = maxAllowedLocalCoord(); - if (!entity.level.isClientSide()) + if (!entity.level().isClientSide()) return; DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> invalidate(cce)); } @@ -822,7 +822,7 @@ public class Carriage { Integer seat = mapping.get(passenger.getUUID()); if (passenger instanceof ServerPlayer sp) { - dismountPlayer(sp.getLevel(), sp, seat, portal); + dismountPlayer(sp.serverLevel(), sp, seat, portal); continue; } @@ -853,7 +853,7 @@ public class Carriage { entity.prevYaw = entity.yaw; entity.prevPitch = entity.pitch; - if (!entity.level.isClientSide()) { + if (!entity.level().isClientSide()) { Vec3 lookahead = positionAnchor.add(positionAnchor.subtract(entity.position()) .normalize() .scale(16)); @@ -863,7 +863,7 @@ public class Carriage { continue; if (e.distanceToSqr(entity) > 32 * 32) continue; - if (CarriageEntityHandler.isActiveChunk(entity.level, new BlockPos(lookahead))) + if (CarriageEntityHandler.isActiveChunk(entity.level(), BlockPos.containing(lookahead))) break; train.carriageWaitingForChunks = id; return; diff --git a/src/main/java/com/simibubi/create/content/trains/entity/CarriageBogey.java b/src/main/java/com/simibubi/create/content/trains/entity/CarriageBogey.java index b313bf02f..fd2a16511 100644 --- a/src/main/java/com/simibubi/create/content/trains/entity/CarriageBogey.java +++ b/src/main/java/com/simibubi/create/content/trains/entity/CarriageBogey.java @@ -93,7 +93,7 @@ public class CarriageBogey { if (leading().edge == null || carriage.train.derailed) { yRot = -90 + entity.yaw - derailAngle; - } else if (!entity.level.dimension() + } else if (!entity.level().dimension() .equals(getDimension())) { yRot = -90 + entity.yaw; xRot = 0; diff --git a/src/main/java/com/simibubi/create/content/trains/entity/CarriageContraption.java b/src/main/java/com/simibubi/create/content/trains/entity/CarriageContraption.java index f8be4a9c0..8591af0cf 100644 --- a/src/main/java/com/simibubi/create/content/trains/entity/CarriageContraption.java +++ b/src/main/java/com/simibubi/create/content/trains/entity/CarriageContraption.java @@ -126,9 +126,9 @@ public class CarriageContraption extends Contraption { if (!blocks.containsKey(controlsPos)) return false; StructureBlockInfo info = blocks.get(controlsPos); - if (!AllBlocks.TRAIN_CONTROLS.has(info.state)) + if (!AllBlocks.TRAIN_CONTROLS.has(info.state())) return false; - return info.state.getValue(ControlsBlock.FACING) == direction.getOpposite(); + return info.state().getValue(ControlsBlock.FACING) == direction.getOpposite(); } public void swapStorageAfterAssembly(CarriageContraptionEntity cce) { @@ -347,7 +347,7 @@ public class CarriageContraption extends Contraption { @Override public void tickStorage(AbstractContraptionEntity entity) { - if (entity.level.isClientSide) + if (entity.level().isClientSide) storage.entityTick(entity); else if (storageProxy != null) storageProxy.entityTick(entity); diff --git a/src/main/java/com/simibubi/create/content/trains/entity/CarriageContraptionEntity.java b/src/main/java/com/simibubi/create/content/trains/entity/CarriageContraptionEntity.java index a7c86d7a3..b4b50e7b9 100644 --- a/src/main/java/com/simibubi/create/content/trains/entity/CarriageContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/trains/entity/CarriageContraptionEntity.java @@ -119,7 +119,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { public void onSyncedDataUpdated(EntityDataAccessor key) { super.onSyncedDataUpdated(key); - if (!level.isClientSide) + if (!level().isClientSide) return; bindCarriage(); @@ -151,7 +151,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { @Override public Vec3 getPrevPositionVec() { - if (!level.isClientSide() && serverPrevPos != null) + if (!level().isClientSide() && serverPrevPos != null) return serverPrevPos; return super.getPrevPositionVec(); } @@ -202,7 +202,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { cce.contraption.getBlocks() .put(localPos, newInfo); AllPackets.getChannel().send(PacketDistributor.TRACKING_ENTITY.with(() -> cce), - new ContraptionBlockChangedPacket(cce.getId(), localPos, newInfo.state)); + new ContraptionBlockChangedPacket(cce.getId(), localPos, newInfo.state())); }); } @@ -214,14 +214,14 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { return; if (carriage == null) { - if (level.isClientSide) + if (level().isClientSide) bindCarriage(); else discard(); return; } - if (!Create.RAILWAYS.sided(level).trains.containsKey(carriage.train.id)) { + if (!Create.RAILWAYS.sided(level()).trains.containsKey(carriage.train.id)) { discard(); return; } @@ -232,12 +232,12 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { CarriageSyncData carriageData = getCarriageData(); - if (!level.isClientSide) { + if (!level().isClientSide) { entityData.set(SCHEDULED, carriage.train.runtime.getSchedule() != null); boolean shouldCarriageSyncThisTick = - carriage.train.shouldCarriageSyncThisTick(level.getGameTime(), getType().updateInterval()); + carriage.train.shouldCarriageSyncThisTick(level().getGameTime(), getType().updateInterval()); if (shouldCarriageSyncThisTick && carriageData.isDirty()) { entityData.set(CARRIAGE_DATA, null); entityData.set(CARRIAGE_DATA, carriageData); @@ -262,7 +262,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { return; } - DimensionalCarriageEntity dce = carriage.getDimensional(level); + DimensionalCarriageEntity dce = carriage.getDimensional(level()); if (tickCount % 10 == 0) updateTrackGraph(); @@ -315,12 +315,12 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { private void bindCarriage() { if (carriage != null) return; - Train train = Create.RAILWAYS.sided(level).trains.get(trainId); + Train train = Create.RAILWAYS.sided(level()).trains.get(trainId); if (train == null || train.carriages.size() <= carriageIndex) return; carriage = train.carriages.get(carriageIndex); if (carriage != null) { - DimensionalCarriageEntity dimensional = carriage.getDimensional(level); + DimensionalCarriageEntity dimensional = carriage.getDimensional(level()); dimensional.entity = new WeakReference<>(this); dimensional.pivot = null; carriage.updateContraptionAnchors(); @@ -339,7 +339,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { for (int index = 0; index < carriageCount; index++) { int i = arrivalSoundReversed ? carriageCount - 1 - index : index; Carriage carriage = carriages.get(i); - CarriageContraptionEntity entity = carriage.getDimensional(level).entity.get(); + CarriageContraptionEntity entity = carriage.getDimensional(level()).entity.get(); if (entity == null || !(entity.contraption instanceof CarriageContraption otherCC)) break; tick = arrivalSoundReversed ? otherCC.soundQueue.lastTick() : otherCC.soundQueue.firstTick(); @@ -360,7 +360,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { boolean keepTicking = false; for (Carriage c : carriages) { - CarriageContraptionEntity entity = c.getDimensional(level).entity.get(); + CarriageContraptionEntity entity = c.getDimensional(level()).entity.get(); if (entity == null || !(entity.contraption instanceof CarriageContraption otherCC)) continue; keepTicking |= otherCC.soundQueue.tick(entity, arrivalSoundTicks, arrivalSoundReversed); @@ -385,7 +385,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { return false; if (!super.isActorActive(context, actor)) return false; - return cc.notInPortal() || level.isClientSide(); + return cc.notInPortal() || level().isClientSide(); } @Override @@ -396,7 +396,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { private void spawnDerailParticles(Carriage carriage) { if (random.nextFloat() < 1 / 20f) { Vec3 v = position().add(derailParticleOffset); - level.addParticle(ParticleTypes.CAMPFIRE_COSY_SMOKE, v.x, v.y, v.z, 0, .04, 0); + level().addParticle(ParticleTypes.CAMPFIRE_COSY_SMOKE, v.x, v.y, v.z, 0, .04, 0); } } @@ -440,7 +440,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { .scale(.325f); m = VecHelper.rotate(m, random.nextFloat() * 360, alongX ? Axis.X : Axis.Z); m = m.add(VecHelper.offsetRandomly(Vec3.ZERO, random, 0.25f)); - level.addParticle(data, v.x, v.y, v.z, m.x, m.y, m.z); + level().addParticle(data, v.x, v.y, v.z, m.x, m.y, m.z); } } @@ -450,7 +450,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { super.onClientRemoval(); entityData.set(CARRIAGE_DATA, new CarriageSyncData()); if (carriage != null) { - DimensionalCarriageEntity dce = carriage.getDimensional(level); + DimensionalCarriageEntity dce = carriage.getDimensional(level()); dce.pointsInitialised = false; carriage.leadingBogey().couplingAnchors = Couple.create(null, null); carriage.trailingBogey().couplingAnchors = Couple.create(null, null); @@ -545,7 +545,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { return false; if (carriage.train.derailed) return false; - if (level.isClientSide) + if (level().isClientSide) return true; if (player.isSpectator()) return false; @@ -558,8 +558,8 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { .get(controlsLocalPos); Direction initialOrientation = getInitialOrientation().getCounterClockWise(); boolean inverted = false; - if (info != null && info.state.hasProperty(ControlsBlock.FACING)) - inverted = !info.state.getValue(ControlsBlock.FACING) + if (info != null && info.state().hasProperty(ControlsBlock.FACING)) + inverted = !info.state().getValue(ControlsBlock.FACING) .equals(initialOrientation); if (hudPacketCooldown-- <= 0 && player instanceof ServerPlayer sp) { @@ -705,7 +705,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { return; } - TrackGraph graph = CreateClient.RAILWAYS.sided(level).trackNetworks.get(optional.get()); + TrackGraph graph = CreateClient.RAILWAYS.sided(level()).trackNetworks.get(optional.get()); if (graph == null) return; carriage.train.graph = graph; @@ -730,7 +730,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { if (carriage.train.graph != null) entityData.set(TRACK_GRAPH, Optional.of(carriage.train.graph.id)); - DimensionalCarriageEntity dimensional = carriage.getDimensional(level); + DimensionalCarriageEntity dimensional = carriage.getDimensional(level()); dimensional.pivot = null; carriage.updateContraptionAnchors(); dimensional.updateRenderedCutoff(); diff --git a/src/main/java/com/simibubi/create/content/trains/entity/CarriageContraptionEntityRenderer.java b/src/main/java/com/simibubi/create/content/trains/entity/CarriageContraptionEntityRenderer.java index 30e3f0a48..bd53bcc81 100644 --- a/src/main/java/com/simibubi/create/content/trains/entity/CarriageContraptionEntityRenderer.java +++ b/src/main/java/com/simibubi/create/content/trains/entity/CarriageContraptionEntityRenderer.java @@ -58,7 +58,7 @@ public class CarriageContraptionEntityRenderer extends ContraptionEntityRenderer : BlockPos.ZERO.relative(entity.getInitialOrientation() .getCounterClockWise(), bogeySpacing); - if (!Backend.canUseInstancing(entity.level) && !entity.getContraption() + if (!Backend.canUseInstancing(entity.level()) && !entity.getContraption() .isHiddenInPortal(bogeyPos)) { ms.pushPose(); @@ -100,11 +100,11 @@ public class CarriageContraptionEntityRenderer extends ContraptionEntityRenderer public static int getBogeyLightCoords(CarriageContraptionEntity entity, CarriageBogey bogey, float partialTicks) { - var lightPos = new BlockPos( + var lightPos = BlockPos.containing( Objects.requireNonNullElseGet(bogey.getAnchorPosition(), () -> entity.getLightProbePosition(partialTicks))); - return LightTexture.pack(entity.level.getBrightness(LightLayer.BLOCK, lightPos), - entity.level.getBrightness(LightLayer.SKY, lightPos)); + return LightTexture.pack(entity.level().getBrightness(LightLayer.BLOCK, lightPos), + entity.level().getBrightness(LightLayer.SKY, lightPos)); } } diff --git a/src/main/java/com/simibubi/create/content/trains/entity/CarriageCouplingRenderer.java b/src/main/java/com/simibubi/create/content/trains/entity/CarriageCouplingRenderer.java index e941000f2..cecfe96db 100644 --- a/src/main/java/com/simibubi/create/content/trains/entity/CarriageCouplingRenderer.java +++ b/src/main/java/com/simibubi/create/content/trains/entity/CarriageCouplingRenderer.java @@ -116,16 +116,16 @@ public class CarriageCouplingRenderer { } public static int getPackedLightCoords(Entity pEntity, float pPartialTicks) { - BlockPos blockpos = new BlockPos(pEntity.getLightProbePosition(pPartialTicks)); + BlockPos blockpos = BlockPos.containing(pEntity.getLightProbePosition(pPartialTicks)); return LightTexture.pack(getBlockLightLevel(pEntity, blockpos), getSkyLightLevel(pEntity, blockpos)); } protected static int getSkyLightLevel(Entity pEntity, BlockPos pPos) { - return pEntity.level.getBrightness(LightLayer.SKY, pPos); + return pEntity.level().getBrightness(LightLayer.SKY, pPos); } protected static int getBlockLightLevel(Entity pEntity, BlockPos pPos) { - return pEntity.isOnFire() ? 15 : pEntity.level.getBrightness(LightLayer.BLOCK, pPos); + return pEntity.isOnFire() ? 15 : pEntity.level().getBrightness(LightLayer.BLOCK, pPos); } } diff --git a/src/main/java/com/simibubi/create/content/trains/entity/CarriageEntityHandler.java b/src/main/java/com/simibubi/create/content/trains/entity/CarriageEntityHandler.java index 1d1baa1a6..777fdd4e6 100644 --- a/src/main/java/com/simibubi/create/content/trains/entity/CarriageEntityHandler.java +++ b/src/main/java/com/simibubi/create/content/trains/entity/CarriageEntityHandler.java @@ -19,7 +19,7 @@ public class CarriageEntityHandler { if (!(entity instanceof CarriageContraptionEntity cce)) return; SectionPos newPos = event.getNewPos(); - Level level = entity.getLevel(); + Level level = entity.level(); if (level.isClientSide) return; if (!isActiveChunk(level, newPos.center())) @@ -29,7 +29,7 @@ public class CarriageEntityHandler { public static void validateCarriageEntity(CarriageContraptionEntity entity) { if (!entity.isAlive()) return; - Level level = entity.getLevel(); + Level level = entity.level(); if (level.isClientSide) return; if (!isActiveChunk(level, entity.blockPosition())) diff --git a/src/main/java/com/simibubi/create/content/trains/entity/CarriageParticles.java b/src/main/java/com/simibubi/create/content/trains/entity/CarriageParticles.java index b153a6d68..3b3f864af 100644 --- a/src/main/java/com/simibubi/create/content/trains/entity/CarriageParticles.java +++ b/src/main/java/com/simibubi/create/content/trains/entity/CarriageParticles.java @@ -39,7 +39,7 @@ public class CarriageParticles { if (leadingAnchor == null || !leadingAnchor.closerThan(camEntity.position(), 64)) return; - RandomSource r = entity.level.random; + RandomSource r = entity.level().random; Vec3 contraptionMotion = entity.position() .subtract(entity.getPrevPositionVec()); double length = contraptionMotion.length(); @@ -63,7 +63,7 @@ public class CarriageParticles { brakes.tickChaser(); prevMotion = length; - Level level = entity.level; + Level level = entity.level(); Vec3 position = entity.getPosition(0); float viewYRot = entity.getViewYRot(0); float viewXRot = entity.getViewXRot(0); diff --git a/src/main/java/com/simibubi/create/content/trains/entity/CarriageSounds.java b/src/main/java/com/simibubi/create/content/trains/entity/CarriageSounds.java index 53ce0df96..f327b2cef 100644 --- a/src/main/java/com/simibubi/create/content/trains/entity/CarriageSounds.java +++ b/src/main/java/com/simibubi/create/content/trains/entity/CarriageSounds.java @@ -124,20 +124,20 @@ public class CarriageSounds { if (entity.carriageIndex == 0) { float v = volume * (1 - seatCrossfade.getValue() * .35f) * .75f; if ((3 + tick) % 4 == 0) - AllSoundEvents.STEAM.playAt(entity.level, soundLocation, v * ((tick + 7) % 8 == 0 ? 0.75f : .45f), + AllSoundEvents.STEAM.playAt(entity.level(), soundLocation, v * ((tick + 7) % 8 == 0 ? 0.75f : .45f), 1.17f, false); if (tick % 16 == 0) - AllSoundEvents.STEAM.playAt(entity.level, soundLocation, v * 1.5f, .8f, false); + AllSoundEvents.STEAM.playAt(entity.level(), soundLocation, v * 1.5f, .8f, false); } if (!arrived && speedFactor.getValue() < .002f && train.accumulatedSteamRelease > 1) { arrived = true; float releaseVolume = train.accumulatedSteamRelease / 10f; - entity.level.playLocalSound(soundLocation.x, soundLocation.y, soundLocation.z, SoundEvents.LAVA_EXTINGUISH, + entity.level().playLocalSound(soundLocation.x, soundLocation.y, soundLocation.z, SoundEvents.LAVA_EXTINGUISH, SoundSource.NEUTRAL, .25f * releaseVolume, .78f, false); - entity.level.playLocalSound(soundLocation.x, soundLocation.y, soundLocation.z, + entity.level().playLocalSound(soundLocation.x, soundLocation.y, soundLocation.z, SoundEvents.WOODEN_TRAPDOOR_CLOSE, SoundSource.NEUTRAL, .2f * releaseVolume, 1.5f, false); - AllSoundEvents.STEAM.playAt(entity.level, soundLocation, .75f * releaseVolume, .5f, false); + AllSoundEvents.STEAM.playAt(entity.level(), soundLocation, .75f * releaseVolume, .5f, false); } float pitchModifier = ((entity.getId() * 10) % 13) / 36f; @@ -152,7 +152,7 @@ public class CarriageSounds { volume = Math.min(volume, distanceFactor.getValue() / 1000); for (Carriage carriage : train.carriages) { - DimensionalCarriageEntity mainDCE = carriage.getDimensionalIfPresent(entity.level.dimension()); + DimensionalCarriageEntity mainDCE = carriage.getDimensionalIfPresent(entity.level().dimension()); if (mainDCE == null) continue; CarriageContraptionEntity mainEntity = mainDCE.entity.get(); @@ -184,7 +184,7 @@ public class CarriageSounds { } train.honkTicks--; - train.determineHonk(entity.level); + train.determineHonk(entity.level()); if (train.lowHonk == null) return; diff --git a/src/main/java/com/simibubi/create/content/trains/entity/CarriageSyncData.java b/src/main/java/com/simibubi/create/content/trains/entity/CarriageSyncData.java index 70ac8d235..a49b435a3 100644 --- a/src/main/java/com/simibubi/create/content/trains/entity/CarriageSyncData.java +++ b/src/main/java/com/simibubi/create/content/trains/entity/CarriageSyncData.java @@ -113,7 +113,7 @@ public class CarriageSyncData { } public void update(CarriageContraptionEntity entity, Carriage carriage) { - DimensionalCarriageEntity dce = carriage.getDimensional(entity.level); + DimensionalCarriageEntity dce = carriage.getDimensional(entity.level()); TrackGraph graph = carriage.train.graph; if (graph == null) { @@ -154,7 +154,7 @@ public class CarriageSyncData { } public void apply(CarriageContraptionEntity entity, Carriage carriage) { - DimensionalCarriageEntity dce = carriage.getDimensional(entity.level); + DimensionalCarriageEntity dce = carriage.getDimensional(entity.level()); fallbackPointSnapshot = null; if (fallbackLocations != null) { @@ -227,7 +227,7 @@ public class CarriageSyncData { } public void approach(CarriageContraptionEntity entity, Carriage carriage, float partialIn) { - DimensionalCarriageEntity dce = carriage.getDimensional(entity.level); + DimensionalCarriageEntity dce = carriage.getDimensional(entity.level()); int updateInterval = entity.getType() .updateInterval(); diff --git a/src/main/java/com/simibubi/create/content/trains/entity/Train.java b/src/main/java/com/simibubi/create/content/trains/entity/Train.java index 3901bd197..0170f10c3 100644 --- a/src/main/java/com/simibubi/create/content/trains/entity/Train.java +++ b/src/main/java/com/simibubi/create/content/trains/entity/Train.java @@ -459,7 +459,7 @@ public class Train { if ((runtime.getSchedule() == null || runtime.paused) && signalEdgeGroup.isOccupiedUnless(this)) carriages.forEach(c -> c.forEachPresentEntity(cce -> cce.getControllingPlayer() - .ifPresent(uuid -> AllAdvancements.RED_SIGNAL.awardTo(cce.level.getPlayerByUUID(uuid))))); + .ifPresent(uuid -> AllAdvancements.RED_SIGNAL.awardTo(cce.level().getPlayerByUUID(uuid))))); signalEdgeGroup.reserved = signal; occupy(groupId, signal.id); @@ -475,7 +475,7 @@ public class Train { c.forEachPresentEntity(cce -> cce.getContraption() .getActors() .forEach(pair -> { - MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.getKey().state); + MovementBehaviour behaviour = AllMovementBehaviours.getBehaviour(pair.getKey().state()); if (behaviour != null) behaviour.cancelStall(pair.getValue()); })); @@ -726,7 +726,7 @@ public class Train { CarriageContraptionEntity entity = carriage.anyAvailableEntity(); if (entity == null) return false; - level = entity.level; + level = entity.level(); if (entity.getContraption()instanceof CarriageContraption cc) cc.returnStorageForDisassembly(carriage.storage); @@ -739,7 +739,7 @@ public class Train { continue; Vec3 bogeyPosition = bogey.getAnchorPosition(); if (bogeyPosition == null) continue; - BlockEntity be = level.getBlockEntity(new BlockPos(bogeyPosition)); + BlockEntity be = level.getBlockEntity(BlockPos.containing(bogeyPosition)); if (!(be instanceof AbstractBogeyBlockEntity sbbe)) continue; sbbe.setBogeyData(bogey.bogeyData); diff --git a/src/main/java/com/simibubi/create/content/trains/entity/TrainIconType.java b/src/main/java/com/simibubi/create/content/trains/entity/TrainIconType.java index fa2d55bb5..338dc94a4 100644 --- a/src/main/java/com/simibubi/create/content/trains/entity/TrainIconType.java +++ b/src/main/java/com/simibubi/create/content/trains/entity/TrainIconType.java @@ -7,7 +7,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.Create; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -58,7 +58,7 @@ public class TrainIconType { int offset = getIconOffset(lengthOrEngine); int width = getIconWidth(lengthOrEngine); RenderSystem.setShaderTexture(0, sheet); - GuiComponent.blit(ms, x, y, 0, this.x + offset, this.y, width, 10, 256, 256); + GuiGraphics.blit(ms, x, y, 0, this.x + offset, this.y, width, 10, 256, 256); return width; } diff --git a/src/main/java/com/simibubi/create/content/trains/entity/TrainRelocationPacket.java b/src/main/java/com/simibubi/create/content/trains/entity/TrainRelocationPacket.java index 8762dbd5f..8f92ec2cb 100644 --- a/src/main/java/com/simibubi/create/content/trains/entity/TrainRelocationPacket.java +++ b/src/main/java/com/simibubi/create/content/trains/entity/TrainRelocationPacket.java @@ -68,7 +68,7 @@ public class TrainRelocationPacket extends SimplePacketBase { context.enqueueWork(() -> { ServerPlayer sender = context.getSender(); Train train = Create.RAILWAYS.trains.get(trainId); - Entity entity = sender.level.getEntity(entityId); + Entity entity = sender.level().getEntity(entityId); String messagePrefix = sender.getName() .getString() + " could not relocate Train "; @@ -95,7 +95,7 @@ public class TrainRelocationPacket extends SimplePacketBase { return; } - if (TrainRelocator.relocate(train, sender.level, pos, hoveredBezier, direction, lookAngle, false)) { + if (TrainRelocator.relocate(train, sender.level(), pos, hoveredBezier, direction, lookAngle, false)) { sender.displayClientMessage(Lang.translateDirect("train.relocate.success") .withStyle(ChatFormatting.GREEN), true); train.carriages.forEach(c -> c.forEachPresentEntity(e -> { diff --git a/src/main/java/com/simibubi/create/content/trains/graph/TrackNodeLocation.java b/src/main/java/com/simibubi/create/content/trains/graph/TrackNodeLocation.java index 868bbc77c..aa0a4690e 100644 --- a/src/main/java/com/simibubi/create/content/trains/graph/TrackNodeLocation.java +++ b/src/main/java/com/simibubi/create/content/trains/graph/TrackNodeLocation.java @@ -15,6 +15,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtUtils; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceKey; +import net.minecraft.util.Mth; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; @@ -28,7 +29,7 @@ public class TrackNodeLocation extends Vec3i { } public TrackNodeLocation(double x, double y, double z) { - super(Math.round(x * 2), Math.floor(y) * 2, Math.round(z * 2)); + super(Mth.floor(Math.round(x * 2)), Mth.floor(y) * 2, Mth.floor(Math.round(z * 2))); } public TrackNodeLocation in(Level level) { @@ -114,7 +115,7 @@ public class TrackNodeLocation extends Vec3i { for (int x : Iterate.positiveAndNegative) for (int y : Iterate.positiveAndNegative) for (int z : Iterate.positiveAndNegative) - set.add(new BlockPos(vec3.add(x * step, y * step, z * step))); + set.add(BlockPos.containing(vec3.add(x * step, y * step, z * step))); return set; } diff --git a/src/main/java/com/simibubi/create/content/trains/schedule/ScheduleItem.java b/src/main/java/com/simibubi/create/content/trains/schedule/ScheduleItem.java index c41f57673..516ad6d34 100644 --- a/src/main/java/com/simibubi/create/content/trains/schedule/ScheduleItem.java +++ b/src/main/java/com/simibubi/create/content/trains/schedule/ScheduleItem.java @@ -76,7 +76,7 @@ public class ScheduleItem extends Item implements MenuProvider { Entity rootVehicle = pInteractionTarget.getRootVehicle(); if (!(rootVehicle instanceof CarriageContraptionEntity)) return pass; - if (pPlayer.level.isClientSide) + if (pPlayer.level().isClientSide) return InteractionResult.SUCCESS; CarriageContraptionEntity entity = (CarriageContraptionEntity) rootVehicle; @@ -96,25 +96,25 @@ public class ScheduleItem extends Item implements MenuProvider { Couple directions = cc.conductorSeats.get(seatPos); if (directions == null) { pPlayer.displayClientMessage(Lang.translateDirect("schedule.non_controlling_seat"), true); - AllSoundEvents.DENY.playOnServer(pPlayer.level, pPlayer.blockPosition(), 1, 1); + AllSoundEvents.DENY.playOnServer(pPlayer.level(), pPlayer.blockPosition(), 1, 1); return InteractionResult.SUCCESS; } if (train.runtime.getSchedule() != null) { - AllSoundEvents.DENY.playOnServer(pPlayer.level, pPlayer.blockPosition(), 1, 1); + AllSoundEvents.DENY.playOnServer(pPlayer.level(), pPlayer.blockPosition(), 1, 1); pPlayer.displayClientMessage(Lang.translateDirect("schedule.remove_with_empty_hand"), true); return InteractionResult.SUCCESS; } if (schedule.entries.isEmpty()) { - AllSoundEvents.DENY.playOnServer(pPlayer.level, pPlayer.blockPosition(), 1, 1); + AllSoundEvents.DENY.playOnServer(pPlayer.level(), pPlayer.blockPosition(), 1, 1); pPlayer.displayClientMessage(Lang.translateDirect("schedule.no_stops"), true); return InteractionResult.SUCCESS; } train.runtime.setSchedule(schedule, false); AllAdvancements.CONDUCTOR.awardTo(pPlayer); - AllSoundEvents.CONFIRM.playOnServer(pPlayer.level, pPlayer.blockPosition(), 1, 1); + AllSoundEvents.CONFIRM.playOnServer(pPlayer.level(), pPlayer.blockPosition(), 1, 1); pPlayer.displayClientMessage(Lang.translateDirect("schedule.applied_to_train") .withStyle(ChatFormatting.GREEN), true); pStack.shrink(1); diff --git a/src/main/java/com/simibubi/create/content/trains/schedule/ScheduleItemEntityInteraction.java b/src/main/java/com/simibubi/create/content/trains/schedule/ScheduleItemEntityInteraction.java index 11b067933..f4a048b1c 100644 --- a/src/main/java/com/simibubi/create/content/trains/schedule/ScheduleItemEntityInteraction.java +++ b/src/main/java/com/simibubi/create/content/trains/schedule/ScheduleItemEntityInteraction.java @@ -82,7 +82,7 @@ public class ScheduleItemEntityInteraction { if (train.runtime.paused && !train.runtime.completed) { if (onServer) { train.runtime.paused = false; - AllSoundEvents.CONFIRM.playOnServer(player.level, player.blockPosition(), 1, 1); + AllSoundEvents.CONFIRM.playOnServer(player.level(), player.blockPosition(), 1, 1); player.displayClientMessage(Lang.translateDirect("schedule.continued"), true); } @@ -96,7 +96,7 @@ public class ScheduleItemEntityInteraction { ItemStack itemInHand = player.getItemInHand(event.getHand()); if (!itemInHand.isEmpty()) { if (onServer) { - AllSoundEvents.DENY.playOnServer(player.level, player.blockPosition(), 1, 1); + AllSoundEvents.DENY.playOnServer(player.level(), player.blockPosition(), 1, 1); player.displayClientMessage(Lang.translateDirect("schedule.remove_with_empty_hand"), true); } event.setCancellationResult(InteractionResult.SUCCESS); diff --git a/src/main/java/com/simibubi/create/content/trains/schedule/condition/TimeOfDayCondition.java b/src/main/java/com/simibubi/create/content/trains/schedule/condition/TimeOfDayCondition.java index 1596b57f0..b6411bde2 100644 --- a/src/main/java/com/simibubi/create/content/trains/schedule/condition/TimeOfDayCondition.java +++ b/src/main/java/com/simibubi/create/content/trains/schedule/condition/TimeOfDayCondition.java @@ -17,7 +17,7 @@ import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Pair; import net.minecraft.ChatFormatting; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; @@ -107,7 +107,7 @@ public class TimeOfDayCondition extends ScheduleWaitCondition { float progress = (displayHr * 60f + intData("Minute")) / (24 * 60); RenderSystem.setShaderTexture(0, new ResourceLocation("textures/item/clock_" + twoDigits(Mth.clamp((int) (progress * 64), 0, 63)) + ".png")); - GuiComponent.blit(ms, x, y, 0, 0, 0, 16, 16, 16, 16); + GuiGraphics.blit(ms, x, y, 0, 0, 0, 16, 16, 16, 16); return true; } diff --git a/src/main/java/com/simibubi/create/content/trains/station/StationBlockEntity.java b/src/main/java/com/simibubi/create/content/trains/station/StationBlockEntity.java index 44657b81f..1ec5b41f0 100644 --- a/src/main/java/com/simibubi/create/content/trains/station/StationBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/trains/station/StationBlockEntity.java @@ -283,8 +283,8 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab if (bb == null || !bb.isInside(pos)) return false; - BlockPos up = new BlockPos(track.getUpNormal(level, pos, state)); - BlockPos down = new BlockPos(track.getUpNormal(level, pos, state).scale(-1)); + BlockPos up = BlockPos.containing(track.getUpNormal(level, pos, state)); + BlockPos down = BlockPos.containing(track.getUpNormal(level, pos, state).scale(-1)); int bogeyOffset = pos.distManhattan(edgePoint.getGlobalPosition()) - 1; if (!isValidBogeyOffset(bogeyOffset)) { @@ -493,7 +493,7 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab MutableBlockPos currentPos = targetPosition.mutable(); currentPos.move(assemblyDirection); - BlockPos bogeyOffset = new BlockPos(track.getUpNormal(level, targetPosition, trackState)); + BlockPos bogeyOffset = BlockPos.containing(track.getUpNormal(level, targetPosition, trackState)); int MAX_LENGTH = AllConfigs.server().trains.maxAssemblyLength.get(); int MAX_BOGEY_COUNT = AllConfigs.server().trains.maxBogeyCount.get(); @@ -614,7 +614,7 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab BlockPos trackPosition = edgePoint.getGlobalPosition(); BlockState trackState = edgePoint.getTrackBlockState(); ITrackBlock track = edgePoint.getTrack(); - BlockPos bogeyOffset = new BlockPos(track.getUpNormal(level, trackPosition, trackState)); + BlockPos bogeyOffset = BlockPos.containing(track.getUpNormal(level, trackPosition, trackState)); TrackNodeLocation location = null; Vec3 centre = Vec3.atBottomCenterOf(trackPosition) diff --git a/src/main/java/com/simibubi/create/content/trains/station/TrainEditPacket.java b/src/main/java/com/simibubi/create/content/trains/station/TrainEditPacket.java index 41365547f..5ee103bef 100644 --- a/src/main/java/com/simibubi/create/content/trains/station/TrainEditPacket.java +++ b/src/main/java/com/simibubi/create/content/trains/station/TrainEditPacket.java @@ -45,7 +45,7 @@ public class TrainEditPacket extends SimplePacketBase { public boolean handle(Context context) { context.enqueueWork(() -> { ServerPlayer sender = context.getSender(); - Level level = sender == null ? null : sender.level; + Level level = sender == null ? null : sender.level(); Train train = Create.RAILWAYS.sided(level).trains.get(id); if (train == null) return; diff --git a/src/main/java/com/simibubi/create/content/trains/track/BezierConnection.java b/src/main/java/com/simibubi/create/content/trains/track/BezierConnection.java index 8bce70138..6f0744198 100644 --- a/src/main/java/com/simibubi/create/content/trains/track/BezierConnection.java +++ b/src/main/java/com/simibubi/create/content/trains/track/BezierConnection.java @@ -538,7 +538,7 @@ public class BezierConnection implements Iterable { .add(previousOffsets.getSecond()) .scale(.5); Vec3 tieAngles = TrackRenderer.getModelAngles(segment.normal, railMiddle.subtract(prevMiddle)); - angles.lightPosition = new BlockPos(railMiddle); + angles.lightPosition = BlockPos.containing(railMiddle); angles.railTransforms = Couple.create(null, null); PoseStack poseStack = new PoseStack(); @@ -602,7 +602,7 @@ public class BezierConnection implements Iterable { Vec3 leftBottom = leftTop.add(secondGirderOffset); Vec3 rightBottom = rightTop.add(secondGirderOffset); - angles.lightPosition = new BlockPos(leftGirder.add(rightGirder) + angles.lightPosition = BlockPos.containing(leftGirder.add(rightGirder) .scale(.5)); Couple> offsets = diff --git a/src/main/java/com/simibubi/create/content/trains/track/CurvedTrackDestroyPacket.java b/src/main/java/com/simibubi/create/content/trains/track/CurvedTrackDestroyPacket.java index 35282aad9..14c23b264 100644 --- a/src/main/java/com/simibubi/create/content/trains/track/CurvedTrackDestroyPacket.java +++ b/src/main/java/com/simibubi/create/content/trains/track/CurvedTrackDestroyPacket.java @@ -65,7 +65,7 @@ public class CurvedTrackDestroyPacket extends BlockEntityConfigurationPacket= 1) { AllPackets.getChannel().sendToServer(new CurvedTrackDestroyPacket(breakPos, result.loc() - .curveTarget(), new BlockPos(result.vec()), false)); + .curveTarget(), BlockPos.containing(result.vec()), false)); resetBreakProgress(); } @@ -127,11 +127,12 @@ public class CurvedTrackInteraction { return true; } if (AllItems.WRENCH.isIn(heldItem) && player.isSteppingCarefully()) { - AllPackets.getChannel().sendToServer(new CurvedTrackDestroyPacket(result.blockEntity() - .getBlockPos(), - result.loc() - .curveTarget(), - new BlockPos(result.vec()), true)); + AllPackets.getChannel() + .sendToServer(new CurvedTrackDestroyPacket(result.blockEntity() + .getBlockPos(), + result.loc() + .curveTarget(), + BlockPos.containing(result.vec()), true)); resetBreakProgress(); player.swing(InteractionHand.MAIN_HAND); return true; diff --git a/src/main/java/com/simibubi/create/content/trains/track/CurvedTrackSelectionPacket.java b/src/main/java/com/simibubi/create/content/trains/track/CurvedTrackSelectionPacket.java index b8d5aac03..7a9dd346a 100644 --- a/src/main/java/com/simibubi/create/content/trains/track/CurvedTrackSelectionPacket.java +++ b/src/main/java/com/simibubi/create/content/trains/track/CurvedTrackSelectionPacket.java @@ -63,19 +63,19 @@ public class CurvedTrackSelectionPacket extends BlockEntityConfigurationPacket type = AllBlocks.TRACK_SIGNAL.isIn(stack) ? EdgePointType.SIGNAL : EdgePointType.STATION; MutableObject result = new MutableObject<>(null); - TrackTargetingBlockItem.withGraphLocation(player.level, pos, front, + TrackTargetingBlockItem.withGraphLocation(player.level(), pos, front, new BezierTrackPointLocation(targetPos, segment), type, (overlap, location) -> result.setValue(overlap)); if (result.getValue().feedback != null) { player.displayClientMessage(Lang.translateDirect(result.getValue().feedback) .withStyle(ChatFormatting.RED), true); - AllSoundEvents.DENY.play(player.level, null, pos, .5f, 1); + AllSoundEvents.DENY.play(player.level(), null, pos, .5f, 1); return; } @@ -91,7 +91,7 @@ public class CurvedTrackSelectionPacket extends BlockEntityConfigurationPacket key = Pair.of(pos.getX(), pos.getZ()); if (!yLevels.containsKey(key) || yLevels.get(key) > vec.y) yLevels.put(key, vec.y); @@ -434,8 +435,7 @@ public class TrackBlockEntity extends SmartBlockEntity implements ITransformable if (!fluidState.isEmpty() && !fluidState.isSourceOfType(Fluids.WATER)) continue; - if (!present && stateAtPos.getMaterial() - .isReplaceable()) + if (!present && stateAtPos.canBeReplaced()) level.setBlock(targetPos, ProperWaterloggedBlock.withWater(level, AllBlocks.FAKE_TRACK.getDefaultState(), targetPos), 3); FakeTrackBlock.keepAlive(level, targetPos); diff --git a/src/main/java/com/simibubi/create/content/trains/track/TrackBlockItem.java b/src/main/java/com/simibubi/create/content/trains/track/TrackBlockItem.java index 898f07216..c3caa8b3a 100644 --- a/src/main/java/com/simibubi/create/content/trains/track/TrackBlockItem.java +++ b/src/main/java/com/simibubi/create/content/trains/track/TrackBlockItem.java @@ -95,8 +95,7 @@ public class TrackBlockItem extends BlockItem { tag.remove("ExtendCurve"); if (placing) { - if (!state.getMaterial() - .isReplaceable()) + if (!state.canBeReplaced()) pos = pos.relative(pContext.getClickedFace()); state = getPlacementState(pContext); if (state == null) diff --git a/src/main/java/com/simibubi/create/content/trains/track/TrackBlockOutline.java b/src/main/java/com/simibubi/create/content/trains/track/TrackBlockOutline.java index cf50be35c..396242257 100644 --- a/src/main/java/com/simibubi/create/content/trains/track/TrackBlockOutline.java +++ b/src/main/java/com/simibubi/create/content/trains/track/TrackBlockOutline.java @@ -63,7 +63,7 @@ public class TrackBlockOutline { result = null; - AttributeInstance range = player.getAttribute(ForgeMod.REACH_DISTANCE.get()); + AttributeInstance range = player.getAttribute(ForgeMod.BLOCK_REACH.get()); Vec3 target = RaycastHelper.getTraceTarget(player, Math.min(maxRange, range.getValue()) + 1, origin); Map turns = TRACKS_WITH_TURNS.get(mc.level); @@ -137,7 +137,7 @@ public class TrackBlockOutline { if (mc.hitResult != null && mc.hitResult.getType() != Type.MISS) { Vec3 priorLoc = mc.hitResult.getLocation(); - mc.hitResult = BlockHitResult.miss(priorLoc, Direction.UP, new BlockPos(priorLoc)); + mc.hitResult = BlockHitResult.miss(priorLoc, Direction.UP, BlockPos.containing(priorLoc)); } } diff --git a/src/main/java/com/simibubi/create/content/trains/track/TrackPaver.java b/src/main/java/com/simibubi/create/content/trains/track/TrackPaver.java index cf1e25569..3a2058e6e 100644 --- a/src/main/java/com/simibubi/create/content/trains/track/TrackPaver.java +++ b/src/main/java/com/simibubi/create/content/trains/track/TrackPaver.java @@ -57,18 +57,18 @@ public class TrackPaver { for (int i = 0; i < extent; i++) { Vec3 offset = direction.scale(i); Vec3 mainPos = start.add(offset.x, offset.y, offset.z); - toPlaceOn.add(new BlockPos(mainPos.add(mainNormal))); - toPlaceOn.add(new BlockPos(mainPos.subtract(mainNormal))); + toPlaceOn.add(BlockPos.containing(mainPos.add(mainNormal))); + toPlaceOn.add(BlockPos.containing(mainPos.subtract(mainNormal))); if (wallLike) continue; - toPlaceOn.add(new BlockPos(mainPos)); + toPlaceOn.add(BlockPos.containing(mainPos)); if (i < extent - 1) for (int x : Iterate.positiveAndNegative) - toPlaceOn.add(new BlockPos(mainPos.add(normalizedNormal.scale(x * diagFiller)) + toPlaceOn.add(BlockPos.containing(mainPos.add(normalizedNormal.scale(x * diagFiller)) .add(normalizedDirection.scale(diagFiller)))); if (i > 0) for (int x : Iterate.positiveAndNegative) - toPlaceOn.add(new BlockPos(mainPos.add(normalizedNormal.scale(x * diagFiller)) + toPlaceOn.add(BlockPos.containing(mainPos.add(normalizedNormal.scale(x * diagFiller)) .add(normalizedDirection.scale(-diagFiller)))); } @@ -140,7 +140,7 @@ public class TrackPaver { .scale(.5); for (Vec3 vec : new Vec3[] { rail1, rail2, railMiddle }) { - BlockPos pos = new BlockPos(vec); + BlockPos pos = BlockPos.containing(vec); Pair key = Pair.of(pos.getX(), pos.getZ()); if (!yLevels.containsKey(key) || yLevels.get(key) > vec.y) yLevels.put(key, vec.y); @@ -181,8 +181,7 @@ public class TrackPaver { private static boolean placeBlockIfFree(Level level, BlockPos pos, BlockState state, boolean simulate) { BlockState stateAtPos = level.getBlockState(pos); - if (stateAtPos.getBlock() != state.getBlock() && stateAtPos.getMaterial() - .isReplaceable()) { + if (stateAtPos.getBlock() != state.getBlock() && stateAtPos.canBeReplaced()) { if (!simulate) level.setBlock(pos, ProperWaterloggedBlock.withWater(level, state, pos), 3); return true; diff --git a/src/main/java/com/simibubi/create/content/trains/track/TrackPlacement.java b/src/main/java/com/simibubi/create/content/trains/track/TrackPlacement.java index 7c73f9da3..f76b584ed 100644 --- a/src/main/java/com/simibubi/create/content/trains/track/TrackPlacement.java +++ b/src/main/java/com/simibubi/create/content/trains/track/TrackPlacement.java @@ -196,8 +196,8 @@ public class TrackPlacement { if (level.isClientSide) { Vec3 offset1 = axis1.scale(info.end1Extent); Vec3 offset2 = axis2.scale(info.end2Extent); - BlockPos targetPos1 = pos1.offset(offset1.x, offset1.y, offset1.z); - BlockPos targetPos2 = pos2.offset(offset2.x, offset2.y, offset2.z); + BlockPos targetPos1 = pos1.offset(BlockPos.containing(offset1)); + BlockPos targetPos2 = pos2.offset(BlockPos.containing(offset2)); info.curve = new BezierConnection(Couple.create(targetPos1, targetPos2), Couple.create(end1.add(offset1), end2.add(offset2)), Couple.create(normedAxis1, normedAxis2), Couple.create(normal1, normal2), true, girder, TrackMaterial.fromItem(stack.getItem())); @@ -354,8 +354,8 @@ public class TrackPlacement { Vec3 offset1 = axis1.scale(info.end1Extent); Vec3 offset2 = axis2.scale(info.end2Extent); - BlockPos targetPos1 = pos1.offset(offset1.x, offset1.y, offset1.z); - BlockPos targetPos2 = pos2.offset(offset2.x, offset2.y, offset2.z); + BlockPos targetPos1 = pos1.offset(BlockPos.containing(offset1)); + BlockPos targetPos2 = pos2.offset(BlockPos.containing(offset2)); info.curve = skipCurve ? null : new BezierConnection(Couple.create(targetPos1, targetPos2), @@ -515,13 +515,12 @@ public class TrackPlacement { for (int i = 0; i < (info.curve != null ? extent + 1 : extent); i++) { Vec3 offset = axis.scale(i); - BlockPos offsetPos = pos.offset(offset.x, offset.y, offset.z); + BlockPos offsetPos = pos.offset(BlockPos.containing(offset)); BlockState stateAtPos = level.getBlockState(offsetPos); // copy over all shared properties from the shaped state to the correct track material block BlockState toPlace = copyProperties(state, info.trackMaterial.getBlock().defaultBlockState()); - boolean canPlace = stateAtPos.getMaterial() - .isReplaceable(); + boolean canPlace = stateAtPos.canBeReplaced(); if (canPlace) info.requiredTracks++; if (simulate) @@ -612,12 +611,11 @@ public class TrackPlacement { return; TrackBlockItem blockItem = (TrackBlockItem) stack.getItem(); - Level level = player.level; + Level level = player.level(); BlockHitResult bhr = (BlockHitResult) hitResult; BlockPos pos = bhr.getBlockPos(); BlockState hitState = level.getBlockState(pos); - if (!(hitState.getBlock() instanceof TrackBlock) && !hitState.getMaterial() - .isReplaceable()) { + if (!(hitState.getBlock() instanceof TrackBlock) && !hitState.canBeReplaced()) { pos = pos.relative(bhr.getDirection()); hitState = blockItem.getPlacementState(new UseOnContext(player, hand, bhr)); if (hitState == null) diff --git a/src/main/java/com/simibubi/create/content/trains/track/TrackTargetingBehaviour.java b/src/main/java/com/simibubi/create/content/trains/track/TrackTargetingBehaviour.java index 006c7b981..6c490711d 100644 --- a/src/main/java/com/simibubi/create/content/trains/track/TrackTargetingBehaviour.java +++ b/src/main/java/com/simibubi/create/content/trains/track/TrackTargetingBehaviour.java @@ -277,7 +277,7 @@ public class TrackTargetingBehaviour extends BlockEnti double length = Mth.floor(bc.getLength() * 2); int seg = targetBezier.segment() + 1; double t = seg / length; - return new BlockPos(bc.getPosition(t)); + return BlockPos.containing(bc.getPosition(t)); } return target; } diff --git a/src/main/java/com/simibubi/create/content/trains/track/TrackTargetingBlockItem.java b/src/main/java/com/simibubi/create/content/trains/track/TrackTargetingBlockItem.java index bae77d799..f250b2c58 100644 --- a/src/main/java/com/simibubi/create/content/trains/track/TrackTargetingBlockItem.java +++ b/src/main/java/com/simibubi/create/content/trains/track/TrackTargetingBlockItem.java @@ -114,8 +114,7 @@ public class TrackTargetingBlockItem extends BlockItem { teTag.putBoolean("TargetDirection", tag.getBoolean("SelectedDirection")); BlockPos selectedPos = NbtUtils.readBlockPos(tag.getCompound("SelectedPos")); - BlockPos placedPos = pos.relative(pContext.getClickedFace(), state.getMaterial() - .isReplaceable() ? 0 : 1); + BlockPos placedPos = pos.relative(pContext.getClickedFace(), state.canBeReplaced() ? 0 : 1); boolean bezier = tag.contains("Bezier"); diff --git a/src/main/java/com/simibubi/create/foundation/block/BigOutlines.java b/src/main/java/com/simibubi/create/foundation/block/BigOutlines.java index 25f9319f5..b0146a0d9 100644 --- a/src/main/java/com/simibubi/create/foundation/block/BigOutlines.java +++ b/src/main/java/com/simibubi/create/foundation/block/BigOutlines.java @@ -36,7 +36,7 @@ public class BigOutlines { : mc.hitResult.getLocation() .distanceToSqr(origin); - AttributeInstance range = player.getAttribute(ForgeMod.REACH_DISTANCE.get()); + AttributeInstance range = player.getAttribute(ForgeMod.BLOCK_REACH.get()); Vec3 target = RaycastHelper.getTraceTarget(player, Math.min(maxRange, range.getValue()) + 1, origin); RaycastHelper.rayTraceUntil(origin, target, pos -> { @@ -91,7 +91,7 @@ public class BigOutlines { double y = player.getY() - (pos.getY() + .5) + 1.5; double z = player.getZ() - (pos.getZ() + .5); double distSqr = x * x + y * y + z * z; - double maxDist = player.getAttribute(ForgeMod.REACH_DISTANCE.get()) + double maxDist = player.getAttribute(ForgeMod.BLOCK_REACH.get()) .getValue() + 1; maxDist *= maxDist; return distSqr <= maxDist; diff --git a/src/main/java/com/simibubi/create/foundation/blockEntity/SmartBlockEntity.java b/src/main/java/com/simibubi/create/foundation/blockEntity/SmartBlockEntity.java index 0e3931ad0..f5a8a4fa6 100644 --- a/src/main/java/com/simibubi/create/foundation/blockEntity/SmartBlockEntity.java +++ b/src/main/java/com/simibubi/create/foundation/blockEntity/SmartBlockEntity.java @@ -25,8 +25,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; -import net.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.common.capabilities.ForgeCapabilities; public abstract class SmartBlockEntity extends CachedRenderBBBlockEntity implements IPartialSafeNBT, IInteractionChecker, ISpecialBlockEntityItemRequirement { @@ -237,11 +236,11 @@ public abstract class SmartBlockEntity extends CachedRenderBBBlockEntity } protected boolean isItemHandlerCap(Capability cap) { - return cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY; + return cap == ForgeCapabilities.ITEM_HANDLER; } protected boolean isFluidHandlerCap(Capability cap) { - return cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY; + return cap == ForgeCapabilities.FLUID_HANDLER; } public void registerAwardables(List behaviours, CreateAdvancement... advancements) { diff --git a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBoxRenderer.java b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBoxRenderer.java index 88ef38d93..07e279463 100644 --- a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBoxRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBoxRenderer.java @@ -8,7 +8,6 @@ import com.simibubi.create.content.kinetics.simpleRelays.AbstractSimpleShaftBloc import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.resources.model.BakedModel; @@ -16,6 +15,7 @@ import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -33,7 +33,7 @@ public class ValueBoxRenderer { float zOffset = (!blockItem ? -.15f : 0) + customZOffset(filter.getItem()); ms.scale(scale, scale, scale); ms.translate(0, 0, zOffset); - itemRenderer.renderStatic(filter, TransformType.FIXED, light, overlay, ms, buffer, 0); + itemRenderer.renderStatic(filter, ItemDisplayContext.FIXED, light, overlay, ms, buffer, 0); } public static void renderFlatItemIntoValueBox(ItemStack filter, PoseStack ms, MultiBufferSource buffer, int light, @@ -69,7 +69,7 @@ public class ValueBoxRenderer { .set(copy); Minecraft.getInstance() .getItemRenderer() - .renderStatic(filter, TransformType.GUI, itemLight, OverlayTexture.NO_OVERLAY, squashedMS, buffer, 0); + .renderStatic(filter, ItemDisplayContext.GUI, itemLight, OverlayTexture.NO_OVERLAY, squashedMS, buffer, 0); ms.popPose(); } diff --git a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBoxTransform.java b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBoxTransform.java index 65f30cca5..8a410a584 100644 --- a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBoxTransform.java +++ b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBoxTransform.java @@ -13,7 +13,6 @@ import net.minecraft.core.Direction; import net.minecraft.core.Direction.Axis; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; -import net.minecraft.world.level.material.Material; import net.minecraft.world.phys.Vec3; public abstract class ValueBoxTransform { @@ -41,7 +40,7 @@ public abstract class ValueBoxTransform { } public boolean shouldRender(BlockState state) { - return state.getMaterial() != Material.AIR && getLocalOffset(state) != null; + return !state.isAir() && getLocalOffset(state) != null; } public int getOverrideColor() { diff --git a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/filtering/FilteringBehaviour.java b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/filtering/FilteringBehaviour.java index 01db2b804..9eb595e38 100644 --- a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/filtering/FilteringBehaviour.java +++ b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/filtering/FilteringBehaviour.java @@ -305,7 +305,7 @@ public class FilteringBehaviour extends BlockEntityBehaviour implements ValueSet if (!setFilter(side, toApply)) { player.displayClientMessage(Lang.translateDirect("logistics.filter.invalid_item"), true); - AllSoundEvents.DENY.playOnServer(player.level, player.blockPosition(), 1, 1); + AllSoundEvents.DENY.playOnServer(player.level(), player.blockPosition(), 1, 1); return; } @@ -372,7 +372,7 @@ public class FilteringBehaviour extends BlockEntityBehaviour implements ValueSet .withStyle(ChatFormatting.WHITE)) .style(ChatFormatting.RED) .component(), true); - AllSoundEvents.DENY.playOnServer(player.level, player.blockPosition(), 1, 1); + AllSoundEvents.DENY.playOnServer(player.level(), player.blockPosition(), 1, 1); return false; } diff --git a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/filtering/FilteringRenderer.java b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/filtering/FilteringRenderer.java index 4a6c25756..2e3878ccb 100644 --- a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/filtering/FilteringRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/filtering/FilteringRenderer.java @@ -108,7 +108,7 @@ public class FilteringRenderer { if (!be.isVirtual()) { Entity cameraEntity = Minecraft.getInstance().cameraEntity; - if (cameraEntity != null && be.getLevel() == cameraEntity.getLevel()) { + if (cameraEntity != null && be.getLevel() == cameraEntity.level()) { float max = AllConfigs.client().filterItemRenderDistance.getF(); if (cameraEntity.position() .distanceToSqr(VecHelper.getCenterOf(be.getBlockPos())) > (max * max)) { diff --git a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/inventory/InvManipulationBehaviour.java b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/inventory/InvManipulationBehaviour.java index f1083ba1f..9390d5df2 100644 --- a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/inventory/InvManipulationBehaviour.java +++ b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/inventory/InvManipulationBehaviour.java @@ -11,7 +11,7 @@ import com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode; import net.minecraft.world.item.ItemStack; import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; @@ -44,7 +44,7 @@ public class InvManipulationBehaviour extends CapManipulationBehaviourBase capability() { - return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY; + return ForgeCapabilities.ITEM_HANDLER; } public ItemStack extract() { diff --git a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/inventory/TankManipulationBehaviour.java b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/inventory/TankManipulationBehaviour.java index aab7b1261..3a4bbe985 100644 --- a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/inventory/TankManipulationBehaviour.java +++ b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/inventory/TankManipulationBehaviour.java @@ -8,8 +8,8 @@ import com.simibubi.create.foundation.blockEntity.behaviour.BehaviourType; import com.simibubi.create.foundation.blockEntity.behaviour.filtering.FilteringBehaviour; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; @@ -58,7 +58,7 @@ public class TankManipulationBehaviour extends CapManipulationBehaviourBase capability() { - return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY; + return ForgeCapabilities.FLUID_HANDLER; } @Override diff --git a/src/main/java/com/simibubi/create/foundation/data/BuilderTransformers.java b/src/main/java/com/simibubi/create/foundation/data/BuilderTransformers.java index 34f51e760..6b9d18590 100644 --- a/src/main/java/com/simibubi/create/foundation/data/BuilderTransformers.java +++ b/src/main/java/com/simibubi/create/foundation/data/BuilderTransformers.java @@ -65,8 +65,7 @@ import net.minecraft.world.level.block.TrapDoorBlock; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.PistonType; -import net.minecraft.world.level.material.Material; -import net.minecraft.world.level.material.MaterialColor; +import net.minecraft.world.level.material.MapColor; import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.LootTable.Builder; @@ -113,7 +112,7 @@ public class BuilderTransformers { .getExistingFile(p.mcLoc("air")))) .initialProperties(SharedProperties::softMetal) .properties(p -> p.noOcclusion() - .color(MaterialColor.NONE)) + .mapColor(MapColor.NONE)) .addLayer(() -> RenderType::solid) .addLayer(() -> RenderType::cutout) .addLayer(() -> RenderType::cutoutMipped) @@ -142,7 +141,7 @@ public class BuilderTransformers { } public static NonNullUnaryOperator> slidingDoor(String type) { - return b -> b.initialProperties(Material.NETHER_WOOD) // for villager AI.. + return b -> b.initialProperties(Material.NETHER_WOOD) // for villager AI. FIXME 1.20.1 consider a blocksettype? .properties(p -> p.requiresCorrectToolForDrops() .strength(3.0F, 6.0F)) .blockstate((c, p) -> { @@ -227,7 +226,7 @@ public class BuilderTransformers { } public static NonNullUnaryOperator> ladder(String name, - Supplier ingredient, MaterialColor color) { + Supplier ingredient, MapColor color) { return b -> b.initialProperties(() -> Blocks.LADDER) .properties(p -> p.color(color)) .addLayer(() -> RenderType::cutout) @@ -246,7 +245,7 @@ public class BuilderTransformers { } public static NonNullUnaryOperator> scaffold(String name, - Supplier ingredient, MaterialColor color, CTSpriteShiftEntry scaffoldShift, + Supplier ingredient, MapColor color, CTSpriteShiftEntry scaffoldShift, CTSpriteShiftEntry scaffoldInsideShift, CTSpriteShiftEntry casingShift) { return b -> b.initialProperties(() -> Blocks.SCAFFOLDING) .properties(p -> p.sound(SoundType.COPPER) diff --git a/src/main/java/com/simibubi/create/foundation/data/MetalBarsGen.java b/src/main/java/com/simibubi/create/foundation/data/MetalBarsGen.java index c6505edac..3dc5b325d 100644 --- a/src/main/java/com/simibubi/create/foundation/data/MetalBarsGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/MetalBarsGen.java @@ -23,7 +23,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.IronBarsBlock; import net.minecraft.world.level.block.SoundType; -import net.minecraft.world.level.material.MaterialColor; +import net.minecraft.world.level.material.MapColor; import net.minecraftforge.client.model.generators.ModelFile; public class MetalBarsGen { @@ -123,12 +123,12 @@ public class MetalBarsGen { } public static BlockEntry createBars(String name, boolean specialEdge, - Supplier ingredient, MaterialColor color) { + Supplier ingredient, MapColor color) { return REGISTRATE.block(name + "_bars", IronBarsBlock::new) .addLayer(() -> RenderType::cutoutMipped) .initialProperties(() -> Blocks.IRON_BARS) .properties(p -> p.sound(SoundType.COPPER) - .color(color)) + .mapColor(color)) .tag(AllBlockTags.WRENCH_PICKUP.tag) .tag(AllBlockTags.FAN_TRANSPARENT.tag) .transform(TagGen.pickaxeOnly()) diff --git a/src/main/java/com/simibubi/create/foundation/data/SharedProperties.java b/src/main/java/com/simibubi/create/foundation/data/SharedProperties.java index 256aafed4..d7cfcf46d 100644 --- a/src/main/java/com/simibubi/create/foundation/data/SharedProperties.java +++ b/src/main/java/com/simibubi/create/foundation/data/SharedProperties.java @@ -3,17 +3,9 @@ package com.simibubi.create.foundation.data; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.material.Material; -import net.minecraft.world.level.material.MaterialColor; -import net.minecraft.world.level.material.PushReaction; @MethodsReturnNonnullByDefault public class SharedProperties { - public static final Material BELT_MATERIAL = - new Material(MaterialColor.COLOR_GRAY, false, true, true, true, false, false, PushReaction.NORMAL); - - public static final Material CRUSHING_WHEEL_CONTROLLER_MATERIAL = - new Material(MaterialColor.NONE, false, false, true, true, false, false, PushReaction.BLOCK); public static Block wooden() { return Blocks.STRIPPED_SPRUCE_WOOD; diff --git a/src/main/java/com/simibubi/create/foundation/data/WindowGen.java b/src/main/java/com/simibubi/create/foundation/data/WindowGen.java index dacf2e104..1384548aa 100644 --- a/src/main/java/com/simibubi/create/foundation/data/WindowGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/WindowGen.java @@ -39,7 +39,7 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockBehaviour.Properties; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.WoodType; -import net.minecraft.world.level.material.MaterialColor; +import net.minecraft.world.level.material.MapColor; import net.minecraftforge.client.model.generators.ModelFile; import net.minecraftforge.common.Tags; @@ -67,7 +67,7 @@ public class WindowGen { public static BlockEntry customWindowBlock(String name, Supplier ingredient, Supplier ct, Supplier> renderType, boolean translucent, - Supplier color) { + Supplier color) { NonNullFunction end_texture = n -> Create.asResource(palettesDir() + name + "_end"); NonNullFunction side_texture = n -> Create.asResource(palettesDir() + n); return windowBlock(name, ingredient, ct, renderType, translucent, end_texture, side_texture, color); @@ -87,7 +87,7 @@ public class WindowGen { public static BlockEntry windowBlock(String name, Supplier ingredient, Supplier ct, Supplier> renderType, boolean translucent, NonNullFunction endTexture, NonNullFunction sideTexture, - Supplier color) { + Supplier color) { return REGISTRATE.block(name, p -> new WindowBlock(p, translucent)) .onRegister(connectedTextures(() -> new HorizontalCTBehaviour(ct.get()))) .addLayer(renderType) diff --git a/src/main/java/com/simibubi/create/foundation/events/CommonEvents.java b/src/main/java/com/simibubi/create/foundation/events/CommonEvents.java index b7f71d373..5c687cdd5 100644 --- a/src/main/java/com/simibubi/create/foundation/events/CommonEvents.java +++ b/src/main/java/com/simibubi/create/foundation/events/CommonEvents.java @@ -104,7 +104,7 @@ public class CommonEvents { @SubscribeEvent public static void onUpdateLivingEntity(LivingTickEvent event) { LivingEntity entityLiving = event.getEntity(); - Level world = entityLiving.level; + Level world = entityLiving.level(); if (world == null) return; ContraptionHandler.entitiesWhoJustDismountedGetSentToTheRightLocation(entityLiving, world); diff --git a/src/main/java/com/simibubi/create/foundation/fluid/FluidHelper.java b/src/main/java/com/simibubi/create/foundation/fluid/FluidHelper.java index 850a87893..0d4f98f47 100644 --- a/src/main/java/com/simibubi/create/foundation/fluid/FluidHelper.java +++ b/src/main/java/com/simibubi/create/foundation/fluid/FluidHelper.java @@ -31,10 +31,10 @@ import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; import net.minecraftforge.common.SoundActions; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.ForgeFlowingFluid; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; import net.minecraftforge.fluids.capability.IFluidHandlerItem; @@ -163,7 +163,7 @@ public class FluidHelper { return false; Pair emptyingResult = GenericItemEmptying.emptyItem(worldIn, heldItem, true); - LazyOptional capability = be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY); + LazyOptional capability = be.getCapability(ForgeCapabilities.FLUID_HANDLER); IFluidHandler tank = capability.orElse(null); FluidStack fluidStack = emptyingResult.getFirst(); @@ -193,7 +193,7 @@ public class FluidHelper { if (!GenericItemFilling.canItemBeFilled(world, heldItem)) return false; - LazyOptional capability = be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY); + LazyOptional capability = be.getCapability(ForgeCapabilities.FLUID_HANDLER); IFluidHandler tank = capability.orElse(null); if (tank == null) diff --git a/src/main/java/com/simibubi/create/foundation/gui/AllGuiTextures.java b/src/main/java/com/simibubi/create/foundation/gui/AllGuiTextures.java index 2333dd062..5b3622670 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AllGuiTextures.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AllGuiTextures.java @@ -7,6 +7,7 @@ import com.simibubi.create.foundation.gui.element.ScreenElement; import com.simibubi.create.foundation.utility.Color; import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -231,7 +232,7 @@ public enum AllGuiTextures implements ScreenElement { @Override public void render(PoseStack ms, int x, int y) { bind(); - GuiComponent.blit(ms, x, y, 0, startX, startY, width, height, 256, 256); + GuiGraphics.blit(ms, x, y, 0, startX, startY, width, height, 256, 256); } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java b/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java index c0b7dae9a..15695e08c 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java @@ -11,6 +11,7 @@ import com.simibubi.create.foundation.gui.element.ScreenElement; import com.simibubi.create.foundation.utility.Color; import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; @@ -186,7 +187,7 @@ public class AllIcons implements ScreenElement { @Override public void render(PoseStack matrixStack, int x, int y) { bind(); - GuiComponent.blit(matrixStack, x, y, 0, iconX, iconY, 16, 16, 256, 256); + GuiGraphics.blit(matrixStack, x, y, 0, iconX, iconY, 16, 16, 256, 256); } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/com/simibubi/create/foundation/gui/element/GuiGameElement.java b/src/main/java/com/simibubi/create/foundation/gui/element/GuiGameElement.java index 3f743247e..e4d0e8d5b 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/element/GuiGameElement.java +++ b/src/main/java/com/simibubi/create/foundation/gui/element/GuiGameElement.java @@ -23,13 +23,13 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.block.BlockRenderDispatcher; -import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.BlockPos; import net.minecraft.util.RandomSource; import net.minecraft.world.inventory.InventoryMenu; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.BaseFireBlock; @@ -284,7 +284,7 @@ public class GuiGameElement { Lighting.setupForFlatItems(); } - renderer.render(stack, ItemTransforms.TransformType.GUI, false, matrixStack, buffer, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY, bakedModel); + renderer.render(stack, ItemDisplayContext.GUI, false, matrixStack, buffer, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY, bakedModel); buffer.endBatch(); RenderSystem.enableDepthTest(); if (useDefaultLighting && flatLighting) { diff --git a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java index cb8adeed1..0a5c46f89 100644 --- a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java +++ b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java @@ -15,7 +15,6 @@ import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Nullable; import com.google.common.collect.ImmutableList; -import com.mojang.bridge.game.Language; import com.simibubi.create.foundation.item.TooltipHelper.Palette; import com.simibubi.create.foundation.utility.Components; import com.simibubi.create.foundation.utility.Lang; @@ -221,7 +220,7 @@ public record ItemDescription(ImmutableList lines, ImmutableList lines, ImmutableList { @@ -18,11 +18,11 @@ public class CustomRenderedItemModel extends BakedModelWrapper { } @Override - public BakedModel applyTransform(ItemTransforms.TransformType cameraTransformType, PoseStack mat, + public BakedModel applyTransform(ItemDisplayContext cameraItemDisplayContext, PoseStack mat, boolean leftHand) { // Super call returns originalModel, but we want to return this, else BEWLR // won't be used. - super.applyTransform(cameraTransformType, mat, leftHand); + super.applyTransform(cameraItemDisplayContext, mat, leftHand); return this; } diff --git a/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModelRenderer.java b/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModelRenderer.java index b7a46610d..95b8c6e7e 100644 --- a/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModelRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModelRenderer.java @@ -5,7 +5,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; public abstract class CustomRenderedItemModelRenderer extends BlockEntityWithoutLevelRenderer { @@ -15,7 +15,7 @@ public abstract class CustomRenderedItemModelRenderer extends BlockEntityWithout } @Override - public void renderByItem(ItemStack stack, ItemTransforms.TransformType transformType, PoseStack ms, MultiBufferSource buffer, int light, int overlay) { + public void renderByItem(ItemStack stack, ItemDisplayContext transformType, PoseStack ms, MultiBufferSource buffer, int light, int overlay) { CustomRenderedItemModel mainModel = (CustomRenderedItemModel) Minecraft.getInstance() .getItemRenderer() .getModel(stack, null, null, 0); @@ -27,7 +27,7 @@ public abstract class CustomRenderedItemModelRenderer extends BlockEntityWithout ms.popPose(); } - protected abstract void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, ItemTransforms.TransformType transformType, + protected abstract void render(ItemStack stack, CustomRenderedItemModel model, PartialItemModelRenderer renderer, ItemDisplayContext transformType, PoseStack ms, MultiBufferSource buffer, int light, int overlay); } diff --git a/src/main/java/com/simibubi/create/foundation/item/render/PartialItemModelRenderer.java b/src/main/java/com/simibubi/create/foundation/item/render/PartialItemModelRenderer.java index 59db9237b..9a07c3b00 100644 --- a/src/main/java/com/simibubi/create/foundation/item/render/PartialItemModelRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/item/render/PartialItemModelRenderer.java @@ -8,11 +8,11 @@ import com.simibubi.create.foundation.utility.Iterate; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.Direction; import net.minecraft.util.RandomSource; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraftforge.client.extensions.common.IClientItemExtensions; import net.minecraftforge.client.model.data.ModelData; @@ -24,12 +24,12 @@ public class PartialItemModelRenderer { private final RandomSource random = RandomSource.create(); private ItemStack stack; - private ItemTransforms.TransformType transformType; + private ItemDisplayContext transformType; private PoseStack ms; private MultiBufferSource buffer; private int overlay; - public static PartialItemModelRenderer of(ItemStack stack, ItemTransforms.TransformType transformType, + public static PartialItemModelRenderer of(ItemStack stack, ItemDisplayContext transformType, PoseStack ms, MultiBufferSource buffer, int overlay) { PartialItemModelRenderer instance = INSTANCE; instance.stack = stack; diff --git a/src/main/java/com/simibubi/create/foundation/mixin/client/EntityContraptionInteractionMixin.java b/src/main/java/com/simibubi/create/foundation/mixin/client/EntityContraptionInteractionMixin.java index d57e7f093..140217272 100644 --- a/src/main/java/com/simibubi/create/foundation/mixin/client/EntityContraptionInteractionMixin.java +++ b/src/main/java/com/simibubi/create/foundation/mixin/client/EntityContraptionInteractionMixin.java @@ -86,13 +86,13 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid create$getIntersectingContraptions().forEach(cEntity -> { Vec3 localPos = ContraptionCollider.worldToLocalPos(worldPos, cEntity); - BlockPos blockPos = new BlockPos(localPos); + BlockPos blockPos = BlockPos.containing(localPos); Contraption contraption = cEntity.getContraption(); StructureTemplate.StructureBlockInfo info = contraption.getBlocks() .get(blockPos); if (info != null) { - BlockState blockstate = info.state; + BlockState blockstate = info.state(); action.accept(contraption, blockstate, blockPos); } }); @@ -120,7 +120,7 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid if (!level.isClientSide) return; Entity self = (Entity) (Object) this; - if (self.isOnGround()) + if (self.onGround()) return; if (self.isPassenger()) return; @@ -129,7 +129,7 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid boolean onAtLeastOneContraption = create$getIntersectionContraptionsStream().anyMatch(cEntity -> { Vec3 localPos = ContraptionCollider.worldToLocalPos(worldPos, cEntity); - BlockPos blockPos = new BlockPos(localPos); + BlockPos blockPos = BlockPos.containing(localPos); Contraption contraption = cEntity.getContraption(); StructureTemplate.StructureBlockInfo info = contraption.getBlocks() .get(blockPos); @@ -153,7 +153,7 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid private void create$onSpawnSprintParticle(CallbackInfo ci) { Entity self = (Entity) (Object) this; Vec3 worldPos = position.add(0, -0.2, 0); - BlockPos particlePos = new BlockPos(worldPos); // pos where particles are spawned + BlockPos particlePos = BlockPos.containing(worldPos); // pos where particles are spawned forCollision(worldPos, (contraption, state, pos) -> { if (!state.addRunningEffects(level, pos, self) diff --git a/src/main/java/com/simibubi/create/foundation/networking/BlockEntityConfigurationPacket.java b/src/main/java/com/simibubi/create/foundation/networking/BlockEntityConfigurationPacket.java index 3c3ce4191..35d80758f 100644 --- a/src/main/java/com/simibubi/create/foundation/networking/BlockEntityConfigurationPacket.java +++ b/src/main/java/com/simibubi/create/foundation/networking/BlockEntityConfigurationPacket.java @@ -35,7 +35,7 @@ public abstract class BlockEntityConfigurationPacket> implements IPlacementH for (Direction dir : directions) { int range = AllConfigs.server().equipment.placementAssistRange.get(); if (player != null) { - AttributeInstance reach = player.getAttribute(ForgeMod.REACH_DISTANCE.get()); + AttributeInstance reach = player.getAttribute(ForgeMod.BLOCK_REACH.get()); if (reach != null && reach.hasModifier(ExtendoGripItem.singleRangeAttributeModifier)) range += 4; } @@ -72,7 +72,7 @@ public abstract class PoleHelper> implements IPlacementH BlockPos newPos = pos.relative(dir, poles + 1); BlockState newState = world.getBlockState(newPos); - if (newState.getMaterial().isReplaceable()) + if (newState.canBeReplaced()) return PlacementOffset.success(newPos, bState -> bState.setValue(property, state.getValue(property))); } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderChapter.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderChapter.java index d09c382b4..b28ddd65a 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderChapter.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderChapter.java @@ -6,7 +6,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.foundation.gui.element.ScreenElement; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.resources.ResourceLocation; public class PonderChapter implements ScreenElement { @@ -39,7 +39,7 @@ public class PonderChapter implements ScreenElement { RenderSystem.setShaderTexture(0, icon); ms.scale(0.25f, 0.25f, 1); //x and y offset, blit z offset, tex x and y, tex width and height, entire tex sheet width and height - GuiComponent.blit(ms, x, y, 0, 0, 0, 64, 64, 64, 64); + GuiGraphics.blit(ms, x, y, 0, 0, 0, 64, 64, 64, 64); ms.popPose(); } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderTag.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderTag.java index c02e0277c..760ec900b 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderTag.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderTag.java @@ -6,7 +6,7 @@ import com.simibubi.create.Create; import com.simibubi.create.foundation.gui.element.GuiGameElement; import com.simibubi.create.foundation.gui.element.ScreenElement; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ItemLike; @@ -88,7 +88,7 @@ public class PonderTag implements ScreenElement { if (icon != null) { RenderSystem.setShaderTexture(0, icon); ms.scale(0.25f, 0.25f, 1); - GuiComponent.blit(ms, 0, 0, 0, 0, 0, 64, 64, 64, 64); + GuiGraphics.blit(ms, 0, 0, 0, 0, 0, 64, 64, 64, 64); } else if (!itemIcon.isEmpty()) { ms.translate(-2, -2, 0); ms.scale(1.25f, 1.25f, 1.25f); diff --git a/src/main/java/com/simibubi/create/foundation/recipe/RecipeApplier.java b/src/main/java/com/simibubi/create/foundation/recipe/RecipeApplier.java index 0745d212f..21adf4519 100644 --- a/src/main/java/com/simibubi/create/foundation/recipe/RecipeApplier.java +++ b/src/main/java/com/simibubi/create/foundation/recipe/RecipeApplier.java @@ -24,9 +24,9 @@ public class RecipeApplier { } entity.setItem(stacks.remove(0)); for (ItemStack additional : stacks) { - ItemEntity entityIn = new ItemEntity(entity.level, entity.getX(), entity.getY(), entity.getZ(), additional); + ItemEntity entityIn = new ItemEntity(entity.level(), entity.getX(), entity.getY(), entity.getZ(), additional); entityIn.setDeltaMovement(entity.getDeltaMovement()); - entity.level.addFreshEntity(entityIn); + entity.level().addFreshEntity(entityIn); } } diff --git a/src/main/java/com/simibubi/create/foundation/render/BlockEntityRenderHelper.java b/src/main/java/com/simibubi/create/foundation/render/BlockEntityRenderHelper.java index 7fc1132a8..5185e7db1 100644 --- a/src/main/java/com/simibubi/create/foundation/render/BlockEntityRenderHelper.java +++ b/src/main/java/com/simibubi/create/foundation/render/BlockEntityRenderHelper.java @@ -96,7 +96,7 @@ public class BlockEntityRenderHelper { if (lightTransform != null) { Vector4f lightVec = new Vector4f(contraptionPos.getX() + .5f, contraptionPos.getY() + .5f, contraptionPos.getZ() + .5f, 1); lightVec.mul(lightTransform); - return new BlockPos(lightVec.x(), lightVec.y(), lightVec.z()); + return BlockPos.containing(lightVec.x(), lightVec.y(), lightVec.z()); } else { return contraptionPos; } diff --git a/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java b/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java index db1e873f2..06f684717 100644 --- a/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java +++ b/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java @@ -450,7 +450,7 @@ public class SuperByteBuffer implements Transform, TStack LevelRenderer.getLightColor(world, pos)); } 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 b87224f71..efb7e5df6 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java @@ -191,9 +191,8 @@ public class BlockHelper { .ultraWarm()) return; - Material material = world.getBlockState(pos.below()) - .getMaterial(); - if (material.blocksMotion() || material.isLiquid()) + BlockState blockstate = world.getBlockState(pos.below()); + if (blockstate.blocksMotion() || blockstate.liquid()) world.setBlockAndUpdate(pos, Blocks.WATER.defaultBlockState()); return; } diff --git a/src/main/java/com/simibubi/create/infrastructure/command/CloneCommand.java b/src/main/java/com/simibubi/create/infrastructure/command/CloneCommand.java index 81832597f..4cf7a7c22 100644 --- a/src/main/java/com/simibubi/create/infrastructure/command/CloneCommand.java +++ b/src/main/java/com/simibubi/create/infrastructure/command/CloneCommand.java @@ -130,33 +130,33 @@ public class CloneCommand { List reverse = Lists.reverse(allBlocks); for (StructureTemplate.StructureBlockInfo info : reverse) { - BlockEntity be = world.getBlockEntity(info.pos); + BlockEntity be = world.getBlockEntity(info.pos()); Clearable.tryClear(be); - world.setBlock(info.pos, Blocks.BARRIER.defaultBlockState(), 2); + world.setBlock(info.pos(), Blocks.BARRIER.defaultBlockState(), 2); } for (StructureTemplate.StructureBlockInfo info : allBlocks) { - if (world.setBlock(info.pos, info.state, 2)) + if (world.setBlock(info.pos(), info.state(), 2)) blockPastes++; } for (StructureTemplate.StructureBlockInfo info : beBlocks) { - BlockEntity be = world.getBlockEntity(info.pos); - if (be != null && info.nbt != null) { - info.nbt.putInt("x", info.pos.getX()); - info.nbt.putInt("y", info.pos.getY()); - info.nbt.putInt("z", info.pos.getZ()); - be.load(info.nbt); + BlockEntity be = world.getBlockEntity(info.pos()); + if (be != null && info.nbt() != null) { + info.nbt().putInt("x", info.pos().getX()); + info.nbt().putInt("y", info.pos().getY()); + info.nbt().putInt("z", info.pos().getZ()); + be.load(info.nbt()); be.setChanged(); } // idk why the state is set twice for a be, but its done like this in the // original clone command - world.setBlock(info.pos, info.state, 2); + world.setBlock(info.pos(), info.state(), 2); } for (StructureTemplate.StructureBlockInfo info : reverse) { - world.blockUpdated(info.pos, info.state.getBlock()); + world.blockUpdated(info.pos(), info.state().getBlock()); } world.getBlockTicks() diff --git a/src/main/java/com/simibubi/create/infrastructure/command/HighlightCommand.java b/src/main/java/com/simibubi/create/infrastructure/command/HighlightCommand.java index abf17563c..9883032fb 100644 --- a/src/main/java/com/simibubi/create/infrastructure/command/HighlightCommand.java +++ b/src/main/java/com/simibubi/create/infrastructure/command/HighlightCommand.java @@ -65,12 +65,12 @@ public class HighlightCommand { } private static int highlightAssemblyExceptionFor(ServerPlayer player, CommandSourceStack source) { - double distance = player.getAttribute(ForgeMod.REACH_DISTANCE.get()) + double distance = player.getAttribute(ForgeMod.BLOCK_REACH.get()) .getValue(); Vec3 start = player.getEyePosition(1); Vec3 look = player.getViewVector(1); Vec3 end = start.add(look.x * distance, look.y * distance, look.z * distance); - Level world = player.level; + Level world = player.level(); BlockHitResult ray = world.clip( new ClipContext(start, end, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player)); diff --git a/src/main/java/com/simibubi/create/infrastructure/gametest/CreateGameTestHelper.java b/src/main/java/com/simibubi/create/infrastructure/gametest/CreateGameTestHelper.java index dc0447b7a..426cf887d 100644 --- a/src/main/java/com/simibubi/create/infrastructure/gametest/CreateGameTestHelper.java +++ b/src/main/java/com/simibubi/create/infrastructure/gametest/CreateGameTestHelper.java @@ -40,11 +40,10 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.phys.Vec3; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.registries.ForgeRegistries; @@ -213,7 +212,7 @@ public class CreateGameTestHelper extends GameTestHelper { BlockEntity be = getBlockEntity(pos); if (be == null) fail("BlockEntity not present"); - Optional handler = be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY).resolve(); + Optional handler = be.getCapability(ForgeCapabilities.FLUID_HANDLER).resolve(); if (handler.isEmpty()) fail("handler not present"); return handler.get(); @@ -281,7 +280,7 @@ public class CreateGameTestHelper extends GameTestHelper { BlockEntity be = getBlockEntity(pos); if (be == null) fail("BlockEntity not present"); - Optional handler = be.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).resolve(); + Optional handler = be.getCapability(ForgeCapabilities.ITEM_HANDLER).resolve(); if (handler.isEmpty()) fail("handler not present"); return handler.get(); diff --git a/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/DrainScenes.java b/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/DrainScenes.java index 5a6c313ad..db72d2e72 100644 --- a/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/DrainScenes.java +++ b/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/DrainScenes.java @@ -15,8 +15,8 @@ import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.material.Fluids; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; public class DrainScenes { @@ -57,7 +57,7 @@ public class DrainScenes { scene.world.modifyBlockEntity(drainPos, ItemDrainBlockEntity.class, be -> { be.getBehaviour(SmartFluidTankBehaviour.TYPE) .allowInsertion(); - be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + be.getCapability(ForgeCapabilities.FLUID_HANDLER) .ifPresent(fh -> fh.fill(new FluidStack(Fluids.LAVA, 1000), FluidAction.EXECUTE)); }); scene.idle(10); @@ -70,7 +70,7 @@ public class DrainScenes { scene.idle(60); scene.world.modifyBlockEntity(drainPos, ItemDrainBlockEntity.class, - be -> be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + be -> be.getCapability(ForgeCapabilities.FLUID_HANDLER) .ifPresent(fh -> fh.drain(500, FluidAction.EXECUTE))); scene.world.moveSection(drainLink, util.vector.of(1, 0, 0), 7); diff --git a/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/FluidMovementActorScenes.java b/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/FluidMovementActorScenes.java index e28e8bb99..157e6804c 100644 --- a/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/FluidMovementActorScenes.java +++ b/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/FluidMovementActorScenes.java @@ -18,8 +18,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; @@ -43,7 +43,7 @@ public class FluidMovementActorScenes { BlockPos ct1 = util.grid.at(5, 3, 2); BlockPos ct2 = util.grid.at(6, 3, 2); BlockPos st = util.grid.at(0, 1, 5); - Capability fhc = CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY; + Capability fhc = ForgeCapabilities.FLUID_HANDLER; Class type = FluidTankBlockEntity.class; ItemStack bucket = AllFluids.CHOCOLATE.get() .getFluidType() diff --git a/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/FluidTankScenes.java b/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/FluidTankScenes.java index ea36e91f0..602e2a2ca 100644 --- a/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/FluidTankScenes.java +++ b/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/FluidTankScenes.java @@ -30,8 +30,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.Vec3; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; public class FluidTankScenes { @@ -168,7 +168,7 @@ public class FluidTankScenes { .pointAt(util.vector.blockSurface(util.grid.at(2, 2, 2), Direction.WEST)); scene.idle(80); scene.world.modifyBlockEntity(util.grid.at(4, 3, 0), SpoutBlockEntity.class, - be -> be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + be -> be.getCapability(ForgeCapabilities.FLUID_HANDLER) .ifPresent(ifh -> ifh.fill(content, FluidAction.EXECUTE))); scene.world.moveSection(tankLink, util.vector.of(0, 0, 1), 7); diff --git a/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/HosePulleyScenes.java b/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/HosePulleyScenes.java index 963395f7e..99a388b94 100644 --- a/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/HosePulleyScenes.java +++ b/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/HosePulleyScenes.java @@ -21,6 +21,7 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; @@ -123,7 +124,7 @@ public class HosePulleyScenes { } scene.world.modifyBlockEntity(util.grid.at(1, 5, 1), HosePulleyBlockEntity.class, be -> be - .getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + .getCapability(ForgeCapabilities.FLUID_HANDLER) .ifPresent( ifh -> ((HosePulleyFluidHandler) ifh).fill(new FluidStack(Fluids.WATER, 100), FluidAction.EXECUTE))); @@ -225,7 +226,7 @@ public class HosePulleyScenes { scene.world.showSectionAndMerge(cogs, Direction.NORTH, hoselink); scene.world.showSectionAndMerge(pipes, Direction.WEST, hoselink); scene.world.modifyBlockEntity(util.grid.at(1, 6, 1), HosePulleyBlockEntity.class, - be -> be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + be -> be.getCapability(ForgeCapabilities.FLUID_HANDLER) .ifPresent( fh -> ((HosePulleyFluidHandler) fh).fill(new FluidStack(Fluids.WATER, 100), FluidAction.EXECUTE))); scene.world.propagatePipeChange(util.grid.at(3, 2, 1)); @@ -339,7 +340,7 @@ public class HosePulleyScenes { scene.idle(40); scene.world.modifyBlockEntity(util.grid.at(1, 3, 2), HosePulleyBlockEntity.class, - be -> be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + be -> be.getCapability(ForgeCapabilities.FLUID_HANDLER) .ifPresent( fh -> ((HosePulleyFluidHandler) fh).fill(new FluidStack(Fluids.WATER, 1000), FluidAction.EXECUTE))); scene.world.setKineticSpeed(hose, 0); diff --git a/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/PipeScenes.java b/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/PipeScenes.java index 0d5f95d40..95eca7d4c 100644 --- a/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/PipeScenes.java +++ b/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/fluid/PipeScenes.java @@ -36,8 +36,8 @@ import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.ForgeMod; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; public class PipeScenes { @@ -489,7 +489,7 @@ public class PipeScenes { BlockPos smartPos = util.grid.at(3, 1, 1); scene.world.modifyBlockEntity(basinPos, BasinBlockEntity.class, - be -> be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + be -> be.getCapability(ForgeCapabilities.FLUID_HANDLER) .ifPresent(fh -> fh.fill(new FluidStack(ForgeMod.MILK.get(), 1000), FluidAction.EXECUTE))); scene.world.setBlock(util.grid.at(3, 1, 3), AllBlocks.FLUID_PIPE.get() @@ -571,7 +571,7 @@ public class PipeScenes { } scene.idle(15); scene.world.modifyBlockEntity(basinPos, BasinBlockEntity.class, - be -> be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + be -> be.getCapability(ForgeCapabilities.FLUID_HANDLER) .ifPresent(fh -> fh.fill(chocolate, FluidAction.EXECUTE))); scene.idle(10);