From 061b85d51537f1f121a3365c7cb63fb122b37ffa Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Tue, 7 Dec 2021 18:24:57 +0100 Subject: [PATCH] New version who dis? - Port to 1.18 - ChunkUtil discontinued - SmartTileEntities write to metadata - Features generate from -64 up - World Wrappers weren't convoluted enough - Haunted bell considers >0 safe - Missing GuiUtils methods continued in RemovedGuiUtils --- build.gradle | 7 +- gradle.properties | 10 +- .../java/com/simibubi/create/AllBlocks.java | 2 +- .../simibubi/create/AllContainerTypes.java | 27 +- .../java/com/simibubi/create/AllItems.java | 2 +- .../java/com/simibubi/create/AllKeys.java | 2 +- .../java/com/simibubi/create/AllTags.java | 2 +- .../com/simibubi/create/AllTileEntities.java | 164 +++++----- src/main/java/com/simibubi/create/Create.java | 8 +- .../components/actors/SeatEntity.java | 4 +- .../crusher/CrushingWheelControllerBlock.java | 3 +- .../components/deployer/DeployerHandler.java | 2 +- .../deployer/DeployerMovementBehaviour.java | 2 +- .../mixer/MechanicalMixerBlock.java | 4 +- .../press/MechanicalPressBlock.java | 4 +- .../AbstractContraptionEntity.java | 6 +- .../structureMovement/Contraption.java | 22 +- .../ContraptionCollider.java | 54 ++-- .../ContraptionDisassemblyPacket.java | 2 +- .../ContraptionStallPacket.java | 2 +- .../MountedFluidStorage.java | 2 +- .../structureMovement/MountedStorage.java | 4 +- .../structureMovement/bearing/SailBlock.java | 6 +- .../gantry/GantryContraptionEntity.java | 2 +- .../gantry/GantryContraptionUpdatePacket.java | 2 +- .../glue/GlueEffectPacket.java | 2 +- .../glue/SuperGlueEntity.java | 6 +- .../glue/SuperGlueHandler.java | 2 +- .../mounted/CartAssemblerBlock.java | 3 +- .../piston/MechanicalPistonBlock.java | 3 +- .../piston/MechanicalPistonHeadBlock.java | 7 +- .../piston/PistonExtensionPoleBlock.java | 5 +- .../structureMovement/pulley/PulleyBlock.java | 7 +- .../sync/ClientMotionPacket.java | 4 +- .../sync/ContraptionFluidPacket.java | 2 +- .../sync/ContraptionInteractionPacket.java | 2 +- .../sync/ContraptionSeatMappingPacket.java | 2 +- .../sync/LimbSwingUpdatePacket.java | 2 +- .../train/CouplingCreationPacket.java | 2 +- .../train/capability/MinecartController.java | 2 +- .../MinecartControllerUpdatePacket.java | 2 +- .../contraptions/fluids/OpenEndedPipe.java | 6 +- .../contraptions/fluids/PumpBlock.java | 14 +- .../fluids/actors/FluidFillingBehaviour.java | 23 +- .../actors/FluidManipulationBehaviour.java | 5 +- .../fluids/actors/FluidSplashPacket.java | 2 +- .../fluids/particle/FluidParticleData.java | 21 +- .../fluids/pipes/AxisPipeBlock.java | 10 +- .../fluids/pipes/EncasedPipeBlock.java | 10 +- .../fluids/pipes/FluidPipeBlock.java | 14 +- .../fluids/pipes/FluidValveBlock.java | 8 +- .../fluids/pipes/SmartFluidPipeBlock.java | 8 +- .../goggles/GoggleOverlayRenderer.java | 4 +- .../contraptions/processing/BasinBlock.java | 3 +- .../burner/BlazeBurnerBlockItem.java | 25 +- .../burner/LitBlazeBurnerBlock.java | 2 +- .../sequencer/SequencedGearshiftBlock.java | 3 +- .../contraptions/relays/belt/BeltBlock.java | 10 +- .../relays/elementary/AbstractShaftBlock.java | 6 +- .../relays/encased/EncasedCogwheelBlock.java | 4 +- .../relays/encased/EncasedShaftBlock.java | 4 +- .../relays/encased/GearshiftBlock.java | 4 +- .../relays/gearbox/GearboxBlock.java | 4 +- .../armor/CopperBacktankBlock.java | 6 +- .../curiosities/bell/HauntedBellPulser.java | 2 +- .../curiosities/bell/SoulPulseEffect.java | 16 +- .../bell/SoulPulseEffectPacket.java | 2 +- .../symmetry/ConfigureSymmetryWandPacket.java | 2 +- .../symmetry/SymmetryEffectPacket.java | 2 +- .../curiosities/symmetry/SymmetryHandler.java | 6 +- .../symmetry/SymmetryWandItem.java | 2 +- .../curiosities/toolbox/ToolboxBlock.java | 5 +- .../toolbox/ToolboxDisposeAllPacket.java | 2 +- .../toolbox/ToolboxEquipPacket.java | 2 +- .../curiosities/toolbox/ToolboxHandler.java | 2 +- .../toolbox/ToolboxHandlerClient.java | 2 +- .../BlueprintAssignCompleteRecipePacket.java | 2 +- .../curiosities/tools/BlueprintEntity.java | 8 +- .../curiosities/tools/BlueprintItem.java | 4 +- .../tools/ExtendoGripInteractionPacket.java | 2 +- .../tools/ExtendoGripRenderHandler.java | 14 +- .../weapons/PotatoProjectileEntity.java | 4 +- .../weapons/PotatoProjectileTypeManager.java | 4 +- .../zapper/ConfigureZapperPacket.java | 2 +- .../curiosities/zapper/ShootGadgetPacket.java | 2 +- .../zapper/ShootableGadgetItemMethods.java | 2 +- .../zapper/ShootableGadgetRenderHandler.java | 8 +- .../zapper/ZapperInteractionHandler.java | 2 +- .../block/chute/SmartChuteBlock.java | 3 +- .../block/depot/EjectorElytraPacket.java | 2 +- .../block/depot/EjectorPlacementPacket.java | 2 +- .../block/diodes/PoweredLatchBlock.java | 5 +- .../block/funnel/AbstractFunnelBlock.java | 3 +- .../block/funnel/BeltFunnelBlock.java | 7 +- .../logistics/block/funnel/FunnelBlock.java | 4 +- .../mechanicalArm/ArmPlacementPacket.java | 2 +- .../redstone/ContactMovementBehaviour.java | 4 +- .../redstone/ContentObserverTileEntity.java | 3 +- .../block/redstone/NixieTubeBlock.java | 9 +- .../block/redstone/RedstoneLinkBlock.java | 3 +- .../redstone/StockpileSwitchTileEntity.java | 9 +- .../item/LecternControllerBlock.java | 4 +- .../logistics/item/LinkedControllerItem.java | 2 +- .../item/LinkedControllerPacketBase.java | 2 +- .../item/filter/AbstractFilterScreen.java | 2 +- .../logistics/item/filter/FilterItem.java | 2 +- .../item/filter/FilterScreenPacket.java | 2 +- .../content/palettes/AllPaletteBlocks.java | 2 +- .../content/schematics/SchematicWorld.java | 37 ++- .../schematics/block/SchematicTableBlock.java | 2 +- .../schematics/block/SchematicannonBlock.java | 2 +- .../block/SchematicannonScreen.java | 2 +- .../block/SchematicannonTileEntity.java | 2 +- .../schematics/client/SchematicRenderer.java | 4 +- .../packet/ConfigureSchematicannonPacket.java | 2 +- .../packet/InstantSchematicPacket.java | 2 +- .../packet/SchematicPlacePacket.java | 4 +- .../packet/SchematicSyncPacket.java | 2 +- .../packet/SchematicUploadPacket.java | 2 +- .../simibubi/create/events/ClientEvents.java | 12 +- .../simibubi/create/events/CommonEvents.java | 4 +- .../simibubi/create/events/InputEvents.java | 2 +- .../foundation/command/AllCommands.java | 1 - .../create/foundation/command/ChunkUtil.java | 111 ------- .../foundation/command/ChunkUtilCommand.java | 88 ------ .../foundation/command/CloneCommand.java | 4 +- .../foundation/command/ConfigCommand.java | 2 +- .../command/FabulousWarningCommand.java | 2 +- .../command/FixLightingCommand.java | 2 +- .../foundation/command/HighlightCommand.java | 2 +- .../foundation/command/HighlightPacket.java | 2 +- .../command/OverlayConfigCommand.java | 2 +- .../foundation/command/PonderCommand.java | 2 +- .../command/SConfigureConfigPacket.java | 2 +- .../command/ToggleDebugCommand.java | 2 +- .../config/ui/CConfigureConfigPacket.java | 2 +- .../foundation/config/ui/ConfigScreen.java | 3 +- .../config/ui/ConfigScreenList.java | 5 +- .../config/ui/OpenCreateMenuButton.java | 24 +- .../foundation/data/CreateRegistrate.java | 21 +- .../data/CreateTileEntityBuilder.java | 6 +- .../foundation/gui/AbstractSimiScreen.java | 2 +- .../foundation/gui/RemovedGuiUtils.java | 202 ++++++++++++ .../create/foundation/gui/UIRenderHelper.java | 2 +- .../AbstractSimiContainerScreen.java | 2 +- .../gui/container/ClearContainerPacket.java | 2 +- .../gui/container/GhostItemSubmitPacket.java | 2 +- .../gui/widget/AbstractSimiWidget.java | 2 +- .../foundation/gui/widget/IconButton.java | 2 +- .../item/render/CustomRenderedItemModel.java | 6 +- .../foundation/networking/AllPackets.java | 16 +- .../networking/ISyncPersistentData.java | 4 +- .../networking/LeftClickPacket.java | 4 +- .../networking/SimplePacketBase.java | 2 +- .../TileEntityConfigurationPacket.java | 2 +- .../networking/TileEntityDataPacket.java | 2 +- .../create/foundation/ponder/PonderScene.java | 2 +- .../ponder/PonderTooltipHandler.java | 2 +- .../create/foundation/ponder/PonderWorld.java | 6 +- .../ponder/element/TextWindowElement.java | 2 +- .../ponder/element/WorldSectionElement.java | 4 +- .../TileEntityDataInstruction.java | 2 +- .../ponder/ui/NavigatableSimiScreen.java | 2 +- .../ponder/ui/PonderProgressBar.java | 2 +- .../create/foundation/ponder/ui/PonderUI.java | 16 +- .../tileEntity/SmartTileEntity.java | 9 +- .../tileEntity/SyncedTileEntity.java | 10 +- .../foundation/utility/BlockHelper.java | 8 +- .../foundation/utility/ModelSwapper.java | 4 +- .../utility/ServerSpeedProvider.java | 4 +- .../PlacementSimulationWorld.java | 2 +- .../worldWrappers/WrappedChunkProvider.java | 106 ++++--- .../worldWrappers/WrappedClientWorld.java | 14 +- .../worldWrappers/WrappedServerWorld.java | 17 +- .../utility/worldWrappers/WrappedWorld.java | 10 +- .../worldWrappers/chunk/EmptierChunk.java | 73 +++-- .../worldWrappers/chunk/WrappedChunk.java | 287 ++++++++---------- .../chunk/WrappedChunkSection.java | 47 +-- .../foundation/worldgen/AllWorldFeatures.java | 34 ++- .../worldgen/ConfigDrivenDecorator.java | 41 ++- .../worldgen/ConfigDrivenFeatureEntry.java | 29 +- .../ConfigDrivenOreConfiguration.java | 3 +- .../foundation/worldgen/LayerPattern.java | 7 +- .../worldgen/LayeredOreFeature.java | 3 +- .../worldgen/VanillaStyleOreFeature.java | 3 +- .../resources/META-INF/accesstransformer.cfg | 10 +- src/main/resources/META-INF/mods.toml | 8 +- .../resources/opt_in/Copper Legacy Pack.zip | Bin 6805 -> 6804 bytes src/main/resources/pack.mcmeta | 2 +- 189 files changed, 1051 insertions(+), 1097 deletions(-) delete mode 100644 src/main/java/com/simibubi/create/foundation/command/ChunkUtil.java delete mode 100644 src/main/java/com/simibubi/create/foundation/command/ChunkUtilCommand.java create mode 100644 src/main/java/com/simibubi/create/foundation/gui/RemovedGuiUtils.java diff --git a/build.gradle b/build.gradle index 7e506d806..e3ebfe5c4 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' apply plugin: 'org.spongepowered.mixin' -apply plugin: 'org.parchmentmc.librarian.forgegradle' +// apply plugin: 'org.parchmentmc.librarian.forgegradle' boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equals('false'); // jozu: I use a gradle workspace with both projects. @@ -35,11 +35,12 @@ version = "mc${minecraft_version}_v${mod_version}" + (dev && !buildnumber.equals group = 'com.simibubi.create' archivesBaseName = 'create' -java.toolchain.languageVersion = JavaLanguageVersion.of(16) +java.toolchain.languageVersion = JavaLanguageVersion.of(17) println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) minecraft { - mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}" + // mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}" + mappings channel: 'official', version: "${minecraft_version}" accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') runs { diff --git a/gradle.properties b/gradle.properties index 957927e15..f322fbf90 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,8 +5,8 @@ org.gradle.daemon = false # mod version info mod_version = 0.4 -minecraft_version = 1.17.1 -forge_version = 37.1.0 +minecraft_version = 1.18 +forge_version = 38.0.15 # build dependency versions forgegradle_version = 5.1.+ @@ -18,9 +18,9 @@ cursegradle_version = 1.4.0 parchment_version = 2021.10.31 # dependency versions -registrate_version = MC1.17.1-1.0.14 -flywheel_version = 1.17-0.3.0.21 -jei_version = 8.2.0.36 +registrate_version = MC1.18-1.0.21 +flywheel_version = 1.18-0.3.0.1 +jei_version = 9.0.0.40 # curseforge information projectId = 328085 diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 5259b4c70..7e552b7c9 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -217,7 +217,7 @@ import net.minecraftforge.common.Tags; public class AllBlocks { private static final CreateRegistrate REGISTRATE = Create.registrate() - .itemGroup(() -> Create.BASE_CREATIVE_TAB); + .creativeModeTab(() -> Create.BASE_CREATIVE_TAB); // Schematics diff --git a/src/main/java/com/simibubi/create/AllContainerTypes.java b/src/main/java/com/simibubi/create/AllContainerTypes.java index 4c71f33bc..47a866b56 100644 --- a/src/main/java/com/simibubi/create/AllContainerTypes.java +++ b/src/main/java/com/simibubi/create/AllContainerTypes.java @@ -14,9 +14,9 @@ import com.simibubi.create.content.schematics.block.SchematicTableContainer; import com.simibubi.create.content.schematics.block.SchematicTableScreen; import com.simibubi.create.content.schematics.block.SchematicannonContainer; import com.simibubi.create.content.schematics.block.SchematicannonScreen; -import com.tterrag.registrate.builders.ContainerBuilder.ForgeContainerFactory; -import com.tterrag.registrate.builders.ContainerBuilder.ScreenFactory; -import com.tterrag.registrate.util.entry.ContainerEntry; +import com.tterrag.registrate.builders.MenuBuilder.ForgeMenuFactory; +import com.tterrag.registrate.builders.MenuBuilder.ScreenFactory; +import com.tterrag.registrate.util.entry.MenuEntry; import com.tterrag.registrate.util.nullness.NonNullSupplier; import net.minecraft.client.gui.screens.Screen; @@ -25,29 +25,32 @@ import net.minecraft.world.inventory.AbstractContainerMenu; public class AllContainerTypes { - public static final ContainerEntry SCHEMATIC_TABLE = + public static final MenuEntry SCHEMATIC_TABLE = register("schematic_table", SchematicTableContainer::new, () -> SchematicTableScreen::new); - public static final ContainerEntry SCHEMATICANNON = + public static final MenuEntry SCHEMATICANNON = register("schematicannon", SchematicannonContainer::new, () -> SchematicannonScreen::new); - public static final ContainerEntry FILTER = + public static final MenuEntry FILTER = register("filter", FilterContainer::new, () -> FilterScreen::new); - public static final ContainerEntry ATTRIBUTE_FILTER = + public static final MenuEntry ATTRIBUTE_FILTER = register("attribute_filter", AttributeFilterContainer::new, () -> AttributeFilterScreen::new); - public static final ContainerEntry CRAFTING_BLUEPRINT = + public static final MenuEntry CRAFTING_BLUEPRINT = register("crafting_blueprint", BlueprintContainer::new, () -> BlueprintScreen::new); - public static final ContainerEntry LINKED_CONTROLLER = + public static final MenuEntry LINKED_CONTROLLER = register("linked_controller", LinkedControllerContainer::new, () -> LinkedControllerScreen::new); - public static final ContainerEntry TOOLBOX = + public static final MenuEntry TOOLBOX = register("toolbox", ToolboxContainer::new, () -> ToolboxScreen::new); - private static > ContainerEntry register(String name, ForgeContainerFactory factory, NonNullSupplier> screenFactory) { - return Create.registrate().container(name, factory, screenFactory).register(); + private static > MenuEntry register( + String name, ForgeMenuFactory factory, NonNullSupplier> screenFactory) { + return Create.registrate() + .menu(name, factory, screenFactory) + .register(); } public static void register() {} diff --git a/src/main/java/com/simibubi/create/AllItems.java b/src/main/java/com/simibubi/create/AllItems.java index cf1335d1b..b8a592f2e 100644 --- a/src/main/java/com/simibubi/create/AllItems.java +++ b/src/main/java/com/simibubi/create/AllItems.java @@ -62,7 +62,7 @@ import net.minecraftforge.common.Tags; public class AllItems { private static final CreateRegistrate REGISTRATE = Create.registrate() - .itemGroup(() -> Create.BASE_CREATIVE_TAB); + .creativeModeTab(() -> Create.BASE_CREATIVE_TAB); // Schematics diff --git a/src/main/java/com/simibubi/create/AllKeys.java b/src/main/java/com/simibubi/create/AllKeys.java index c3883e9ca..58ad25fdf 100644 --- a/src/main/java/com/simibubi/create/AllKeys.java +++ b/src/main/java/com/simibubi/create/AllKeys.java @@ -5,7 +5,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.KeyMapping; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; -import net.minecraftforge.fmlclient.registry.ClientRegistry; +import net.minecraftforge.client.ClientRegistry; public enum AllKeys { diff --git a/src/main/java/com/simibubi/create/AllTags.java b/src/main/java/com/simibubi/create/AllTags.java index b4ea94935..3b3175e93 100644 --- a/src/main/java/com/simibubi/create/AllTags.java +++ b/src/main/java/com/simibubi/create/AllTags.java @@ -31,7 +31,7 @@ import net.minecraftforge.common.Tags; public class AllTags { private static final CreateRegistrate REGISTRATE = Create.registrate() - .itemGroup(() -> Create.BASE_CREATIVE_TAB); + .creativeModeTab(() -> Create.BASE_CREATIVE_TAB); public static Tag.Named tag(Function> wrapperFactory, String namespace, String path) { diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index 3102668dc..59628f4a2 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -171,108 +171,108 @@ import com.simibubi.create.content.schematics.block.SchematicannonInstance; import com.simibubi.create.content.schematics.block.SchematicannonRenderer; import com.simibubi.create.content.schematics.block.SchematicannonTileEntity; import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer; -import com.tterrag.registrate.util.entry.TileEntityEntry; +import com.tterrag.registrate.util.entry.BlockEntityEntry; public class AllTileEntities { // Schematics - public static final TileEntityEntry SCHEMATICANNON = Create.registrate() + public static final BlockEntityEntry SCHEMATICANNON = Create.registrate() .tileEntity("schematicannon", SchematicannonTileEntity::new) .instance(() -> SchematicannonInstance::new) .validBlocks(AllBlocks.SCHEMATICANNON) .renderer(() -> SchematicannonRenderer::new) .register(); - public static final TileEntityEntry SCHEMATIC_TABLE = Create.registrate() + public static final BlockEntityEntry SCHEMATIC_TABLE = Create.registrate() .tileEntity("schematic_table", SchematicTableTileEntity::new) .validBlocks(AllBlocks.SCHEMATIC_TABLE) .register(); // Kinetics - public static final TileEntityEntry BRACKETED_KINETIC = Create.registrate() + public static final BlockEntityEntry BRACKETED_KINETIC = Create.registrate() .tileEntity("simple_kinetic", BracketedKineticTileEntity::new) .instance(() -> BracketedKineticTileInstance::new) .validBlocks(AllBlocks.SHAFT, AllBlocks.COGWHEEL, AllBlocks.LARGE_COGWHEEL) .renderer(() -> BracketedKineticTileRenderer::new) .register(); - public static final TileEntityEntry MOTOR = Create.registrate() + public static final BlockEntityEntry MOTOR = Create.registrate() .tileEntity("motor", CreativeMotorTileEntity::new) .instance(() -> HalfShaftInstance::new) .validBlocks(AllBlocks.CREATIVE_MOTOR) .renderer(() -> CreativeMotorRenderer::new) .register(); - public static final TileEntityEntry GEARBOX = Create.registrate() + public static final BlockEntityEntry GEARBOX = Create.registrate() .tileEntity("gearbox", GearboxTileEntity::new) .instance(() -> GearboxInstance::new) .validBlocks(AllBlocks.GEARBOX) .renderer(() -> GearboxRenderer::new) .register(); - public static final TileEntityEntry ENCASED_SHAFT = Create.registrate() + public static final BlockEntityEntry ENCASED_SHAFT = Create.registrate() .tileEntity("encased_shaft", KineticTileEntity::new) .instance(() -> ShaftInstance::new) .validBlocks(AllBlocks.ANDESITE_ENCASED_SHAFT, AllBlocks.BRASS_ENCASED_SHAFT, AllBlocks.ENCASED_CHAIN_DRIVE) .renderer(() -> ShaftRenderer::new) .register(); - public static final TileEntityEntry ENCASED_COGWHEEL = Create.registrate() + public static final BlockEntityEntry ENCASED_COGWHEEL = Create.registrate() .tileEntity("encased_cogwheel", SimpleKineticTileEntity::new) .instance(() -> EncasedCogInstance::small) .validBlocks(AllBlocks.ANDESITE_ENCASED_COGWHEEL, AllBlocks.BRASS_ENCASED_COGWHEEL) .renderer(() -> EncasedCogRenderer::small) .register(); - public static final TileEntityEntry ENCASED_LARGE_COGWHEEL = Create.registrate() + public static final BlockEntityEntry ENCASED_LARGE_COGWHEEL = Create.registrate() .tileEntity("encased_large_cogwheel", SimpleKineticTileEntity::new) .instance(() -> EncasedCogInstance::large) .validBlocks(AllBlocks.ANDESITE_ENCASED_LARGE_COGWHEEL, AllBlocks.BRASS_ENCASED_LARGE_COGWHEEL) .renderer(() -> EncasedCogRenderer::large) .register(); - public static final TileEntityEntry ADJUSTABLE_PULLEY = Create.registrate() + public static final BlockEntityEntry ADJUSTABLE_PULLEY = Create.registrate() .tileEntity("adjustable_pulley", AdjustablePulleyTileEntity::new) .instance(() -> ShaftInstance::new) .validBlocks(AllBlocks.ADJUSTABLE_CHAIN_GEARSHIFT) .renderer(() -> ShaftRenderer::new) .register(); - public static final TileEntityEntry ENCASED_FAN = Create.registrate() + public static final BlockEntityEntry ENCASED_FAN = Create.registrate() .tileEntity("encased_fan", EncasedFanTileEntity::new) .instance(() -> FanInstance::new) .validBlocks(AllBlocks.ENCASED_FAN) .renderer(() -> EncasedFanRenderer::new) .register(); - public static final TileEntityEntry NOZZLE = Create.registrate() + public static final BlockEntityEntry NOZZLE = Create.registrate() .tileEntity("nozzle", NozzleTileEntity::new) .validBlocks(AllBlocks.NOZZLE) // .renderer(() -> renderer) .register(); - public static final TileEntityEntry CLUTCH = Create.registrate() + public static final BlockEntityEntry CLUTCH = Create.registrate() .tileEntity("clutch", ClutchTileEntity::new) .instance(() -> SplitShaftInstance::new) .validBlocks(AllBlocks.CLUTCH) .renderer(() -> SplitShaftRenderer::new) .register(); - public static final TileEntityEntry GEARSHIFT = Create.registrate() + public static final BlockEntityEntry GEARSHIFT = Create.registrate() .tileEntity("gearshift", GearshiftTileEntity::new) .instance(() -> SplitShaftInstance::new) .validBlocks(AllBlocks.GEARSHIFT) .renderer(() -> SplitShaftRenderer::new) .register(); - public static final TileEntityEntry TURNTABLE = Create.registrate() + public static final BlockEntityEntry TURNTABLE = Create.registrate() .tileEntity("turntable", TurntableTileEntity::new) .instance(() -> SingleRotatingInstance::new) .validBlocks(AllBlocks.TURNTABLE) .renderer(() -> KineticTileEntityRenderer::new) .register(); - public static final TileEntityEntry HAND_CRANK = Create.registrate() + public static final BlockEntityEntry HAND_CRANK = Create.registrate() .tileEntity("hand_crank", HandCrankTileEntity::new) .instance(() -> HandCrankInstance::new) .validBlocks(AllBlocks.HAND_CRANK, AllBlocks.COPPER_VALVE_HANDLE) @@ -280,383 +280,383 @@ public class AllTileEntities { .renderer(() -> HandCrankRenderer::new) .register(); - public static final TileEntityEntry CUCKOO_CLOCK = Create.registrate() + public static final BlockEntityEntry CUCKOO_CLOCK = Create.registrate() .tileEntity("cuckoo_clock", CuckooClockTileEntity::new) .instance(() -> HorizontalHalfShaftInstance::new) .validBlocks(AllBlocks.CUCKOO_CLOCK, AllBlocks.MYSTERIOUS_CUCKOO_CLOCK) .renderer(() -> CuckooClockRenderer::new) .register(); - public static final TileEntityEntry GANTRY_SHAFT = Create.registrate() + public static final BlockEntityEntry GANTRY_SHAFT = Create.registrate() .tileEntity("gantry_shaft", GantryShaftTileEntity::new) .instance(() -> SingleRotatingInstance::new) .validBlocks(AllBlocks.GANTRY_SHAFT) .renderer(() -> KineticTileEntityRenderer::new) .register(); - public static final TileEntityEntry GANTRY_PINION = Create.registrate() + public static final BlockEntityEntry GANTRY_PINION = Create.registrate() .tileEntity("gantry_pinion", GantryCarriageTileEntity::new) .instance(() -> GantryCarriageInstance::new) .validBlocks(AllBlocks.GANTRY_CARRIAGE) .renderer(() -> GantryCarriageRenderer::new) .register(); - public static final TileEntityEntry MECHANICAL_PUMP = Create.registrate() + public static final BlockEntityEntry MECHANICAL_PUMP = Create.registrate() .tileEntity("mechanical_pump", PumpTileEntity::new) .instance(() -> PumpCogInstance::new) .validBlocks(AllBlocks.MECHANICAL_PUMP) .renderer(() -> PumpRenderer::new) .register(); - public static final TileEntityEntry SMART_FLUID_PIPE = Create.registrate() + public static final BlockEntityEntry SMART_FLUID_PIPE = Create.registrate() .tileEntity("smart_fluid_pipe", SmartFluidPipeTileEntity::new) .validBlocks(AllBlocks.SMART_FLUID_PIPE) .renderer(() -> SmartTileEntityRenderer::new) .register(); - public static final TileEntityEntry FLUID_PIPE = Create.registrate() + public static final BlockEntityEntry FLUID_PIPE = Create.registrate() .tileEntity("fluid_pipe", FluidPipeTileEntity::new) .validBlocks(AllBlocks.FLUID_PIPE) .register(); - public static final TileEntityEntry ENCASED_FLUID_PIPE = Create.registrate() + public static final BlockEntityEntry ENCASED_FLUID_PIPE = Create.registrate() .tileEntity("encased_fluid_pipe", FluidPipeTileEntity::new) .validBlocks(AllBlocks.ENCASED_FLUID_PIPE) .register(); - public static final TileEntityEntry GLASS_FLUID_PIPE = Create.registrate() + public static final BlockEntityEntry GLASS_FLUID_PIPE = Create.registrate() .tileEntity("glass_fluid_pipe", StraightPipeTileEntity::new) .validBlocks(AllBlocks.GLASS_FLUID_PIPE) .renderer(() -> TransparentStraightPipeRenderer::new) .register(); - public static final TileEntityEntry FLUID_VALVE = Create.registrate() + public static final BlockEntityEntry FLUID_VALVE = Create.registrate() .tileEntity("fluid_valve", FluidValveTileEntity::new) .instance(() -> FluidValveInstance::new) .validBlocks(AllBlocks.FLUID_VALVE) .renderer(() -> FluidValveRenderer::new) .register(); - public static final TileEntityEntry FLUID_TANK = Create.registrate() + public static final BlockEntityEntry FLUID_TANK = Create.registrate() .tileEntity("fluid_tank", FluidTankTileEntity::new) .validBlocks(AllBlocks.FLUID_TANK) .renderer(() -> FluidTankRenderer::new) .register(); - public static final TileEntityEntry CREATIVE_FLUID_TANK = Create.registrate() + public static final BlockEntityEntry CREATIVE_FLUID_TANK = Create.registrate() .tileEntity("creative_fluid_tank", CreativeFluidTankTileEntity::new) .validBlocks(AllBlocks.CREATIVE_FLUID_TANK) .renderer(() -> FluidTankRenderer::new) .register(); - public static final TileEntityEntry HOSE_PULLEY = Create.registrate() + public static final BlockEntityEntry HOSE_PULLEY = Create.registrate() .tileEntity("hose_pulley", HosePulleyTileEntity::new) .instance(() -> HosePulleyInstance::new) .validBlocks(AllBlocks.HOSE_PULLEY) .renderer(() -> HosePulleyRenderer::new) .register(); - public static final TileEntityEntry SPOUT = Create.registrate() + public static final BlockEntityEntry SPOUT = Create.registrate() .tileEntity("spout", SpoutTileEntity::new) .validBlocks(AllBlocks.SPOUT) .renderer(() -> SpoutRenderer::new) .register(); - public static final TileEntityEntry ITEM_DRAIN = Create.registrate() + public static final BlockEntityEntry ITEM_DRAIN = Create.registrate() .tileEntity("item_drain", ItemDrainTileEntity::new) .validBlocks(AllBlocks.ITEM_DRAIN) .renderer(() -> ItemDrainRenderer::new) .register(); - public static final TileEntityEntry BELT = Create.registrate() + public static final BlockEntityEntry BELT = Create.registrate() .tileEntity("belt", BeltTileEntity::new) .instance(() -> BeltInstance::new) .validBlocks(AllBlocks.BELT) .renderer(() -> BeltRenderer::new) .register(); - public static final TileEntityEntry CHUTE = Create.registrate() + public static final BlockEntityEntry CHUTE = Create.registrate() .tileEntity("chute", ChuteTileEntity::new) .validBlocks(AllBlocks.CHUTE) .renderer(() -> ChuteRenderer::new) .register(); - public static final TileEntityEntry SMART_CHUTE = Create.registrate() + public static final BlockEntityEntry SMART_CHUTE = Create.registrate() .tileEntity("smart_chute", SmartChuteTileEntity::new) .validBlocks(AllBlocks.SMART_CHUTE) .renderer(() -> SmartChuteRenderer::new) .register(); - public static final TileEntityEntry ANDESITE_TUNNEL = Create.registrate() + public static final BlockEntityEntry ANDESITE_TUNNEL = Create.registrate() .tileEntity("andesite_tunnel", BeltTunnelTileEntity::new) .instance(() -> BeltTunnelInstance::new) .validBlocks(AllBlocks.ANDESITE_TUNNEL) .renderer(() -> BeltTunnelRenderer::new) .register(); - public static final TileEntityEntry BRASS_TUNNEL = Create.registrate() + public static final BlockEntityEntry BRASS_TUNNEL = Create.registrate() .tileEntity("brass_tunnel", BrassTunnelTileEntity::new) .instance(() -> BeltTunnelInstance::new) .validBlocks(AllBlocks.BRASS_TUNNEL) .renderer(() -> BeltTunnelRenderer::new) .register(); - public static final TileEntityEntry MECHANICAL_ARM = Create.registrate() + public static final BlockEntityEntry MECHANICAL_ARM = Create.registrate() .tileEntity("mechanical_arm", ArmTileEntity::new) .instance(() -> ArmInstance::new) .validBlocks(AllBlocks.MECHANICAL_ARM) .renderer(() -> ArmRenderer::new) .register(); - public static final TileEntityEntry ITEM_VAULT = Create.registrate() + public static final BlockEntityEntry ITEM_VAULT = Create.registrate() .tileEntity("item_vault", ItemVaultTileEntity::new) .validBlocks(AllBlocks.ITEM_VAULT) .register(); - public static final TileEntityEntry MECHANICAL_PISTON = Create.registrate() + public static final BlockEntityEntry MECHANICAL_PISTON = Create.registrate() .tileEntity("mechanical_piston", MechanicalPistonTileEntity::new) .instance(() -> ShaftInstance::new) .validBlocks(AllBlocks.MECHANICAL_PISTON, AllBlocks.STICKY_MECHANICAL_PISTON) .renderer(() -> MechanicalPistonRenderer::new) .register(); - public static final TileEntityEntry WINDMILL_BEARING = Create.registrate() + public static final BlockEntityEntry WINDMILL_BEARING = Create.registrate() .tileEntity("windmill_bearing", WindmillBearingTileEntity::new) .instance(() -> BearingInstance::new) .validBlocks(AllBlocks.WINDMILL_BEARING) .renderer(() -> BearingRenderer::new) .register(); - public static final TileEntityEntry MECHANICAL_BEARING = Create.registrate() + public static final BlockEntityEntry MECHANICAL_BEARING = Create.registrate() .tileEntity("mechanical_bearing", MechanicalBearingTileEntity::new) .instance(() -> BearingInstance::new) .validBlocks(AllBlocks.MECHANICAL_BEARING) .renderer(() -> BearingRenderer::new) .register(); - public static final TileEntityEntry CLOCKWORK_BEARING = Create.registrate() + public static final BlockEntityEntry CLOCKWORK_BEARING = Create.registrate() .tileEntity("clockwork_bearing", ClockworkBearingTileEntity::new) .instance(() -> BearingInstance::new) .validBlocks(AllBlocks.CLOCKWORK_BEARING) .renderer(() -> BearingRenderer::new) .register(); - public static final TileEntityEntry ROPE_PULLEY = Create.registrate() + public static final BlockEntityEntry ROPE_PULLEY = Create.registrate() .tileEntity("rope_pulley", PulleyTileEntity::new) .instance(() -> RopePulleyInstance::new) .validBlocks(AllBlocks.ROPE_PULLEY) .renderer(() -> PulleyRenderer::new) .register(); - public static final TileEntityEntry CHASSIS = Create.registrate() + public static final BlockEntityEntry CHASSIS = Create.registrate() .tileEntity("chassis", ChassisTileEntity::new) .validBlocks(AllBlocks.RADIAL_CHASSIS, AllBlocks.LINEAR_CHASSIS, AllBlocks.SECONDARY_LINEAR_CHASSIS) // .renderer(() -> renderer) .register(); - public static final TileEntityEntry STICKER = Create.registrate() + public static final BlockEntityEntry STICKER = Create.registrate() .tileEntity("sticker", StickerTileEntity::new) .instance(() -> StickerInstance::new) .validBlocks(AllBlocks.STICKER) .renderer(() -> StickerRenderer::new) .register(); - public static final TileEntityEntry DRILL = Create.registrate() + public static final BlockEntityEntry DRILL = Create.registrate() .tileEntity("drill", DrillTileEntity::new) .instance(() -> DrillInstance::new) .validBlocks(AllBlocks.MECHANICAL_DRILL) .renderer(() -> DrillRenderer::new) .register(); - public static final TileEntityEntry SAW = Create.registrate() + public static final BlockEntityEntry SAW = Create.registrate() .tileEntity("saw", SawTileEntity::new) .instance(() -> SawInstance::new) .validBlocks(AllBlocks.MECHANICAL_SAW) .renderer(() -> SawRenderer::new) .register(); - public static final TileEntityEntry HARVESTER = Create.registrate() + public static final BlockEntityEntry HARVESTER = Create.registrate() .tileEntity("harvester", HarvesterTileEntity::new) .validBlocks(AllBlocks.MECHANICAL_HARVESTER) .renderer(() -> HarvesterRenderer::new) .register(); - public static final TileEntityEntry PORTABLE_STORAGE_INTERFACE = + public static final BlockEntityEntry PORTABLE_STORAGE_INTERFACE = Create.registrate() .tileEntity("portable_storage_interface", PortableItemInterfaceTileEntity::new) .validBlocks(AllBlocks.PORTABLE_STORAGE_INTERFACE) .renderer(() -> PortableStorageInterfaceRenderer::new) .register(); - public static final TileEntityEntry PORTABLE_FLUID_INTERFACE = Create.registrate() + public static final BlockEntityEntry PORTABLE_FLUID_INTERFACE = Create.registrate() .tileEntity("portable_fluid_interface", PortableFluidInterfaceTileEntity::new) .validBlocks(AllBlocks.PORTABLE_FLUID_INTERFACE) .renderer(() -> PortableStorageInterfaceRenderer::new) .register(); - public static final TileEntityEntry FLYWHEEL = Create.registrate() + public static final BlockEntityEntry FLYWHEEL = Create.registrate() .tileEntity("flywheel", FlywheelTileEntity::new) .instance(() -> FlyWheelInstance::new) .validBlocks(AllBlocks.FLYWHEEL) .renderer(() -> FlywheelRenderer::new) .register(); - public static final TileEntityEntry FURNACE_ENGINE = Create.registrate() + public static final BlockEntityEntry FURNACE_ENGINE = Create.registrate() .tileEntity("furnace_engine", FurnaceEngineTileEntity::new) .instance(() -> EngineInstance::new) .validBlocks(AllBlocks.FURNACE_ENGINE) .renderer(() -> EngineRenderer::new) .register(); - public static final TileEntityEntry MILLSTONE = Create.registrate() + public static final BlockEntityEntry MILLSTONE = Create.registrate() .tileEntity("millstone", MillstoneTileEntity::new) .instance(() -> MillStoneCogInstance::new) .validBlocks(AllBlocks.MILLSTONE) .renderer(() -> MillstoneRenderer::new) .register(); - public static final TileEntityEntry CRUSHING_WHEEL = Create.registrate() + public static final BlockEntityEntry CRUSHING_WHEEL = Create.registrate() .tileEntity("crushing_wheel", CrushingWheelTileEntity::new) .instance(() -> CutoutRotatingInstance::new) .validBlocks(AllBlocks.CRUSHING_WHEEL) .renderer(() -> KineticTileEntityRenderer::new) .register(); - public static final TileEntityEntry CRUSHING_WHEEL_CONTROLLER = + public static final BlockEntityEntry CRUSHING_WHEEL_CONTROLLER = Create.registrate() .tileEntity("crushing_wheel_controller", CrushingWheelControllerTileEntity::new) .validBlocks(AllBlocks.CRUSHING_WHEEL_CONTROLLER) // .renderer(() -> renderer) .register(); - public static final TileEntityEntry WATER_WHEEL = Create.registrate() + public static final BlockEntityEntry WATER_WHEEL = Create.registrate() .tileEntity("water_wheel", WaterWheelTileEntity::new) .instance(() -> CutoutRotatingInstance::new) .validBlocks(AllBlocks.WATER_WHEEL) .renderer(() -> KineticTileEntityRenderer::new) .register(); - public static final TileEntityEntry MECHANICAL_PRESS = Create.registrate() + public static final BlockEntityEntry MECHANICAL_PRESS = Create.registrate() .tileEntity("mechanical_press", MechanicalPressTileEntity::new) .instance(() -> PressInstance::new) .validBlocks(AllBlocks.MECHANICAL_PRESS) .renderer(() -> MechanicalPressRenderer::new) .register(); - public static final TileEntityEntry MECHANICAL_MIXER = Create.registrate() + public static final BlockEntityEntry MECHANICAL_MIXER = Create.registrate() .tileEntity("mechanical_mixer", MechanicalMixerTileEntity::new) .instance(() -> MixerInstance::new) .validBlocks(AllBlocks.MECHANICAL_MIXER) .renderer(() -> MechanicalMixerRenderer::new) .register(); - public static final TileEntityEntry DEPLOYER = Create.registrate() + public static final BlockEntityEntry DEPLOYER = Create.registrate() .tileEntity("deployer", DeployerTileEntity::new) .instance(() -> DeployerInstance::new) .validBlocks(AllBlocks.DEPLOYER) .renderer(() -> DeployerRenderer::new) .register(); - public static final TileEntityEntry BASIN = Create.registrate() + public static final BlockEntityEntry BASIN = Create.registrate() .tileEntity("basin", BasinTileEntity::new) .validBlocks(AllBlocks.BASIN) .renderer(() -> BasinRenderer::new) .register(); - public static final TileEntityEntry HEATER = Create.registrate() + public static final BlockEntityEntry HEATER = Create.registrate() .tileEntity("blaze_heater", BlazeBurnerTileEntity::new) .validBlocks(AllBlocks.BLAZE_BURNER) .renderer(() -> BlazeBurnerRenderer::new) .register(); - public static final TileEntityEntry MECHANICAL_CRAFTER = Create.registrate() + public static final BlockEntityEntry MECHANICAL_CRAFTER = Create.registrate() .tileEntity("mechanical_crafter", MechanicalCrafterTileEntity::new) .instance(() -> MechanicalCrafterInstance::new) .validBlocks(AllBlocks.MECHANICAL_CRAFTER) .renderer(() -> MechanicalCrafterRenderer::new) .register(); - public static final TileEntityEntry SEQUENCED_GEARSHIFT = Create.registrate() + public static final BlockEntityEntry SEQUENCED_GEARSHIFT = Create.registrate() .tileEntity("sequenced_gearshift", SequencedGearshiftTileEntity::new) .instance(() -> SplitShaftInstance::new) .validBlocks(AllBlocks.SEQUENCED_GEARSHIFT) .renderer(() -> SplitShaftRenderer::new) .register(); - public static final TileEntityEntry ROTATION_SPEED_CONTROLLER = Create.registrate() + public static final BlockEntityEntry ROTATION_SPEED_CONTROLLER = Create.registrate() .tileEntity("rotation_speed_controller", SpeedControllerTileEntity::new) .instance(() -> ShaftInstance::new) .validBlocks(AllBlocks.ROTATION_SPEED_CONTROLLER) .renderer(() -> SpeedControllerRenderer::new) .register(); - public static final TileEntityEntry SPEEDOMETER = Create.registrate() + public static final BlockEntityEntry SPEEDOMETER = Create.registrate() .tileEntity("speedometer", SpeedGaugeTileEntity::new) .instance(() -> GaugeInstance.Speed::new) .validBlocks(AllBlocks.SPEEDOMETER) .renderer(() -> GaugeRenderer::speed) .register(); - public static final TileEntityEntry STRESSOMETER = Create.registrate() + public static final BlockEntityEntry STRESSOMETER = Create.registrate() .tileEntity("stressometer", StressGaugeTileEntity::new) .instance(() -> GaugeInstance.Stress::new) .validBlocks(AllBlocks.STRESSOMETER) .renderer(() -> GaugeRenderer::stress) .register(); - public static final TileEntityEntry ANALOG_LEVER = Create.registrate() + public static final BlockEntityEntry ANALOG_LEVER = Create.registrate() .tileEntity("analog_lever", AnalogLeverTileEntity::new) .instance(() -> AnalogLeverInstance::new) .validBlocks(AllBlocks.ANALOG_LEVER) .renderer(() -> AnalogLeverRenderer::new) .register(); - public static final TileEntityEntry CART_ASSEMBLER = Create.registrate() + public static final BlockEntityEntry CART_ASSEMBLER = Create.registrate() .tileEntity("cart_assembler", CartAssemblerTileEntity::new) .validBlocks(AllBlocks.CART_ASSEMBLER) // .renderer(() -> renderer) .register(); // Logistics - public static final TileEntityEntry REDSTONE_LINK = Create.registrate() + public static final BlockEntityEntry REDSTONE_LINK = Create.registrate() .tileEntity("redstone_link", RedstoneLinkTileEntity::new) .validBlocks(AllBlocks.REDSTONE_LINK) .renderer(() -> SmartTileEntityRenderer::new) .register(); - public static final TileEntityEntry NIXIE_TUBE = Create.registrate() + public static final BlockEntityEntry NIXIE_TUBE = Create.registrate() .tileEntity("nixie_tube", NixieTubeTileEntity::new) .validBlocks(AllBlocks.ORANGE_NIXIE_TUBE) .validBlocks(AllBlocks.NIXIE_TUBES.toArray()) .renderer(() -> NixieTubeRenderer::new) .register(); - public static final TileEntityEntry STOCKPILE_SWITCH = Create.registrate() + public static final BlockEntityEntry STOCKPILE_SWITCH = Create.registrate() .tileEntity("stockpile_switch", StockpileSwitchTileEntity::new) .validBlocks(AllBlocks.STOCKPILE_SWITCH) .renderer(() -> SmartTileEntityRenderer::new) .register(); - public static final TileEntityEntry CREATIVE_CRATE = Create.registrate() + public static final BlockEntityEntry CREATIVE_CRATE = Create.registrate() .tileEntity("creative_crate", CreativeCrateTileEntity::new) .validBlocks(AllBlocks.CREATIVE_CRATE) .renderer(() -> SmartTileEntityRenderer::new) .register(); - public static final TileEntityEntry DEPOT = Create.registrate() + public static final BlockEntityEntry DEPOT = Create.registrate() .tileEntity("depot", DepotTileEntity::new) .validBlocks(AllBlocks.DEPOT) .renderer(() -> DepotRenderer::new) .register(); - public static final TileEntityEntry WEIGHTED_EJECTOR = Create.registrate() + public static final BlockEntityEntry WEIGHTED_EJECTOR = Create.registrate() .tileEntity("weighted_ejector", EjectorTileEntity::new) .instance(() -> EjectorInstance::new) .validBlocks(AllBlocks.WEIGHTED_EJECTOR) .renderer(() -> EjectorRenderer::new) .register(); - public static final TileEntityEntry FUNNEL = Create.registrate() + public static final BlockEntityEntry FUNNEL = Create.registrate() .tileEntity("funnel", FunnelTileEntity::new) .instance(() -> FunnelInstance::new) .validBlocks(AllBlocks.BRASS_FUNNEL, AllBlocks.BRASS_BELT_FUNNEL, AllBlocks.ANDESITE_FUNNEL, @@ -664,20 +664,20 @@ public class AllTileEntities { .renderer(() -> FunnelRenderer::new) .register(); - public static final TileEntityEntry CONTENT_OBSERVER = Create.registrate() + public static final BlockEntityEntry CONTENT_OBSERVER = Create.registrate() .tileEntity("content_observer", ContentObserverTileEntity::new) .validBlocks(AllBlocks.CONTENT_OBSERVER) .renderer(() -> SmartTileEntityRenderer::new) .register(); - public static final TileEntityEntry PULSE_EXTENDER = Create.registrate() + public static final BlockEntityEntry PULSE_EXTENDER = Create.registrate() .tileEntity("adjustable_repeater", PulseExtenderTileEntity::new) .instance(() -> BrassDiodeInstance::new) .validBlocks(AllBlocks.PULSE_EXTENDER) .renderer(() -> BrassDiodeRenderer::new) .register(); - public static final TileEntityEntry PULSE_REPEATER = + public static final BlockEntityEntry PULSE_REPEATER = Create.registrate() .tileEntity("adjustable_pulse_repeater", PulseRepeaterTileEntity::new) .instance(() -> BrassDiodeInstance::new) @@ -685,7 +685,7 @@ public class AllTileEntities { .renderer(() -> BrassDiodeRenderer::new) .register(); - public static final TileEntityEntry LECTERN_CONTROLLER = + public static final BlockEntityEntry LECTERN_CONTROLLER = Create.registrate() .tileEntity("lectern_controller", LecternControllerTileEntity::new) .validBlocks(AllBlocks.LECTERN_CONTROLLER) @@ -693,26 +693,26 @@ public class AllTileEntities { .register(); // Curiosities - public static final TileEntityEntry COPPER_BACKTANK = Create.registrate() + public static final BlockEntityEntry COPPER_BACKTANK = Create.registrate() .tileEntity("copper_backtank", CopperBacktankTileEntity::new) .instance(() -> CopperBacktankInstance::new) .validBlocks(AllBlocks.COPPER_BACKTANK) .renderer(() -> CopperBacktankRenderer::new) .register(); - public static final TileEntityEntry PECULIAR_BELL = Create.registrate() + public static final BlockEntityEntry PECULIAR_BELL = Create.registrate() .tileEntity("peculiar_bell", PeculiarBellTileEntity::new) .validBlocks(AllBlocks.PECULIAR_BELL) .renderer(() -> BellRenderer::new) .register(); - public static final TileEntityEntry HAUNTED_BELL = Create.registrate() + public static final BlockEntityEntry HAUNTED_BELL = Create.registrate() .tileEntity("cursed_bell", HauntedBellTileEntity::new) .validBlocks(AllBlocks.HAUNTED_BELL) .renderer(() -> BellRenderer::new) .register(); - public static final TileEntityEntry TOOLBOX = Create.registrate() + public static final BlockEntityEntry TOOLBOX = Create.registrate() .tileEntity("toolbox", ToolboxTileEntity::new) .instance(() -> ToolBoxInstance::new) .validBlocks(AllBlocks.TOOLBOXES.toArray()) diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index 4b1fa8256..34d05e7f0 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -21,7 +21,6 @@ import com.simibubi.create.content.schematics.filtering.SchematicInstances; import com.simibubi.create.foundation.advancement.AllAdvancements; import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.block.CopperRegistries; -import com.simibubi.create.foundation.command.ChunkUtil; import com.simibubi.create.foundation.command.ServerLagger; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.data.CreateRegistrate; @@ -42,7 +41,6 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.level.levelgen.feature.Feature; -import net.minecraft.world.level.levelgen.placement.FeatureDecorator; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.MinecraftForge; @@ -75,7 +73,6 @@ public class Create { public static final RedstoneLinkNetworkHandler REDSTONE_LINK_NETWORK_HANDLER = new RedstoneLinkNetworkHandler(); public static final TorquePropagator TORQUE_PROPAGATOR = new TorquePropagator(); public static final ServerLagger LAGGER = new ServerLagger(); - public static final ChunkUtil CHUNK_UTIL = new ChunkUtil(); public static final Random RANDOM = new Random(); private static final NonNullLazyValue REGISTRATE = CreateRegistrate.lazy(ID); @@ -115,13 +112,10 @@ public class Create { modEventBus.addListener(Create::init); modEventBus.addListener(EventPriority.LOWEST, Create::gatherData); modEventBus.addGenericListener(Feature.class, AllWorldFeatures::registerOreFeatures); - modEventBus.addGenericListener(FeatureDecorator.class, AllWorldFeatures::registerDecoratorFeatures); modEventBus.addGenericListener(RecipeSerializer.class, AllRecipeTypes::register); modEventBus.addGenericListener(ParticleType.class, AllParticleTypes::register); modEventBus.addGenericListener(SoundEvent.class, AllSoundEvents::register); - forgeEventBus.register(CHUNK_UTIL); - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> CreateClient.onCtorClient(modEventBus, forgeEventBus)); } @@ -131,13 +125,13 @@ public class Create { SchematicInstances.register(); BuiltinPotatoProjectileTypes.register(); - CHUNK_UTIL.init(); ShippedResourcePacks.extractFiles("Copper Legacy Pack"); event.enqueueWork(() -> { AllTriggers.register(); SchematicProcessor.register(); AllWorldFeatures.registerFeatures(); + AllWorldFeatures.registerPlacementTypes(); }); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatEntity.java index c9d812d9f..15a795f08 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatEntity.java @@ -17,8 +17,8 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.fmllegacy.common.registry.IEntityAdditionalSpawnData; -import net.minecraftforge.fmllegacy.network.NetworkHooks; +import net.minecraftforge.entity.IEntityAdditionalSpawnData; +import net.minecraftforge.network.NetworkHooks; public class SeatEntity extends Entity implements IEntityAdditionalSpawnData { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerBlock.java index bc9a08dad..c0496a737 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerBlock.java @@ -164,8 +164,7 @@ public class CrushingWheelControllerBlock extends DirectionalBlock implements IT return standardShape; if (!(context instanceof EntityCollisionContext)) return standardShape; - Entity entity = ((EntityCollisionContext) context).getEntity() - .orElse(null); + Entity entity = ((EntityCollisionContext) context).getEntity(); if (entity == null) return standardShape; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerHandler.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerHandler.java index 51ed66329..e16e7bd9c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerHandler.java @@ -374,7 +374,7 @@ public class DeployerHandler { world.setBlock(pos, Blocks.AIR.defaultBlockState(), 35); world.setBlock(posUp, Blocks.AIR.defaultBlockState(), 35); } else { - if (!blockstate.removedByPlayer(world, pos, player, canHarvest, world.getFluidState(pos))) + if (!blockstate.onDestroyedByPlayer(world, pos, player, canHarvest, world.getFluidState(pos))) return true; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java index 27321855d..4fdbc7f85 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java @@ -136,7 +136,7 @@ public class DeployerMovementBehaviour extends MovementBehaviour { if (AllBlockTags.SAFE_NBT.matches(blockState)) { BlockEntity tile = schematicWorld.getBlockEntity(pos); if (tile != null) { - data = tile.save(new CompoundTag()); + data = tile.saveWithFullMetadata(); data = NBTProcessors.process(tile, data, true); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerBlock.java index ceb71e168..f53f53a6f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerBlock.java @@ -33,8 +33,8 @@ public class MechanicalMixerBlock extends KineticBlock implements ITE palette = new HashMapPalette<>(GameData.getBlockStateIDMap(), 16, (i, s) -> { throw new IllegalStateException("Palette Map index exceeded maximum"); - }, NbtUtils::readBlockState, NbtUtils::writeBlockState); + }); ListTag blockList = new ListTag(); for (StructureBlockInfo block : this.blocks.values()) { @@ -876,7 +874,9 @@ public abstract class Contraption { } ListTag paletteNBT = new ListTag(); - palette.write(paletteNBT); + for(int i = 0; i < palette.getSize(); ++i) + paletteNBT.add(NbtUtils.writeBlockState(palette.values.byId(i))); + compound.put("Palette", paletteNBT); compound.put("BlockList", blockList); @@ -890,8 +890,12 @@ public abstract class Contraption { CompoundTag c = ((CompoundTag) compound); palette = new HashMapPalette<>(GameData.getBlockStateIDMap(), 16, (i, s) -> { throw new IllegalStateException("Palette Map index exceeded maximum"); - }, NbtUtils::readBlockState, NbtUtils::writeBlockState); - palette.read(c.getList("Palette", 10)); + }); + + ListTag list = c.getList("Palette", 10); + palette.values.clear(); + for (int i = 0; i < list.size(); ++i) + palette.values.add(NbtUtils.readBlockState(list.getCompound(i))); blockList = c.getList("BlockList", 10); } else { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java index 98aa52153..2d788c9a0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java @@ -1,10 +1,9 @@ package com.simibubi.create.content.contraptions.components.structureMovement; -import static net.minecraft.world.entity.Entity.collideBoundingBoxHeuristically; +import static net.minecraft.world.entity.Entity.collideBoundingBox; import java.util.ArrayList; import java.util.List; -import java.util.stream.Stream; import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.commons.lang3.mutable.MutableFloat; @@ -34,7 +33,6 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; -import net.minecraft.util.RewindableStream; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; @@ -44,9 +42,6 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; -import net.minecraft.world.phys.shapes.BooleanOp; -import net.minecraft.world.phys.shapes.CollisionContext; -import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -121,11 +116,10 @@ public class ContraptionCollider { // Else find 'nearby' individual block shapes to collide with List bbs = new ArrayList<>(); - RewindableStream potentialHits = + List potentialHits = getPotentiallyCollidedShapes(world, contraption, localBB.expandTowards(motionCopy)); - potentialHits.getStream() - .forEach(shape -> shape.toAabbs() - .forEach(bbs::add)); + potentialHits.forEach(shape -> shape.toAabbs() + .forEach(bbs::add)); return bbs; }); @@ -398,38 +392,29 @@ public class ContraptionCollider { /** From Entity#collide **/ static Vec3 collide(Vec3 p_20273_, Entity e) { AABB aabb = e.getBoundingBox(); - CollisionContext collisioncontext = CollisionContext.of(e); - VoxelShape voxelshape = e.level.getWorldBorder() - .getCollisionShape(); - Stream stream = - Shapes.joinIsNotEmpty(voxelshape, Shapes.create(aabb.deflate(1.0E-7D)), BooleanOp.AND) ? Stream.empty() - : Stream.of(voxelshape); - Stream stream1 = e.level.getEntityCollisions(e, aabb.expandTowards(p_20273_), (p_19949_) -> { - return true; - }); - RewindableStream rewindablestream = new RewindableStream<>(Stream.concat(stream1, stream)); - Vec3 vec3 = p_20273_.lengthSqr() == 0.0D ? p_20273_ - : collideBoundingBoxHeuristically(e, p_20273_, aabb, e.level, collisioncontext, rewindablestream); + 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 = e.isOnGround() || flag1 && p_20273_.y < 0.0D; if (e.maxUpStep > 0.0F && flag3 && (flag || flag2)) { - Vec3 vec31 = collideBoundingBoxHeuristically(e, new Vec3(p_20273_.x, e.maxUpStep, p_20273_.z), aabb, - e.level, collisioncontext, rewindablestream); - Vec3 vec32 = collideBoundingBoxHeuristically(e, new Vec3(0.0D, e.maxUpStep, 0.0D), - aabb.expandTowards(p_20273_.x, 0.0D, p_20273_.z), e.level, collisioncontext, rewindablestream); - if (vec32.y < e.maxUpStep) { - Vec3 vec33 = collideBoundingBoxHeuristically(e, new Vec3(p_20273_.x, 0.0D, p_20273_.z), - aabb.move(vec32), e.level, collisioncontext, rewindablestream).add(vec32); + Vec3 vec31 = + collideBoundingBox(e, new Vec3(p_20273_.x, (double) e.maxUpStep, p_20273_.z), aabb, e.level, list); + Vec3 vec32 = collideBoundingBox(e, new Vec3(0.0D, (double) e.maxUpStep, 0.0D), + aabb.expandTowards(p_20273_.x, 0.0D, p_20273_.z), e.level, list); + if (vec32.y < (double) e.maxUpStep) { + Vec3 vec33 = + 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; } } if (vec31.horizontalDistanceSqr() > vec3.horizontalDistanceSqr()) { - return vec31.add(collideBoundingBoxHeuristically(e, new Vec3(0.0D, -vec31.y + p_20273_.y, 0.0D), - aabb.move(vec31), e.level, collisioncontext, rewindablestream)); + return vec31.add(collideBoundingBox(e, new Vec3(0.0D, -vec31.y + p_20273_.y, 0.0D), aabb.move(vec31), + e.level, list)); } } @@ -451,7 +436,7 @@ public class ContraptionCollider { return entity instanceof LocalPlayer; } - private static RewindableStream getPotentiallyCollidedShapes(Level world, Contraption contraption, + private static List getPotentiallyCollidedShapes(Level world, Contraption contraption, AABB localBB) { double height = localBB.getYsize(); @@ -464,7 +449,7 @@ public class ContraptionCollider { BlockPos min = new BlockPos(blockScanBB.minX, blockScanBB.minY, blockScanBB.minZ); BlockPos max = new BlockPos(blockScanBB.maxX, blockScanBB.maxY, blockScanBB.maxZ); - RewindableStream potentialHits = new RewindableStream<>(BlockPos.betweenClosedStream(min, max) + List potentialHits = BlockPos.betweenClosedStream(min, max) .filter(contraption.getBlocks()::containsKey) .map(p -> { BlockState blockState = contraption.getBlocks() @@ -474,7 +459,8 @@ public class ContraptionCollider { VoxelShape collisionShape = blockState.getCollisionShape(world, p); return collisionShape.move(pos.getX(), pos.getY(), pos.getZ()); }) - .filter(Predicates.not(VoxelShape::isEmpty))); + .filter(Predicates.not(VoxelShape::isEmpty)) + .toList(); return potentialHits; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionDisassemblyPacket.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionDisassemblyPacket.java index 073f2621b..1020cfebc 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionDisassemblyPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionDisassemblyPacket.java @@ -7,7 +7,7 @@ import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class ContraptionDisassemblyPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionStallPacket.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionStallPacket.java index 14ea75d3a..79d9ddb86 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionStallPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionStallPacket.java @@ -7,7 +7,7 @@ import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class ContraptionStallPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedFluidStorage.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedFluidStorage.java index 303a15587..cd2db1403 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedFluidStorage.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedFluidStorage.java @@ -18,7 +18,7 @@ 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.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; public class MountedFluidStorage { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedStorage.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedStorage.java index 6627cee39..0196ce6af 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedStorage.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedStorage.java @@ -63,7 +63,7 @@ public class MountedStorage { return; if (te instanceof ChestBlockEntity) { - CompoundTag tag = te.save(new CompoundTag()); + CompoundTag tag = te.saveWithFullMetadata(); if (tag.contains("LootTable", 8)) return; @@ -115,7 +115,7 @@ public class MountedStorage { return; if (te instanceof ChestBlockEntity) { - CompoundTag tag = te.save(new CompoundTag()); + CompoundTag tag = te.saveWithFullMetadata(); tag.remove("Items"); NonNullList items = NonNullList.withSize(handler.getSlots(), ItemStack.EMPTY); for (int i = 0; i < items.size(); i++) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/SailBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/SailBlock.java index cbedf838e..22bb49683 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/SailBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/SailBlock.java @@ -171,11 +171,11 @@ public class SailBlock extends WrenchableDirectionalBlock { } @Override - public ItemStack getPickBlock(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) { - ItemStack pickBlock = super.getPickBlock(state, target, world, pos, player); + public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) { + ItemStack pickBlock = super.getCloneItemStack(state, target, world, pos, player); if (pickBlock.isEmpty()) return AllBlocks.SAIL.get() - .getPickBlock(state, target, world, pos, player); + .getCloneItemStack(state, target, world, pos, player); return pickBlock; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntity.java index 7657fcc19..f088e9236 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntity.java @@ -26,7 +26,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; public class GantryContraptionEntity extends AbstractContraptionEntity { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionUpdatePacket.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionUpdatePacket.java index 84ffc7682..2fb4b9af2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionUpdatePacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionUpdatePacket.java @@ -7,7 +7,7 @@ import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class GantryContraptionUpdatePacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/GlueEffectPacket.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/GlueEffectPacket.java index f875681d1..ddbce17e0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/GlueEffectPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/GlueEffectPacket.java @@ -11,7 +11,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class GlueEffectPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java index e173183af..6f920189e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java @@ -62,10 +62,10 @@ import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.util.FakePlayer; +import net.minecraftforge.entity.IEntityAdditionalSpawnData; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fmllegacy.common.registry.IEntityAdditionalSpawnData; -import net.minecraftforge.fmllegacy.network.NetworkHooks; -import net.minecraftforge.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.NetworkHooks; +import net.minecraftforge.network.PacketDistributor; public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnData, ISpecialEntityItemRequirement, IInstanceRendered { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueHandler.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueHandler.java index 32861888a..30e916084 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueHandler.java @@ -29,7 +29,7 @@ import net.minecraftforge.common.ForgeMod; import net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; -import net.minecraftforge.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; @EventBusSubscriber public class SuperGlueHandler { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java index d1d8ce859..98e977334 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java @@ -223,8 +223,7 @@ public class CartAssemblerBlock extends BaseRailBlock public VoxelShape getCollisionShape(@Nonnull BlockState state, @Nonnull BlockGetter worldIn, @Nonnull BlockPos pos, CollisionContext context) { if (context instanceof EntityCollisionContext) { - Entity entity = ((EntityCollisionContext) context).getEntity() - .orElse(null); + Entity entity = ((EntityCollisionContext) context).getEntity(); if (entity instanceof AbstractMinecart) return Shapes.empty(); if (entity instanceof Player) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonBlock.java index dee704e7d..856c5bbea 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonBlock.java @@ -107,8 +107,7 @@ public class MechanicalPistonBlock extends DirectionalAxisKineticBlock implement return; if (!world.isClientSide && !world.getBlockTicks() .willTickThisTick(pos, this)) - world.getBlockTicks() - .scheduleTick(pos, this, 0); + world.scheduleTick(pos, this, 0); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonHeadBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonHeadBlock.java index 6f1e2df13..202a8ffa9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonHeadBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonHeadBlock.java @@ -51,7 +51,7 @@ public class MechanicalPistonHeadBlock extends WrenchableDirectionalBlock implem } @Override - public ItemStack getPickBlock(BlockState state, HitResult target, BlockGetter world, BlockPos pos, + public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) { return AllBlocks.PISTON_EXTENSION_POLE.asStack(); } @@ -101,9 +101,8 @@ public class MechanicalPistonHeadBlock extends WrenchableDirectionalBlock implem @Override public BlockState updateShape(BlockState state, Direction direction, BlockState neighbourState, LevelAccessor world, BlockPos pos, BlockPos neighbourPos) { - if (state.getValue(BlockStateProperties.WATERLOGGED)) { - world.getLiquidTicks().scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); - } + if (state.getValue(BlockStateProperties.WATERLOGGED)) + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); return state; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonExtensionPoleBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonExtensionPoleBlock.java index 5698d8549..e0f63749a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonExtensionPoleBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonExtensionPoleBlock.java @@ -150,9 +150,8 @@ public class PistonExtensionPoleBlock extends WrenchableDirectionalBlock impleme @Override public BlockState updateShape(BlockState state, Direction direction, BlockState neighbourState, LevelAccessor world, BlockPos pos, BlockPos neighbourPos) { - if (state.getValue(BlockStateProperties.WATERLOGGED)) { - world.getLiquidTicks().scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); - } + if (state.getValue(BlockStateProperties.WATERLOGGED)) + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); return state; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyBlock.java index 91624fe30..0031780ac 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyBlock.java @@ -107,7 +107,7 @@ public class PulleyBlock extends HorizontalAxisKineticBlock implements ITE { @@ -71,8 +71,7 @@ public class PumpBlock extends DirectionalKineticBlock implements SimpleWaterlog return; if (!isOpenAt(state, d)) return; - world.getBlockTicks() - .scheduleTick(pos, this, 1, TickPriority.HIGH); + world.scheduleTick(pos, this, 1, TickPriority.HIGH); } @Override @@ -90,10 +89,8 @@ public class PumpBlock extends DirectionalKineticBlock implements SimpleWaterlog @Override public BlockState updateShape(BlockState state, Direction direction, BlockState neighbourState, LevelAccessor world, BlockPos pos, BlockPos neighbourPos) { - if (state.getValue(BlockStateProperties.WATERLOGGED)) { - world.getLiquidTicks() - .scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); - } + if (state.getValue(BlockStateProperties.WATERLOGGED)) + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); return state; } @@ -115,8 +112,7 @@ public class PumpBlock extends DirectionalKineticBlock implements SimpleWaterlog if (world.isClientSide) return; if (state != oldState) - world.getBlockTicks() - .scheduleTick(pos, this, 1, TickPriority.HIGH); + world.scheduleTick(pos, this, 1, TickPriority.HIGH); if (isPump(state) && isPump(oldState) && state.getValue(FACING) == oldState.getValue(FACING) .getOpposite()) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidFillingBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidFillingBehaviour.java index 85e30c722..98a1d6278 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidFillingBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidFillingBehaviour.java @@ -23,9 +23,6 @@ import net.minecraft.tags.BlockTags; import net.minecraft.tags.FluidTags; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.ServerTickList; -import net.minecraft.world.level.TickList; -import net.minecraft.world.level.TickNextTickData; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.DoorBlock; @@ -39,6 +36,8 @@ 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; public class FluidFillingBehaviour extends FluidManipulationBehaviour { @@ -191,20 +190,10 @@ public class FluidFillingBehaviour extends FluidManipulationBehaviour { .createLegacyBlock(), 2 | 16); } - TickList pendingFluidTicks = world.getLiquidTicks(); - if (pendingFluidTicks instanceof ServerTickList) { - ServerTickList serverTickList = (ServerTickList) pendingFluidTicks; - TickNextTickData removedEntry = null; - for (TickNextTickData nextTickListEntry : serverTickList.tickNextTickSet) { - if (nextTickListEntry.pos.equals(currentPos)) { - removedEntry = nextTickListEntry; - break; - } - } - if (removedEntry != null) { - serverTickList.tickNextTickSet.remove(removedEntry); - serverTickList.tickNextTickList.remove(removedEntry); - } + LevelTickAccess pendingFluidTicks = world.getFluidTicks(); + if (pendingFluidTicks instanceof LevelTicks) { + LevelTicks serverTickList = (LevelTicks) pendingFluidTicks; + serverTickList.clearArea(new BoundingBox(currentPos)); } affectedArea.encapsulate(BoundingBox.fromCorners(currentPos, currentPos)); diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidManipulationBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidManipulationBehaviour.java index 66c4b29f0..dcad19b59 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidManipulationBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidManipulationBehaviour.java @@ -121,9 +121,8 @@ public abstract class FluidManipulationBehaviour extends TileEntityBehaviour { FluidState nextFluidState = world.getFluidState(pos); if (nextFluidState.isEmpty()) return; - world.getLiquidTicks() - .scheduleTick(pos, nextFluidState.getType(), world.getRandom() - .nextInt(5)); + world.scheduleTick(pos, nextFluidState.getType(), world.getRandom() + .nextInt(5)); }); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidSplashPacket.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidSplashPacket.java index 32888b979..f6bd734b0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidSplashPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidSplashPacket.java @@ -12,7 +12,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class FluidSplashPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/particle/FluidParticleData.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/particle/FluidParticleData.java index 957243ae5..364725b28 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/particle/FluidParticleData.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/particle/FluidParticleData.java @@ -1,7 +1,5 @@ package com.simibubi.create.content.contraptions.fluids.particle; -import java.util.Optional; - import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.serialization.Codec; @@ -10,10 +8,8 @@ import com.simibubi.create.AllParticleTypes; import com.simibubi.create.content.contraptions.particle.ICustomParticleData; import net.minecraft.client.particle.ParticleProvider; -import net.minecraft.core.Registry; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleType; -import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.level.material.Fluids; import net.minecraftforge.api.distmarker.Dist; @@ -57,29 +53,18 @@ public class FluidParticleData implements ParticleOptions, ICustomParticleData FLUID_CODEC = RecordCodecBuilder.create(i -> i.group( - Registry.FLUID.fieldOf("FluidName") - .forGetter(FluidStack::getFluid), - Codec.INT.fieldOf("Amount") - .forGetter(FluidStack::getAmount), - CompoundTag.CODEC.optionalFieldOf("tag") - .forGetter((fs) -> { - return Optional.ofNullable(fs.getTag()); - })) - .apply(i, (f, a, t) -> new FluidStack(f, a, t.orElse(null)))); - public static final Codec CODEC = RecordCodecBuilder.create(i -> i - .group(FLUID_CODEC.fieldOf("fluid") + .group(FluidStack.CODEC.fieldOf("fluid") .forGetter(p -> p.fluid)) .apply(i, fs -> new FluidParticleData(AllParticleTypes.FLUID_PARTICLE.get(), fs))); public static final Codec BASIN_CODEC = RecordCodecBuilder.create(i -> i - .group(FLUID_CODEC.fieldOf("fluid") + .group(FluidStack.CODEC.fieldOf("fluid") .forGetter(p -> p.fluid)) .apply(i, fs -> new FluidParticleData(AllParticleTypes.BASIN_FLUID.get(), fs))); public static final Codec DRIP_CODEC = RecordCodecBuilder.create(i -> i - .group(FLUID_CODEC.fieldOf("fluid") + .group(FluidStack.CODEC.fieldOf("fluid") .forGetter(p -> p.fluid)) .apply(i, fs -> new FluidParticleData(AllParticleTypes.FLUID_DRIP.get(), fs))); diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/AxisPipeBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/AxisPipeBlock.java index 1057ce238..6f57c8e3a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/AxisPipeBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/AxisPipeBlock.java @@ -27,7 +27,6 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.level.TickPriority; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.RotatedPillarBlock; @@ -37,6 +36,7 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.ticks.TickPriority; public class AxisPipeBlock extends RotatedPillarBlock implements IWrenchableWithBracket, IAxisPipe { @@ -77,12 +77,11 @@ public class AxisPipeBlock extends RotatedPillarBlock implements IWrenchableWith if (world.isClientSide) return; if (state != oldState) - world.getBlockTicks() - .scheduleTick(pos, this, 1, TickPriority.HIGH); + world.scheduleTick(pos, this, 1, TickPriority.HIGH); } @Override - public ItemStack getPickBlock(BlockState state, HitResult target, BlockGetter world, BlockPos pos, + public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) { return AllBlocks.FLUID_PIPE.asStack(); } @@ -96,8 +95,7 @@ public class AxisPipeBlock extends RotatedPillarBlock implements IWrenchableWith return; if (!isOpenAt(state, d)) return; - world.getBlockTicks() - .scheduleTick(pos, this, 1, TickPriority.HIGH); + world.scheduleTick(pos, this, 1, TickPriority.HIGH); } public static boolean isOpenAt(BlockState state, Direction d) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/EncasedPipeBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/EncasedPipeBlock.java index 5a81fc5cb..63f5ac61b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/EncasedPipeBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/EncasedPipeBlock.java @@ -30,7 +30,6 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.TickPriority; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.PipeBlock; import net.minecraft.world.level.block.entity.BlockEntity; @@ -39,6 +38,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition.Builder; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.phys.HitResult; +import net.minecraft.world.ticks.TickPriority; public class EncasedPipeBlock extends Block implements IWrenchable, ISpecialBlockItemRequirement, ITE { @@ -72,12 +72,11 @@ public class EncasedPipeBlock extends Block implements IWrenchable, ISpecialBloc @Override public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean isMoving) { if (!world.isClientSide && state != oldState) - world.getBlockTicks() - .scheduleTick(pos, this, 1, TickPriority.HIGH); + world.scheduleTick(pos, this, 1, TickPriority.HIGH); } @Override - public ItemStack getPickBlock(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) { + public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) { return AllBlocks.FLUID_PIPE.asStack(); } @@ -90,8 +89,7 @@ public class EncasedPipeBlock extends Block implements IWrenchable, ISpecialBloc return; if (!state.getValue(FACING_TO_PROPERTY_MAP.get(d))) return; - world.getBlockTicks() - .scheduleTick(pos, this, 1, TickPriority.HIGH); + world.scheduleTick(pos, this, 1, TickPriority.HIGH); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeBlock.java index 77760eaf1..eef7a5863 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeBlock.java @@ -33,7 +33,6 @@ import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.level.TickPriority; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.PipeBlock; @@ -47,6 +46,7 @@ import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.ticks.TickPriority; public class FluidPipeBlock extends PipeBlock implements SimpleWaterloggedBlock, IWrenchableWithBracket, ITE { @@ -138,8 +138,7 @@ public class FluidPipeBlock extends PipeBlock implements SimpleWaterloggedBlock, if (world.isClientSide) return; if (state != oldState) - world.getBlockTicks() - .scheduleTick(pos, this, 1, TickPriority.HIGH); + world.scheduleTick(pos, this, 1, TickPriority.HIGH); } @Override @@ -151,8 +150,7 @@ public class FluidPipeBlock extends PipeBlock implements SimpleWaterloggedBlock, return; if (!isOpenAt(state, d)) return; - world.getBlockTicks() - .scheduleTick(pos, this, 1, TickPriority.HIGH); + world.scheduleTick(pos, this, 1, TickPriority.HIGH); } @Override @@ -242,11 +240,9 @@ public class FluidPipeBlock extends PipeBlock implements SimpleWaterloggedBlock, public BlockState updateShape(BlockState state, Direction direction, BlockState neighbourState, LevelAccessor world, BlockPos pos, BlockPos neighbourPos) { if (state.getValue(BlockStateProperties.WATERLOGGED)) - world.getLiquidTicks() - .scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); if (isOpenAt(state, direction) && neighbourState.hasProperty(BlockStateProperties.WATERLOGGED)) - world.getBlockTicks() - .scheduleTick(pos, this, 1, TickPriority.HIGH); + world.scheduleTick(pos, this, 1, TickPriority.HIGH); return updateBlockState(state, direction, direction.getOpposite(), world, pos); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveBlock.java index 6a1ad53b1..a9bed692f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveBlock.java @@ -19,7 +19,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; -import net.minecraft.world.level.TickPriority; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; @@ -28,6 +27,7 @@ import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.ticks.TickPriority; public class FluidValveBlock extends DirectionalAxisKineticBlock implements IAxisPipe, ITE { @@ -102,8 +102,7 @@ public class FluidValveBlock extends DirectionalAxisKineticBlock implements IAxi if (world.isClientSide) return; if (state != oldState) - world.getBlockTicks() - .scheduleTick(pos, this, 1, TickPriority.HIGH); + world.scheduleTick(pos, this, 1, TickPriority.HIGH); } @Override @@ -115,8 +114,7 @@ public class FluidValveBlock extends DirectionalAxisKineticBlock implements IAxi return; if (!isOpenAt(state, d)) return; - world.getBlockTicks() - .scheduleTick(pos, this, 1, TickPriority.HIGH); + world.scheduleTick(pos, this, 1, TickPriority.HIGH); } public static boolean isOpenAt(BlockState state, Direction d) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/SmartFluidPipeBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/SmartFluidPipeBlock.java index b19c68534..f4ea043fb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/SmartFluidPipeBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/SmartFluidPipeBlock.java @@ -19,7 +19,6 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; -import net.minecraft.world.level.TickPriority; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -29,6 +28,7 @@ import net.minecraft.world.level.block.state.properties.AttachFace; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.ticks.TickPriority; public class SmartFluidPipeBlock extends FaceAttachedHorizontalDirectionalBlock implements ITE, IAxisPipe, IWrenchable { @@ -101,8 +101,7 @@ public class SmartFluidPipeBlock extends FaceAttachedHorizontalDirectionalBlock if (world.isClientSide) return; if (state != oldState) - world.getBlockTicks() - .scheduleTick(pos, this, 1, TickPriority.HIGH); + world.scheduleTick(pos, this, 1, TickPriority.HIGH); } @Override @@ -114,8 +113,7 @@ public class SmartFluidPipeBlock extends FaceAttachedHorizontalDirectionalBlock return; if (!isOpenAt(state, d)) return; - world.getBlockTicks() - .scheduleTick(pos, this, 1, TickPriority.HIGH); + world.scheduleTick(pos, this, 1, TickPriority.HIGH); } public static boolean isOpenAt(BlockState state, Direction d) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java index 40a8ad53b..ea4c78eef 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java @@ -15,6 +15,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pis import com.simibubi.create.content.contraptions.components.structureMovement.piston.PistonExtensionPoleBlock; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.config.CClient; +import com.simibubi.create.foundation.gui.RemovedGuiUtils; import com.simibubi.create.foundation.gui.Theme; import com.simibubi.create.foundation.gui.element.GuiGameElement; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBox; @@ -41,7 +42,6 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraftforge.client.gui.ForgeIngameGui; import net.minecraftforge.client.gui.IIngameOverlay; -import net.minecraftforge.fmlclient.gui.GuiUtils; public class GoggleOverlayRenderer { @@ -195,7 +195,7 @@ public class GoggleOverlayRenderer { colorBorderBot.scaleAlpha(fade); } - GuiUtils.drawHoveringText(poseStack, tooltip, posX, posY, tooltipScreen.width, tooltipScreen.height, -1, + RemovedGuiUtils.drawHoveringText(poseStack, tooltip, posX, posY, tooltipScreen.width, tooltipScreen.height, -1, colorBackground.getRGB(), colorBorderTop.getRGB(), colorBorderBot.getRGB(), mc.font); ItemStack item = AllItems.GOGGLES.asStack(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinBlock.java b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinBlock.java index fe661928c..cb0c46ad8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinBlock.java @@ -167,8 +167,7 @@ public class BasinBlock extends Block implements ITE, IWrenchab @Override public VoxelShape getCollisionShape(BlockState state, BlockGetter reader, BlockPos pos, CollisionContext ctx) { - if (ctx instanceof EntityCollisionContext && ((EntityCollisionContext) ctx).getEntity() - .orElse(null) instanceof ItemEntity) + if (ctx instanceof EntityCollisionContext && ((EntityCollisionContext) ctx).getEntity() instanceof ItemEntity) return AllShapes.BASIN_COLLISION_SHAPE; return getShape(state, reader, pos, ctx); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerBlockItem.java b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerBlockItem.java index db5e2be69..ca66886c5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerBlockItem.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerBlockItem.java @@ -16,7 +16,8 @@ import net.minecraft.core.particles.ParticleTypes; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; -import net.minecraft.util.random.WeightedRandomList; +import net.minecraft.util.random.SimpleWeightedRandomList; +import net.minecraft.util.random.WeightedEntry.Wrapper; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.EntityType; @@ -89,18 +90,22 @@ public class BlazeBurnerBlockItem extends BlockItem { return super.useOn(context); BaseSpawner spawner = ((SpawnerBlockEntity) te).getSpawner(); - WeightedRandomList spawnPotentials = + SimpleWeightedRandomList spawnPotentials = ObfuscationReflectionHelper.getPrivateValue(BaseSpawner.class, spawner, "f_45443_"); // spawnPotentials - List possibleSpawns = spawnPotentials.unwrap(); - if (spawnPotentials.isEmpty()) { + + List possibleSpawns = spawnPotentials.unwrap() + .stream() + .map(Wrapper::getData) + .toList(); + + if (possibleSpawns.isEmpty()) { possibleSpawns = new ArrayList<>(); - possibleSpawns - .add(ObfuscationReflectionHelper.getPrivateValue(BaseSpawner.class, spawner, "f_45444_")); // nextSpawnData + possibleSpawns.add(ObfuscationReflectionHelper.getPrivateValue(BaseSpawner.class, spawner, "f_45444_")); // nextSpawnData } ResourceLocation blazeId = EntityType.BLAZE.getRegistryName(); for (SpawnData e : possibleSpawns) { - ResourceLocation spawnerEntityId = new ResourceLocation(e.getTag() + ResourceLocation spawnerEntityId = new ResourceLocation(e.entityToSpawn() .getString("id")); if (!spawnerEntityId.equals(blazeId)) continue; @@ -117,7 +122,8 @@ public class BlazeBurnerBlockItem extends BlockItem { } @Override - public InteractionResult interactLivingEntity(ItemStack heldItem, Player player, LivingEntity entity, InteractionHand hand) { + public InteractionResult interactLivingEntity(ItemStack heldItem, Player player, LivingEntity entity, + InteractionHand hand) { if (hasCapturedBlaze()) return InteractionResult.PASS; if (!(entity instanceof Blaze)) @@ -141,7 +147,8 @@ public class BlazeBurnerBlockItem extends BlockItem { player.setItemInHand(hand, filled); return; } - player.getInventory().placeItemBackInInventory(filled); + player.getInventory() + .placeItemBackInInventory(filled); } private void spawnCaptureEffects(Level world, Vec3 vec) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/LitBlazeBurnerBlock.java b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/LitBlazeBurnerBlock.java index 47770920d..af575c802 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/LitBlazeBurnerBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/LitBlazeBurnerBlock.java @@ -71,7 +71,7 @@ public class LitBlazeBurnerBlock extends Block implements IWrenchable { } @Override - public ItemStack getPickBlock(BlockState state, HitResult target, BlockGetter world, BlockPos pos, + public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) { return AllItems.EMPTY_BLAZE_BURNER.asStack(); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftBlock.java index 5e3eb88ab..c7c15ce82 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftBlock.java @@ -61,8 +61,7 @@ public class SequencedGearshiftBlock extends HorizontalAxisKineticBlock implemen return; if (!worldIn.getBlockTicks() .willTickThisTick(pos, this)) - worldIn.getBlockTicks() - .scheduleTick(pos, this, 0); + worldIn.scheduleTick(pos, this, 0); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java index c7f5a5f4b..5dfddd725 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java @@ -130,7 +130,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE { - if (!((EntityCollisionContext) context).getEntity() - .isPresent()) + Entity entity = ((EntityCollisionContext) context).getEntity(); + if (entity == null) return shape; BeltTileEntity controller = te.getControllerTE(); if (controller == null) return shape; - if (controller.passengers == null - || !controller.passengers.containsKey(((EntityCollisionContext) context).getEntity() - .get())) + if (controller.passengers == null || !controller.passengers.containsKey(entity)) return BeltShapes.getCollisionShape(state); return shape; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/AbstractShaftBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/AbstractShaftBlock.java index 0d07955e6..57289662f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/AbstractShaftBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/AbstractShaftBlock.java @@ -84,10 +84,8 @@ public abstract class AbstractShaftBlock extends RotatedPillarKineticBlock @Override public BlockState updateShape(BlockState state, Direction direction, BlockState neighbourState, LevelAccessor world, BlockPos pos, BlockPos neighbourPos) { - if (state.getValue(BlockStateProperties.WATERLOGGED)) { - world.getLiquidTicks() - .scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); - } + if (state.getValue(BlockStateProperties.WATERLOGGED)) + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); return state; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedCogwheelBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedCogwheelBlock.java index d9cd6e005..275338699 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedCogwheelBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedCogwheelBlock.java @@ -71,13 +71,13 @@ public class EncasedCogwheelBlock extends RotatedPillarKineticBlock public void fillItemCategory(CreativeModeTab pTab, NonNullList pItems) {} @Override - public ItemStack getPickBlock(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) { + public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) { if (target instanceof BlockHitResult) return ((BlockHitResult) target).getDirection() .getAxis() != getRotationAxis(state) ? isLarge ? AllBlocks.LARGE_COGWHEEL.asStack() : AllBlocks.COGWHEEL.asStack() : getCasing().asStack(); - return super.getPickBlock(state, target, world, pos, player); + return super.getCloneItemStack(state, target, world, pos, player); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedShaftBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedShaftBlock.java index e47fc0b95..8552663dc 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedShaftBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedShaftBlock.java @@ -62,11 +62,11 @@ public class EncasedShaftBlock extends AbstractEncasedShaftBlock } @Override - public ItemStack getPickBlock(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) { + public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) { if (target instanceof BlockHitResult) return ((BlockHitResult) target).getDirection() .getAxis() == getRotationAxis(state) ? AllBlocks.SHAFT.asStack() : getCasing().asStack(); - return super.getPickBlock(state, target, world, pos, player); + return super.getCloneItemStack(state, target, world, pos, player); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/GearshiftBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/GearshiftBlock.java index 2114288ef..099d2c3f8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/GearshiftBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/GearshiftBlock.java @@ -11,7 +11,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.Level; -import net.minecraft.world.level.TickPriority; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -19,6 +18,7 @@ import net.minecraft.world.level.block.state.BlockState; 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.ticks.TickPriority; public class GearshiftBlock extends AbstractEncasedShaftBlock implements ITE { @@ -72,7 +72,7 @@ public class GearshiftBlock extends AbstractEncasedShaftBlock implements ITE true) + at.getY() + dummyHeight, at.getZ() + 0.5 + w2))) .allMatch(VoxelShape::isEmpty); } @@ -105,7 +103,7 @@ public class SoulPulseEffect { .distanceTo(VecHelper.getCenterOf(at)))) >= distance ? new SoulParticle.PerimeterData() : new ExpandingPerimeterData(), p.x + 0.5, p.y + 0.5, p.z + 0.5, 0, 0, 0); - if (world.getBrightness(LightLayer.BLOCK, at) < 8) { + if (SoulPulseEffect.isDark(world, at)) { world.addAlwaysVisibleParticle(new SoulParticle.Data(), p.x + 0.5, p.y + 0.5, p.z + 0.5, 0, 0, 0); world.addParticle(new SoulBaseParticle.Data(), p.x + 0.5, p.y + 0.01, p.z + 0.5, 0, 0, 0); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/bell/SoulPulseEffectPacket.java b/src/main/java/com/simibubi/create/content/curiosities/bell/SoulPulseEffectPacket.java index 3a97be850..57d8bbcce 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/bell/SoulPulseEffectPacket.java +++ b/src/main/java/com/simibubi/create/content/curiosities/bell/SoulPulseEffectPacket.java @@ -7,7 +7,7 @@ import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.core.BlockPos; import net.minecraft.network.FriendlyByteBuf; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; public class SoulPulseEffectPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/ConfigureSymmetryWandPacket.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/ConfigureSymmetryWandPacket.java index 07c44a3e0..f62e4eca1 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/ConfigureSymmetryWandPacket.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/ConfigureSymmetryWandPacket.java @@ -9,7 +9,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class ConfigureSymmetryWandPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryEffectPacket.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryEffectPacket.java index ee33080a9..2f084fca5 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryEffectPacket.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryEffectPacket.java @@ -12,7 +12,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class SymmetryEffectPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryHandler.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryHandler.java index db68cdb5a..2a09fc523 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryHandler.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryHandler.java @@ -28,7 +28,7 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.client.event.RenderLevelLastEvent; import net.minecraftforge.client.model.data.EmptyModelData; import net.minecraftforge.event.TickEvent.ClientTickEvent; import net.minecraftforge.event.TickEvent.Phase; @@ -82,7 +82,7 @@ public class SymmetryHandler { @OnlyIn(Dist.CLIENT) @SubscribeEvent - public static void render(RenderWorldLastEvent event) { + public static void render(RenderLevelLastEvent event) { Minecraft mc = Minecraft.getInstance(); LocalPlayer player = mc.player; @@ -109,7 +109,7 @@ public class SymmetryHandler { Camera info = mc.gameRenderer.getMainCamera(); Vec3 view = info.getPosition(); - PoseStack ms = event.getMatrixStack(); + PoseStack ms = event.getPoseStack(); ms.pushPose(); ms.translate(-view.x(), -view.y(), -view.z()); ms.translate(pos.getX(), pos.getY(), pos.getZ()); diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandItem.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandItem.java index 44356b417..4758635e8 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandItem.java @@ -49,7 +49,7 @@ import net.minecraftforge.client.IItemRenderProperties; import net.minecraftforge.common.util.BlockSnapshot; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; public class SymmetryWandItem extends Item { diff --git a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxBlock.java b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxBlock.java index 94a06e2a7..6257a88df 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxBlock.java +++ b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxBlock.java @@ -41,7 +41,7 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.fmllegacy.network.NetworkHooks; +import net.minecraftforge.network.NetworkHooks; public class ToolboxBlock extends HorizontalDirectionalBlock implements SimpleWaterloggedBlock, ITE { @@ -130,8 +130,7 @@ public class ToolboxBlock extends HorizontalDirectionalBlock implements SimpleWa public BlockState updateShape(BlockState state, Direction direction, BlockState neighbourState, LevelAccessor world, BlockPos pos, BlockPos neighbourPos) { if (state.getValue(WATERLOGGED)) - world.getLiquidTicks() - .scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); return state; } diff --git a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxDisposeAllPacket.java b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxDisposeAllPacket.java index cf4a6d4c8..ebe74043e 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxDisposeAllPacket.java +++ b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxDisposeAllPacket.java @@ -14,7 +14,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; import net.minecraftforge.items.ItemHandlerHelper; public class ToolboxDisposeAllPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxEquipPacket.java b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxEquipPacket.java index 5426ae8e9..4311c215e 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxEquipPacket.java +++ b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxEquipPacket.java @@ -12,7 +12,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; import net.minecraftforge.items.ItemHandlerHelper; public class ToolboxEquipPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxHandler.java b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxHandler.java index bf0c03728..d83fa6462 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxHandler.java +++ b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxHandler.java @@ -20,7 +20,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; public class ToolboxHandler { diff --git a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxHandlerClient.java b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxHandlerClient.java index 931082e95..3bcd6701f 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxHandlerClient.java +++ b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxHandlerClient.java @@ -69,7 +69,7 @@ public class ToolboxHandlerClient { BlockState state = level.getBlockState(pos); if (state.getMaterial() == Material.AIR) return false; - result = state.getPickBlock(hitResult, level, pos, player); + result = state.getCloneItemStack(hitResult, level, pos, player); } else if (hitResult.getType() == HitResult.Type.ENTITY) { Entity entity = ((EntityHitResult) hitResult).getEntity(); diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintAssignCompleteRecipePacket.java b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintAssignCompleteRecipePacket.java index 047e59018..ec87a05c6 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintAssignCompleteRecipePacket.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintAssignCompleteRecipePacket.java @@ -7,7 +7,7 @@ import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class BlueprintAssignCompleteRecipePacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintEntity.java b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintEntity.java index dd8928408..7793550c4 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintEntity.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintEntity.java @@ -62,12 +62,12 @@ import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.fmllegacy.common.registry.IEntityAdditionalSpawnData; -import net.minecraftforge.fmllegacy.hooks.BasicEventHooks; -import net.minecraftforge.fmllegacy.network.NetworkHooks; +import net.minecraftforge.entity.IEntityAdditionalSpawnData; +import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.wrapper.InvWrapper; +import net.minecraftforge.network.NetworkHooks; public class BlueprintEntity extends HangingEntity implements IEntityAdditionalSpawnData, ISpecialEntityItemRequirement, ISyncPersistentData, IInteractionChecker { @@ -399,7 +399,7 @@ public class BlueprintEntity extends HangingEntity } else { amountCrafted += result.getCount(); result.onCraftedBy(player.level, player, 1); - BasicEventHooks.firePlayerCraftingEvent(player, result, craftingInventory); + ForgeEventFactory.firePlayerCraftingEvent(player, result, craftingInventory); NonNullList nonnulllist = level.getRecipeManager() .getRemainingItemsFor(RecipeType.CRAFTING, craftingInventory, level); diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintItem.java b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintItem.java index 6e6ad24fe..bd5eb9ecf 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintItem.java @@ -28,7 +28,7 @@ import net.minecraft.world.item.crafting.Ingredient.Value; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.ShapedRecipe; import net.minecraft.world.level.Level; -import net.minecraftforge.common.crafting.StackList; +import net.minecraftforge.common.crafting.MultiItemValue; import net.minecraftforge.fml.util.ObfuscationReflectionHelper; import net.minecraftforge.items.ItemStackHandler; @@ -133,7 +133,7 @@ public class BlueprintItem extends Item { return filterItem; } - if (itemList instanceof StackList) { + if (itemList instanceof MultiItemValue) { ItemStack result = AllItems.FILTER.asStack(); ItemStackHandler filterItems = FilterItem.getFilterItems(result); int i = 0; diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripInteractionPacket.java b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripInteractionPacket.java index f4f18d330..cf57bd455 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripInteractionPacket.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripInteractionPacket.java @@ -10,7 +10,7 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.ForgeMod; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class ExtendoGripInteractionPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripRenderHandler.java b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripRenderHandler.java index c7956562a..fbfd0735b 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripRenderHandler.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripRenderHandler.java @@ -64,7 +64,7 @@ public class ExtendoGripRenderHandler { if (notInOffhand && !AllItems.EXTENDO_GRIP.isIn(heldItem)) return; - PoseStack ms = event.getMatrixStack(); + PoseStack ms = event.getPoseStack(); TransformStack msr = TransformStack.cast(ms); AbstractClientPlayer abstractclientplayerentity = mc.player; RenderSystem.setShaderTexture(0, abstractclientplayerentity.getSkinTextureLocation()); @@ -99,9 +99,11 @@ public class ExtendoGripRenderHandler { PlayerRenderer playerrenderer = (PlayerRenderer) mc.getEntityRenderDispatcher() .getRenderer(player); if (rightHand) - playerrenderer.renderRightHand(event.getMatrixStack(), event.getBuffers(), event.getLight(), player); + playerrenderer.renderRightHand(event.getPoseStack(), event.getMultiBufferSource(), + event.getPackedLight(), player); else - playerrenderer.renderLeftHand(event.getMatrixStack(), event.getBuffers(), event.getLight(), player); + playerrenderer.renderLeftHand(event.getPoseStack(), event.getMultiBufferSource(), + event.getPackedLight(), player); ms.popPose(); // Render gun @@ -111,7 +113,7 @@ public class ExtendoGripRenderHandler { TransformType transform = rightHand ? TransformType.FIRST_PERSON_RIGHT_HAND : TransformType.FIRST_PERSON_LEFT_HAND; firstPersonRenderer.renderItem(mc.player, notInOffhand ? heldItem : offhandItem, transform, !rightHand, - event.getMatrixStack(), event.getBuffers(), event.getLight()); + event.getPoseStack(), event.getMultiBufferSource(), event.getPackedLight()); if (!notInOffhand) { ForgeHooksClient.handleCameraTransforms(ms, mc.getItemRenderer() @@ -126,8 +128,8 @@ public class ExtendoGripRenderHandler { ms.scale(1.25f, 1.25f, 1.25f); } - firstPersonRenderer.renderItem(mc.player, heldItem, transform, !rightHand, event.getMatrixStack(), - event.getBuffers(), event.getLight()); + firstPersonRenderer.renderItem(mc.player, heldItem, transform, !rightHand, event.getPoseStack(), + event.getMultiBufferSource(), event.getPackedLight()); } ms.popPose(); diff --git a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java index 7ccf9f66a..23a9efd37 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java +++ b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java @@ -33,9 +33,9 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.fmllegacy.common.registry.IEntityAdditionalSpawnData; -import net.minecraftforge.fmllegacy.network.NetworkHooks; +import net.minecraftforge.entity.IEntityAdditionalSpawnData; import net.minecraftforge.items.ItemHandlerHelper; +import net.minecraftforge.network.NetworkHooks; public class PotatoProjectileEntity extends AbstractHurtingProjectile implements IEntityAdditionalSpawnData { diff --git a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileTypeManager.java b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileTypeManager.java index cd89349d0..6fe7bdb1e 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileTypeManager.java +++ b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileTypeManager.java @@ -20,8 +20,8 @@ import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; -import net.minecraftforge.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.NetworkEvent.Context; +import net.minecraftforge.network.PacketDistributor; import net.minecraftforge.registries.IRegistryDelegate; public class PotatoProjectileTypeManager { diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/ConfigureZapperPacket.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/ConfigureZapperPacket.java index 25c6e4d59..99c842730 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/ConfigureZapperPacket.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/ConfigureZapperPacket.java @@ -8,7 +8,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public abstract class ConfigureZapperPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/ShootGadgetPacket.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/ShootGadgetPacket.java index 09cfb41e5..e5a7384ef 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/ShootGadgetPacket.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/ShootGadgetPacket.java @@ -11,7 +11,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public abstract class ShootGadgetPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/ShootableGadgetItemMethods.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/ShootableGadgetItemMethods.java index c672d2a5b..85cdf59d0 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/ShootableGadgetItemMethods.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/ShootableGadgetItemMethods.java @@ -11,7 +11,7 @@ import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; public class ShootableGadgetItemMethods { diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/ShootableGadgetRenderHandler.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/ShootableGadgetRenderHandler.java index 14a38d667..4c70d5dcc 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/ShootableGadgetRenderHandler.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/ShootableGadgetRenderHandler.java @@ -11,7 +11,6 @@ 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.client.renderer.texture.TextureManager; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.HumanoidArm; @@ -77,14 +76,13 @@ public abstract class ShootableGadgetRenderHandler { Minecraft mc = Minecraft.getInstance(); AbstractClientPlayer player = mc.player; - TextureManager textureManager = mc.getTextureManager(); PlayerRenderer playerrenderer = (PlayerRenderer) mc.getEntityRenderDispatcher() .getRenderer(player); ItemInHandRenderer firstPersonRenderer = mc.getItemInHandRenderer(); - PoseStack ms = event.getMatrixStack(); - MultiBufferSource buffer = event.getBuffers(); - int light = event.getLight(); + PoseStack ms = event.getPoseStack(); + MultiBufferSource buffer = event.getMultiBufferSource(); + int light = event.getPackedLight(); float pt = event.getPartialTicks(); boolean rightHand = event.getHand() == InteractionHand.MAIN_HAND ^ mc.player.getMainArm() == HumanoidArm.LEFT; diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperInteractionHandler.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperInteractionHandler.java index 9be9268a4..84c37ddf9 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperInteractionHandler.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperInteractionHandler.java @@ -80,7 +80,7 @@ public class ZapperInteractionHandler { CompoundTag data = null; BlockEntity tile = player.level.getBlockEntity(pos); if (tile != null) { - data = tile.save(new CompoundTag()); + data = tile.saveWithFullMetadata(); data.remove("x"); data.remove("y"); data.remove("z"); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/chute/SmartChuteBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/chute/SmartChuteBlock.java index 27eb375b5..92f23a34c 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/chute/SmartChuteBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/chute/SmartChuteBlock.java @@ -34,8 +34,7 @@ public class SmartChuteBlock extends AbstractChuteBlock { return; if (!worldIn.getBlockTicks() .willTickThisTick(pos, this)) - worldIn.getBlockTicks() - .scheduleTick(pos, this, 0); + worldIn.scheduleTick(pos, this, 0); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorElytraPacket.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorElytraPacket.java index 4b0ec1349..f2058d433 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorElytraPacket.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorElytraPacket.java @@ -9,7 +9,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class EjectorElytraPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorPlacementPacket.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorPlacementPacket.java index 0fc432243..3b56b438f 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorPlacementPacket.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorPlacementPacket.java @@ -12,7 +12,7 @@ import net.minecraft.server.level.ServerPlayer; 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.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class EjectorPlacementPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/diodes/PoweredLatchBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/diodes/PoweredLatchBlock.java index 7950696c9..60119b98a 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/diodes/PoweredLatchBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/diodes/PoweredLatchBlock.java @@ -10,13 +10,13 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionResult; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.TickPriority; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.RedStoneWireBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition.Builder; import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.ticks.TickPriority; public class PoweredLatchBlock extends ToggleLatchBlock { @@ -49,8 +49,7 @@ public class PoweredLatchBlock extends ToggleLatchBlock { .willTickThisTick(pos, this)) return; if (back != shouldBack || side != shouldSide) - worldIn.getBlockTicks() - .scheduleTick(pos, this, this.getDelay(state), tickpriority); + worldIn.scheduleTick(pos, this, this.getDelay(state), tickpriority); } protected boolean isPoweredOnSides(Level worldIn, BlockPos pos, BlockState state) { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/AbstractFunnelBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/AbstractFunnelBlock.java index 2f2221346..4726ef2b7 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/AbstractFunnelBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/AbstractFunnelBlock.java @@ -73,8 +73,7 @@ public abstract class AbstractFunnelBlock extends Block implements ITE 0) { turnOffTicks--; if (turnOffTicks == 0) - level.getBlockTicks() - .scheduleTick(worldPosition, state.getBlock(), 1); + level.scheduleTick(worldPosition, state.getBlock(), 1); } if (!isActive()) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeBlock.java index cec1eaff0..9d4f93c04 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeBlock.java @@ -144,12 +144,12 @@ public class NixieTubeBlock extends HorizontalDirectionalBlock } @Override - public ItemStack getPickBlock(BlockState state, HitResult target, BlockGetter world, BlockPos pos, + public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) { if (color != DyeColor.ORANGE) return AllBlocks.ORANGE_NIXIE_TUBE.get() - .getPickBlock(state, target, world, pos, player); - return super.getPickBlock(state, target, world, pos, player); + .getCloneItemStack(state, target, world, pos, player); + return super.getCloneItemStack(state, target, world, pos, player); } @Override @@ -171,8 +171,7 @@ public class NixieTubeBlock extends HorizontalDirectionalBlock return; if (!worldIn.getBlockTicks() .willTickThisTick(pos, this)) - worldIn.getBlockTicks() - .scheduleTick(pos, this, 0); + worldIn.scheduleTick(pos, this, 0); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneLinkBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneLinkBlock.java index 5a247a30b..4ac22be1f 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneLinkBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneLinkBlock.java @@ -57,8 +57,7 @@ public class RedstoneLinkBlock extends WrenchableDirectionalBlock implements ITE if (!worldIn.getBlockTicks() .willTickThisTick(pos, this)) - worldIn.getBlockTicks() - .scheduleTick(pos, this, 0); + worldIn.scheduleTick(pos, this, 0); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java index 13ab3aab0..4d8d1a23e 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java @@ -13,12 +13,11 @@ import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.util.Mth; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.TickList; -import net.minecraft.world.level.TickPriority; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.ticks.TickPriority; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandler; @@ -151,10 +150,10 @@ public class StockpileSwitchTileEntity extends SmartTileEntity { } protected void scheduleBlockTick() { - TickList blockTicks = level.getBlockTicks(); Block block = getBlockState().getBlock(); - if (!blockTicks.willTickThisTick(worldPosition, block)) - blockTicks.scheduleTick(worldPosition, block, 2, TickPriority.NORMAL); + if (!level.getBlockTicks() + .willTickThisTick(worldPosition, block)) + level.scheduleTick(worldPosition, block, 2, TickPriority.NORMAL); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/item/LecternControllerBlock.java b/src/main/java/com/simibubi/create/content/logistics/item/LecternControllerBlock.java index 29c24ed99..7df57cf9d 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/LecternControllerBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/LecternControllerBlock.java @@ -94,8 +94,8 @@ public class LecternControllerBlock extends LecternBlock } @Override - public ItemStack getPickBlock(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) { - return Blocks.LECTERN.getPickBlock(state, target, world, pos, player); + public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) { + return Blocks.LECTERN.getCloneItemStack(state, target, world, pos, player); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerItem.java b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerItem.java index b30d8fae4..a53911a73 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerItem.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerItem.java @@ -32,7 +32,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.IItemRenderProperties; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fmllegacy.network.NetworkHooks; +import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.items.ItemStackHandler; public class LinkedControllerItem extends Item implements MenuProvider { diff --git a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerPacketBase.java b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerPacketBase.java index b4aab2728..2f1cb8d94 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerPacketBase.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerPacketBase.java @@ -10,7 +10,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public abstract class LinkedControllerPacketBase extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java index b1a6ebf73..f06e71732 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java @@ -139,7 +139,7 @@ public abstract class AbstractFilterScreen ex } private void fillToolTip(IconButton button, Component tooltip) { - if (!button.isHovered()) + if (!button.isHoveredOrFocused()) return; List tip = button.getToolTip(); tip.addAll(TooltipHelper.cutTextComponent(tooltip, GRAY, GRAY)); diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterItem.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterItem.java index dcde5ef04..36393fa45 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterItem.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterItem.java @@ -36,7 +36,7 @@ import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fmllegacy.network.NetworkHooks; +import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemStackHandler; diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterScreenPacket.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterScreenPacket.java index 4f5c3a0fd..8b1b5440c 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterScreenPacket.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterScreenPacket.java @@ -8,7 +8,7 @@ import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class FilterScreenPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/palettes/AllPaletteBlocks.java b/src/main/java/com/simibubi/create/content/palettes/AllPaletteBlocks.java index 95a89a389..9adfc2ff9 100644 --- a/src/main/java/com/simibubi/create/content/palettes/AllPaletteBlocks.java +++ b/src/main/java/com/simibubi/create/content/palettes/AllPaletteBlocks.java @@ -30,7 +30,7 @@ import net.minecraftforge.common.Tags; public class AllPaletteBlocks { private static final CreateRegistrate REGISTRATE = Create.registrate() - .itemGroup(() -> Create.PALETTES_CREATIVE_TAB) + .creativeModeTab(() -> Create.PALETTES_CREATIVE_TAB) .startSection(AllSections.PALETTES); // Windows and Glass diff --git a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java index 2fd71b21b..80c7bc4d9 100644 --- a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java +++ b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java @@ -14,17 +14,15 @@ import com.simibubi.create.foundation.utility.worldWrappers.WrappedChunkProvider import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld; import net.minecraft.core.BlockPos; -import net.minecraft.data.worldgen.biome.Biomes; +import net.minecraft.data.worldgen.biome.OverworldBiomes; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.EmptyTickList; import net.minecraft.world.level.Level; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.ServerLevelAccessor; -import net.minecraft.world.level.TickList; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.AbstractFurnaceBlock; import net.minecraft.world.level.block.Block; @@ -37,6 +35,8 @@ 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.phys.AABB; +import net.minecraft.world.ticks.BlackholeTickAccess; +import net.minecraft.world.ticks.LevelTickAccess; public class SchematicWorld extends WrappedWorld implements ServerLevelAccessor { @@ -45,7 +45,7 @@ public class SchematicWorld extends WrappedWorld implements ServerLevelAccessor protected List renderedTileEntities; protected List entities; protected BoundingBox bounds; - + public BlockPos anchor; public boolean renderMode; @@ -54,7 +54,12 @@ public class SchematicWorld extends WrappedWorld implements ServerLevelAccessor } public SchematicWorld(BlockPos anchor, Level original) { - super(original, new WrappedChunkProvider()); + this(anchor, original,new WrappedChunkProvider()); + } + + public SchematicWorld(BlockPos anchor, Level original, WrappedChunkProvider provider) { + super(original, provider); + provider.setFallbackWorld(this); this.blocks = new HashMap<>(); this.tileEntities = new HashMap<>(); this.bounds = new BoundingBox(BlockPos.ZERO); @@ -137,13 +142,23 @@ public class SchematicWorld extends WrappedWorld implements ServerLevelAccessor @Override public Biome getBiome(BlockPos pos) { - return Biomes.THE_VOID; + return OverworldBiomes.theVoid(); } @Override public int getBrightness(LightLayer p_226658_1_, BlockPos p_226658_2_) { return 10; } + + @Override + public LevelTickAccess getBlockTicks() { + return BlackholeTickAccess.emptyLevelList(); + } + + @Override + public LevelTickAccess getFluidTicks() { + return BlackholeTickAccess.emptyLevelList(); + } @Override public List getEntities(Entity arg0, AABB arg1, Predicate arg2) { @@ -206,16 +221,6 @@ public class SchematicWorld extends WrappedWorld implements ServerLevelAccessor @Override public void sendBlockUpdated(BlockPos pos, BlockState oldState, BlockState newState, int flags) {} - @Override - public TickList getBlockTicks() { - return EmptyTickList.empty(); - } - - @Override - public TickList getLiquidTicks() { - return EmptyTickList.empty(); - } - public BoundingBox getBounds() { return bounds; } diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableBlock.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableBlock.java index 85c55c037..7e54b4b8b 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableBlock.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableBlock.java @@ -23,7 +23,7 @@ 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.fmllegacy.network.NetworkHooks; +import net.minecraftforge.network.NetworkHooks; public class SchematicTableBlock extends HorizontalDirectionalBlock implements ITE { diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonBlock.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonBlock.java index 1100f145a..a17953dac 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonBlock.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonBlock.java @@ -19,7 +19,7 @@ import net.minecraft.world.level.material.PushReaction; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.fmllegacy.network.NetworkHooks; +import net.minecraftforge.network.NetworkHooks; public class SchematicannonBlock extends Block implements ITE { diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonScreen.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonScreen.java index 177000a05..eef105023 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonScreen.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonScreen.java @@ -261,7 +261,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen tip = button.getToolTip(); diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java index 2353675ec..7d73be6aa 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java @@ -729,7 +729,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro CompoundTag data = null; if (tile != null) { if (AllBlockTags.SAFE_NBT.matches(blockState)) { - data = tile.save(new CompoundTag()); + data = tile.saveWithFullMetadata(); data = NBTProcessors.process(tile, data, true); } else if (tile instanceof IPartialSafeNBT) { data = new CompoundTag(); diff --git a/src/main/java/com/simibubi/create/content/schematics/client/SchematicRenderer.java b/src/main/java/com/simibubi/create/content/schematics/client/SchematicRenderer.java index ef208f42c..a35315a79 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/SchematicRenderer.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/SchematicRenderer.java @@ -102,7 +102,7 @@ public class SchematicRenderer { for (RenderType blockRenderLayer : RenderType.chunkBufferLayers()) { if (!ItemBlockRenderTypes.canRenderInLayer(state, blockRenderLayer)) continue; - ForgeHooksClient.setRenderLayer(blockRenderLayer); + ForgeHooksClient.setRenderType(blockRenderLayer); if (!buffers.containsKey(blockRenderLayer)) buffers.put(blockRenderLayer, new BufferBuilder(DefaultVertexFormat.BLOCK.getIntegerSize())); @@ -120,7 +120,7 @@ public class SchematicRenderer { blockstates.add(state); } - ForgeHooksClient.setRenderLayer(null); + ForgeHooksClient.setRenderType(null); ms.popPose(); }); diff --git a/src/main/java/com/simibubi/create/content/schematics/packet/ConfigureSchematicannonPacket.java b/src/main/java/com/simibubi/create/content/schematics/packet/ConfigureSchematicannonPacket.java index bb0a7b6a8..ee02fb8d1 100644 --- a/src/main/java/com/simibubi/create/content/schematics/packet/ConfigureSchematicannonPacket.java +++ b/src/main/java/com/simibubi/create/content/schematics/packet/ConfigureSchematicannonPacket.java @@ -9,7 +9,7 @@ import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class ConfigureSchematicannonPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/schematics/packet/InstantSchematicPacket.java b/src/main/java/com/simibubi/create/content/schematics/packet/InstantSchematicPacket.java index cba6877e9..62d3f2abe 100644 --- a/src/main/java/com/simibubi/create/content/schematics/packet/InstantSchematicPacket.java +++ b/src/main/java/com/simibubi/create/content/schematics/packet/InstantSchematicPacket.java @@ -8,7 +8,7 @@ import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.core.BlockPos; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class InstantSchematicPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/schematics/packet/SchematicPlacePacket.java b/src/main/java/com/simibubi/create/content/schematics/packet/SchematicPlacePacket.java index 907157f60..2dc60cdb7 100644 --- a/src/main/java/com/simibubi/create/content/schematics/packet/SchematicPlacePacket.java +++ b/src/main/java/com/simibubi/create/content/schematics/packet/SchematicPlacePacket.java @@ -12,7 +12,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class SchematicPlacePacket extends SimplePacketBase { @@ -53,7 +53,7 @@ public class SchematicPlacePacket extends SimplePacketBase { if (placingAir && !includeAir) return; - CompoundTag tileData = tile != null ? tile.save(new CompoundTag()) : null; + CompoundTag tileData = tile != null ? tile.saveWithFullMetadata() : null; BlockHelper.placeSchematicBlock(world, state, pos, null, tileData); }, (pos, entity) -> { world.addFreshEntity(entity); diff --git a/src/main/java/com/simibubi/create/content/schematics/packet/SchematicSyncPacket.java b/src/main/java/com/simibubi/create/content/schematics/packet/SchematicSyncPacket.java index 149f129b6..6615b9546 100644 --- a/src/main/java/com/simibubi/create/content/schematics/packet/SchematicSyncPacket.java +++ b/src/main/java/com/simibubi/create/content/schematics/packet/SchematicSyncPacket.java @@ -15,7 +15,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Mirror; import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class SchematicSyncPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/schematics/packet/SchematicUploadPacket.java b/src/main/java/com/simibubi/create/content/schematics/packet/SchematicUploadPacket.java index 36382ac32..7ef4c5dd7 100644 --- a/src/main/java/com/simibubi/create/content/schematics/packet/SchematicUploadPacket.java +++ b/src/main/java/com/simibubi/create/content/schematics/packet/SchematicUploadPacket.java @@ -9,7 +9,7 @@ import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.core.BlockPos; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class SchematicUploadPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/events/ClientEvents.java b/src/main/java/com/simibubi/create/events/ClientEvents.java index df275d65c..ed817e63b 100644 --- a/src/main/java/com/simibubi/create/events/ClientEvents.java +++ b/src/main/java/com/simibubi/create/events/ClientEvents.java @@ -67,12 +67,13 @@ import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.client.ConfigGuiHandler; import net.minecraftforge.client.event.ClientPlayerNetworkEvent; import net.minecraftforge.client.event.EntityRenderersEvent; import net.minecraftforge.client.event.EntityViewRenderEvent; import net.minecraftforge.client.event.RegisterClientReloadListenersEvent; +import net.minecraftforge.client.event.RenderLevelLastEvent; import net.minecraftforge.client.event.RenderTooltipEvent; -import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.TickEvent.ClientTickEvent; import net.minecraftforge.event.TickEvent.Phase; import net.minecraftforge.event.TickEvent.RenderTickEvent; @@ -84,7 +85,6 @@ import net.minecraftforge.fml.ModContainer; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; -import net.minecraftforge.fmlclient.ConfigGuiHandler; @EventBusSubscriber(Dist.CLIENT) public class ClientEvents { @@ -170,12 +170,12 @@ public class ClientEvents { } @SubscribeEvent - public static void onRenderWorld(RenderWorldLastEvent event) { + public static void onRenderWorld(RenderLevelLastEvent event) { Vec3 cameraPos = Minecraft.getInstance().gameRenderer.getMainCamera() .getPosition(); float pt = AnimationTickHolder.getPartialTicks(); - PoseStack ms = event.getMatrixStack(); + PoseStack ms = event.getPoseStack(); ms.pushPose(); ms.translate(-cameraPos.x(), -cameraPos.y(), -cameraPos.z()); SuperRenderTypeBuffer buffer = SuperRenderTypeBuffer.getInstance(); @@ -248,7 +248,7 @@ public class ClientEvents { @SubscribeEvent public static void getFogDensity(EntityViewRenderEvent.FogDensity event) { - Camera info = event.getInfo(); + Camera info = event.getCamera(); Level level = Minecraft.getInstance().level; BlockPos blockPos = info.getBlockPosition(); FluidState fluidstate = level.getFluidState(blockPos); @@ -279,7 +279,7 @@ public class ClientEvents { @SubscribeEvent public static void getFogColor(EntityViewRenderEvent.FogColors event) { - Camera info = event.getInfo(); + Camera info = event.getCamera(); Level level = Minecraft.getInstance().level; BlockPos blockPos = info.getBlockPosition(); FluidState fluidstate = level.getFluidState(blockPos); diff --git a/src/main/java/com/simibubi/create/events/CommonEvents.java b/src/main/java/com/simibubi/create/events/CommonEvents.java index debbbba4e..b34db0aac 100644 --- a/src/main/java/com/simibubi/create/events/CommonEvents.java +++ b/src/main/java/com/simibubi/create/events/CommonEvents.java @@ -46,6 +46,7 @@ import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent; +import net.minecraftforge.event.server.ServerStoppingEvent; import net.minecraftforge.event.world.BiomeLoadingEvent; import net.minecraftforge.event.world.BlockEvent.FluidPlaceBlockEvent; import net.minecraftforge.event.world.ChunkEvent; @@ -53,7 +54,6 @@ import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; -import net.minecraftforge.fmlserverevents.FMLServerStoppingEvent; @EventBusSubscriber public class CommonEvents { @@ -158,7 +158,7 @@ public class CommonEvents { } @SubscribeEvent - public static void serverStopping(FMLServerStoppingEvent event) { + public static void serverStopping(ServerStoppingEvent event) { Create.SCHEMATIC_RECEIVER.shutdown(); } diff --git a/src/main/java/com/simibubi/create/events/InputEvents.java b/src/main/java/com/simibubi/create/events/InputEvents.java index 0d4029f51..7464d78d6 100644 --- a/src/main/java/com/simibubi/create/events/InputEvents.java +++ b/src/main/java/com/simibubi/create/events/InputEvents.java @@ -60,7 +60,7 @@ public class InputEvents { if (Minecraft.getInstance().screen != null) return; - if (event.getKeyBinding() == Minecraft.getInstance().options.keyPickItem) { + if (event.getKeyMapping() == Minecraft.getInstance().options.keyPickItem) { if (ToolboxHandlerClient.onPickItem()) event.setCanceled(true); return; diff --git a/src/main/java/com/simibubi/create/foundation/command/AllCommands.java b/src/main/java/com/simibubi/create/foundation/command/AllCommands.java index 6885948ed..bf2989b51 100644 --- a/src/main/java/com/simibubi/create/foundation/command/AllCommands.java +++ b/src/main/java/com/simibubi/create/foundation/command/AllCommands.java @@ -54,7 +54,6 @@ public class AllCommands { return Commands.literal("util") .then(ReplaceInCommandBlocksCommand.register()) .then(ClearBufferCacheCommand.register()) - .then(ChunkUtilCommand.register()) .then(FlySpeedCommand.register()) //.then(KillTPSCommand.register()) .build(); diff --git a/src/main/java/com/simibubi/create/foundation/command/ChunkUtil.java b/src/main/java/com/simibubi/create/foundation/command/ChunkUtil.java deleted file mode 100644 index af78a79fc..000000000 --- a/src/main/java/com/simibubi/create/foundation/command/ChunkUtil.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.simibubi.create.foundation.command; - -import java.util.EnumSet; -import java.util.LinkedList; -import java.util.List; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import net.minecraft.server.level.ChunkHolder; -import net.minecraft.server.level.ServerChunkCache; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.chunk.ChunkStatus; -import net.minecraft.world.level.levelgen.Heightmap; -import net.minecraftforge.event.world.ChunkEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; - -public class ChunkUtil { - private static final Logger LOGGER = LogManager.getLogger("Create/ChunkUtil"); - final EnumSet POST_FEATURES = EnumSet.of(Heightmap.Types.OCEAN_FLOOR, Heightmap.Types.WORLD_SURFACE, - Heightmap.Types.MOTION_BLOCKING, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES); - - private final List markedChunks; - private final List interestingChunks; - - public ChunkUtil() { - LOGGER.debug("Chunk Util constructed"); - markedChunks = new LinkedList<>(); - interestingChunks = new LinkedList<>(); - } - - public void init() { - ChunkStatus.FULL = - new ChunkStatus("full", ChunkStatus.HEIGHTMAPS, 0, POST_FEATURES, ChunkStatus.ChunkType.LEVELCHUNK, - (_0, _1, _2, _3, _4, _5, future, _7, chunk) -> future.apply(chunk), (_0, _1, _2, _3, future, chunk) -> { - if (markedChunks.contains(chunk.getPos() - .toLong())) { - LOGGER.debug("trying to load unforced chunk " + chunk.getPos() - .toString() + ", returning chunk loading error"); - // this.reloadChunk(world.getChunkProvider(), chunk.getPos()); - return ChunkHolder.UNLOADED_CHUNK_FUTURE; - } else { - // LOGGER.debug("regular, chunkStatus: " + chunk.getStatus().toString()); - return future.apply(chunk); - } - }); - - } - - public boolean reloadChunk(ServerChunkCache provider, ChunkPos pos) { - ChunkHolder holder = provider.chunkMap.updatingChunkMap.remove(pos.toLong()); - provider.chunkMap.modified = true; - if (holder != null) { - provider.chunkMap.pendingUnloads.put(pos.toLong(), holder); - provider.chunkMap.scheduleUnload(pos.toLong(), holder); - return true; - } else { - return false; - } - } - - public boolean unloadChunk(ServerChunkCache provider, ChunkPos pos) { - this.interestingChunks.add(pos.toLong()); - this.markedChunks.add(pos.toLong()); - - return this.reloadChunk(provider, pos); - } - - public int clear(ServerChunkCache provider) { - LinkedList copy = new LinkedList<>(this.markedChunks); - - int size = this.markedChunks.size(); - this.markedChunks.clear(); - - copy.forEach(l -> reForce(provider, new ChunkPos(l))); - - return size; - } - - public void reForce(ServerChunkCache provider, ChunkPos pos) { - provider.updateChunkForced(pos, true); - provider.updateChunkForced(pos, false); - } - - @SubscribeEvent - public void chunkUnload(ChunkEvent.Unload event) { - // LOGGER.debug("Chunk Unload: " + event.getChunk().getPos().toString()); - if (interestingChunks.contains(event.getChunk() - .getPos() - .toLong())) { - LOGGER.info("Interesting Chunk Unload: " + event.getChunk() - .getPos() - .toString()); - } - } - - @SubscribeEvent - public void chunkLoad(ChunkEvent.Load event) { - // LOGGER.debug("Chunk Load: " + event.getChunk().getPos().toString()); - - ChunkPos pos = event.getChunk() - .getPos(); - if (interestingChunks.contains(pos.toLong())) { - LOGGER.info("Interesting Chunk Load: " + pos.toString()); - if (!markedChunks.contains(pos.toLong())) - interestingChunks.remove(pos.toLong()); - } - - } - -} diff --git a/src/main/java/com/simibubi/create/foundation/command/ChunkUtilCommand.java b/src/main/java/com/simibubi/create/foundation/command/ChunkUtilCommand.java deleted file mode 100644 index 22e724004..000000000 --- a/src/main/java/com/simibubi/create/foundation/command/ChunkUtilCommand.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.simibubi.create.foundation.command; - -import com.mojang.brigadier.builder.ArgumentBuilder; -import com.simibubi.create.Create; - -import net.minecraft.commands.CommandSourceStack; -import net.minecraft.commands.Commands; -import net.minecraft.commands.arguments.coordinates.ColumnPosArgument; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.server.level.ColumnPos; -import net.minecraft.server.level.ServerChunkCache; -import net.minecraft.world.level.ChunkPos; - -public class ChunkUtilCommand { - - public static ArgumentBuilder register() { - return Commands.literal("chunk") - .requires(cs -> cs.hasPermission(2)) - .then(Commands.literal("reload") - .then(Commands.argument("pos", ColumnPosArgument.columnPos()) - .executes(ctx -> { - // chunk reload - ColumnPos columnPos = ColumnPosArgument.getColumnPos(ctx, "pos"); - ChunkPos chunkPos = new ChunkPos(columnPos.x >> 4, columnPos.z >> 4); - ServerChunkCache chunkProvider = ctx.getSource() - .getLevel() - .getChunkSource(); - - boolean success = Create.CHUNK_UTIL.reloadChunk(chunkProvider, chunkPos); - - if (success) { - ctx.getSource() - .sendSuccess(new TextComponent("scheduled unload for chunk " - + chunkPos.toString() + ", might need to repeat command"), true); - return 1; - } else { - ctx.getSource() - .sendSuccess( - new TextComponent( - "unable to schedule unload, is chunk " + chunkPos.toString() + " loaded?"), - true); - return 0; - } - }))) - .then(Commands.literal("unload") - .then(Commands.argument("pos", ColumnPosArgument.columnPos()) - .executes(ctx -> { - // chunk unload - ColumnPos columnPos = ColumnPosArgument.getColumnPos(ctx, "pos"); - ChunkPos chunkPos = new ChunkPos(columnPos.x >> 4, columnPos.z >> 4); - ServerChunkCache chunkProvider = ctx.getSource() - .getLevel() - .getChunkSource(); - - boolean success = Create.CHUNK_UTIL.unloadChunk(chunkProvider, chunkPos); - ctx.getSource() - .sendSuccess( - new TextComponent("added chunk " + chunkPos.toString() + " to unload list"), - true); - - if (success) { - ctx.getSource() - .sendSuccess(new TextComponent("scheduled unload for chunk " - + chunkPos.toString() + ", might need to repeat command"), true); - return 1; - } else { - ctx.getSource() - .sendSuccess( - new TextComponent( - "unable to schedule unload, is chunk " + chunkPos.toString() + " loaded?"), - true); - return 0; - } - }))) - .then(Commands.literal("clear") - .executes(ctx -> { - // chunk clear - int count = Create.CHUNK_UTIL.clear(ctx.getSource() - .getLevel() - .getChunkSource()); - ctx.getSource() - .sendSuccess(new TextComponent("removed " + count + " entries from unload list"), false); - - return 1; - })); - - } -} diff --git a/src/main/java/com/simibubi/create/foundation/command/CloneCommand.java b/src/main/java/com/simibubi/create/foundation/command/CloneCommand.java index c9d00ffae..3a848952b 100644 --- a/src/main/java/com/simibubi/create/foundation/command/CloneCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/CloneCommand.java @@ -123,7 +123,7 @@ public class CloneCommand { BlockState state = cached.getState(); BlockEntity te = world.getBlockEntity(currentPos); if (te != null) { - CompoundTag nbt = te.save(new CompoundTag()); + CompoundTag nbt = te.saveWithFullMetadata(); tileBlocks.add(new StructureTemplate.StructureBlockInfo(newPos, state, nbt)); } else { blocks.add(new StructureTemplate.StructureBlockInfo(newPos, state, null)); @@ -169,7 +169,7 @@ public class CloneCommand { } world.getBlockTicks() - .copy(sourceArea, diffToTarget); + .copyArea(sourceArea, diffToTarget); return blockPastes; } diff --git a/src/main/java/com/simibubi/create/foundation/command/ConfigCommand.java b/src/main/java/com/simibubi/create/foundation/command/ConfigCommand.java index da4dba0b9..a7abc0456 100644 --- a/src/main/java/com/simibubi/create/foundation/command/ConfigCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/ConfigCommand.java @@ -12,7 +12,7 @@ import net.minecraft.commands.Commands; import net.minecraft.network.chat.TextComponent; import net.minecraft.server.level.ServerPlayer; import net.minecraftforge.fml.config.ModConfig; -import net.minecraftforge.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; /** * Examples: diff --git a/src/main/java/com/simibubi/create/foundation/command/FabulousWarningCommand.java b/src/main/java/com/simibubi/create/foundation/command/FabulousWarningCommand.java index 66c188980..e2029155f 100644 --- a/src/main/java/com/simibubi/create/foundation/command/FabulousWarningCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/FabulousWarningCommand.java @@ -7,7 +7,7 @@ import com.simibubi.create.foundation.networking.AllPackets; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.server.level.ServerPlayer; -import net.minecraftforge.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; public class FabulousWarningCommand { diff --git a/src/main/java/com/simibubi/create/foundation/command/FixLightingCommand.java b/src/main/java/com/simibubi/create/foundation/command/FixLightingCommand.java index f6296e789..ceca34925 100644 --- a/src/main/java/com/simibubi/create/foundation/command/FixLightingCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/FixLightingCommand.java @@ -7,7 +7,7 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.network.chat.TextComponent; import net.minecraft.server.level.ServerPlayer; -import net.minecraftforge.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; public class FixLightingCommand { diff --git a/src/main/java/com/simibubi/create/foundation/command/HighlightCommand.java b/src/main/java/com/simibubi/create/foundation/command/HighlightCommand.java index 6587a480d..60f78d7d3 100644 --- a/src/main/java/com/simibubi/create/foundation/command/HighlightCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/HighlightCommand.java @@ -22,7 +22,7 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.ForgeMod; -import net.minecraftforge.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; public class HighlightCommand { diff --git a/src/main/java/com/simibubi/create/foundation/command/HighlightPacket.java b/src/main/java/com/simibubi/create/foundation/command/HighlightPacket.java index bdde483db..7ecc08380 100644 --- a/src/main/java/com/simibubi/create/foundation/command/HighlightPacket.java +++ b/src/main/java/com/simibubi/create/foundation/command/HighlightPacket.java @@ -13,7 +13,7 @@ import net.minecraft.world.phys.shapes.Shapes; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; public class HighlightPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/foundation/command/OverlayConfigCommand.java b/src/main/java/com/simibubi/create/foundation/command/OverlayConfigCommand.java index 09724afa9..384fc6c41 100644 --- a/src/main/java/com/simibubi/create/foundation/command/OverlayConfigCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/OverlayConfigCommand.java @@ -9,7 +9,7 @@ import net.minecraft.network.chat.TextComponent; import net.minecraft.server.level.ServerPlayer; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; public class OverlayConfigCommand { diff --git a/src/main/java/com/simibubi/create/foundation/command/PonderCommand.java b/src/main/java/com/simibubi/create/foundation/command/PonderCommand.java index 2d9736d60..94ae2bc4c 100644 --- a/src/main/java/com/simibubi/create/foundation/command/PonderCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/PonderCommand.java @@ -18,7 +18,7 @@ import net.minecraft.commands.synchronization.SuggestionProviders; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; public class PonderCommand { public static final SuggestionProvider ITEM_PONDERS = SuggestionProviders.register(new ResourceLocation("all_ponders"), (iSuggestionProviderCommandContext, builder) -> SharedSuggestionProvider.suggestResource(PonderRegistry.ALL.keySet().stream(), builder)); diff --git a/src/main/java/com/simibubi/create/foundation/command/SConfigureConfigPacket.java b/src/main/java/com/simibubi/create/foundation/command/SConfigureConfigPacket.java index ed6fa72f5..ea0a82028 100644 --- a/src/main/java/com/simibubi/create/foundation/command/SConfigureConfigPacket.java +++ b/src/main/java/com/simibubi/create/foundation/command/SConfigureConfigPacket.java @@ -31,7 +31,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.ForgeConfig; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.config.ModConfig; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; public class SConfigureConfigPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/foundation/command/ToggleDebugCommand.java b/src/main/java/com/simibubi/create/foundation/command/ToggleDebugCommand.java index 1a6ee341f..fbd7b3ffa 100644 --- a/src/main/java/com/simibubi/create/foundation/command/ToggleDebugCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/ToggleDebugCommand.java @@ -3,7 +3,7 @@ package com.simibubi.create.foundation.command; import com.simibubi.create.foundation.networking.AllPackets; import net.minecraft.server.level.ServerPlayer; -import net.minecraftforge.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; public class ToggleDebugCommand extends ConfigureConfigCommand { diff --git a/src/main/java/com/simibubi/create/foundation/config/ui/CConfigureConfigPacket.java b/src/main/java/com/simibubi/create/foundation/config/ui/CConfigureConfigPacket.java index 3f303b103..6e1a12224 100644 --- a/src/main/java/com/simibubi/create/foundation/config/ui/CConfigureConfigPacket.java +++ b/src/main/java/com/simibubi/create/foundation/config/ui/CConfigureConfigPacket.java @@ -10,7 +10,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.fml.config.ModConfig; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; public class CConfigureConfigPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreen.java b/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreen.java index d2e89b952..75a7619ba 100644 --- a/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreen.java +++ b/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreen.java @@ -33,6 +33,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; import net.minecraft.core.Direction; import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.client.event.ScreenEvent; public abstract class ConfigScreen extends AbstractSimiScreen { @@ -66,7 +67,7 @@ public abstract class ConfigScreen extends AbstractSimiScreen { @Override public void renderBackground(@Nonnull PoseStack ms) { - net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this, ms)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new ScreenEvent.BackgroundDrawnEvent(this, ms)); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreenList.java b/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreenList.java index e7843e290..fa79152bb 100644 --- a/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreenList.java +++ b/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreenList.java @@ -12,6 +12,7 @@ import com.mojang.blaze3d.platform.Window; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.foundation.config.ui.entries.NumberEntry; +import com.simibubi.create.foundation.gui.RemovedGuiUtils; import com.simibubi.create.foundation.gui.Theme; import com.simibubi.create.foundation.gui.TickableGuiEventListener; import com.simibubi.create.foundation.gui.UIRenderHelper; @@ -28,7 +29,7 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.TextComponent; -import net.minecraftforge.fmlclient.gui.GuiUtils; +import net.minecraftforge.client.gui.GuiUtils; public class ConfigScreenList extends ObjectSelectionList implements TickableGuiEventListener { @@ -255,7 +256,7 @@ public class ConfigScreenList extends ObjectSelectionList toAdd = new MutableObject<>(null); + event.getListenersList() + .stream() .filter(w -> w instanceof AbstractWidget) .map(w -> (AbstractWidget) w) - .filter(w -> w.getMessage().getString().equals(target)) + .filter(w -> w.getMessage() + .getString() + .equals(target)) .findFirst() - .ifPresent(w -> event.addWidget( - new OpenCreateMenuButton(w.x + offsetX_ + (onLeft ? -20 : w.getWidth()), w.y) - )); + .ifPresent(w -> toAdd + .setValue(new OpenCreateMenuButton(w.x + offsetX_ + (onLeft ? -20 : w.getWidth()), w.y))); + if (toAdd.getValue() != null) + event.addListener(toAdd.getValue()); } } diff --git a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java index 0b1f1fc09..df0b9d11b 100644 --- a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java +++ b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java @@ -22,6 +22,7 @@ import com.simibubi.create.foundation.block.render.ColoredVertexModel; import com.simibubi.create.foundation.block.render.IBlockVertexColor; import com.tterrag.registrate.AbstractRegistrate; import com.tterrag.registrate.builders.BlockBuilder; +import com.tterrag.registrate.builders.BlockEntityBuilder.BlockEntityFactory; import com.tterrag.registrate.builders.Builder; import com.tterrag.registrate.builders.FluidBuilder; import com.tterrag.registrate.util.NonNullLazyValue; @@ -32,16 +33,13 @@ import com.tterrag.registrate.util.nullness.NonNullFunction; import com.tterrag.registrate.util.nullness.NonNullSupplier; import net.minecraft.client.resources.model.BakedModel; -import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockBehaviour.Properties; -import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluid; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -49,21 +47,11 @@ import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.ForgeFlowingFluid; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.fmllegacy.RegistryObject; import net.minecraftforge.registries.IForgeRegistryEntry; +import net.minecraftforge.registries.RegistryObject; public class CreateRegistrate extends AbstractRegistrate { - public interface BlockEntityFactory { - - public T create(BlockEntityType type, BlockPos pos, BlockState state); - - default T createWithReversedParams(BlockPos pos, BlockState state, BlockEntityType type) { - return create(type, pos, state); - } - - } - protected CreateRegistrate(String modid) { super(modid); } @@ -130,9 +118,8 @@ public class CreateRegistrate extends AbstractRegistrate { public CreateTileEntityBuilder tileEntity(P parent, String name, BlockEntityFactory factory) { - return (CreateTileEntityBuilder) this.entry(name, (callback) -> { - return CreateTileEntityBuilder.create(this, parent, name, callback, factory::createWithReversedParams); - }); + return (CreateTileEntityBuilder) this.entry(name, + (callback) -> CreateTileEntityBuilder.create(this, parent, name, callback, factory)); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/data/CreateTileEntityBuilder.java b/src/main/java/com/simibubi/create/foundation/data/CreateTileEntityBuilder.java index 179af9f0d..bcdf77e80 100644 --- a/src/main/java/com/simibubi/create/foundation/data/CreateTileEntityBuilder.java +++ b/src/main/java/com/simibubi/create/foundation/data/CreateTileEntityBuilder.java @@ -5,8 +5,8 @@ import javax.annotation.Nullable; import com.jozufozu.flywheel.backend.instancing.InstancedRenderRegistry; import com.jozufozu.flywheel.backend.instancing.tile.ITileInstanceFactory; import com.tterrag.registrate.AbstractRegistrate; +import com.tterrag.registrate.builders.BlockEntityBuilder; import com.tterrag.registrate.builders.BuilderCallback; -import com.tterrag.registrate.builders.TileEntityBuilder; import com.tterrag.registrate.util.OneTimeEventReceiver; import com.tterrag.registrate.util.nullness.NonNullSupplier; @@ -15,12 +15,12 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -public class CreateTileEntityBuilder extends TileEntityBuilder { +public class CreateTileEntityBuilder extends BlockEntityBuilder { @Nullable private NonNullSupplier> instanceFactory; - public static TileEntityBuilder create(AbstractRegistrate owner, P parent, + public static BlockEntityBuilder create(AbstractRegistrate owner, P parent, String name, BuilderCallback callback, BlockEntityFactory factory) { return new CreateTileEntityBuilder<>(owner, parent, name, callback, factory); } diff --git a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java index bbbf45839..a670c3e4d 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java @@ -123,7 +123,7 @@ public abstract class AbstractSimiScreen extends Screen { protected void renderWindowForeground(PoseStack ms, int mouseX, int mouseY, float partialTicks) { for (Widget widget : renderables) { - if (widget instanceof AbstractSimiWidget simiWidget && simiWidget.isHovered()) { + if (widget instanceof AbstractSimiWidget simiWidget && simiWidget.isHoveredOrFocused()) { List tooltip = simiWidget.getToolTip(); if (!tooltip.isEmpty()) renderComponentTooltip(ms, tooltip, mouseX, mouseY); diff --git a/src/main/java/com/simibubi/create/foundation/gui/RemovedGuiUtils.java b/src/main/java/com/simibubi/create/foundation/gui/RemovedGuiUtils.java new file mode 100644 index 000000000..22406cf12 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/gui/RemovedGuiUtils.java @@ -0,0 +1,202 @@ +package com.simibubi.create.foundation.gui; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Nonnull; + +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.math.Matrix4f; + +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.locale.Language; +import net.minecraft.network.chat.FormattedText; +import net.minecraft.network.chat.Style; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.event.RenderTooltipEvent; +import net.minecraftforge.client.gui.GuiUtils; +import net.minecraftforge.common.MinecraftForge; + +public class RemovedGuiUtils { + @Nonnull + private static ItemStack cachedTooltipStack = ItemStack.EMPTY; + + public static void preItemToolTip(@Nonnull ItemStack stack) { + cachedTooltipStack = stack; + } + + public static void postItemToolTip() { + cachedTooltipStack = ItemStack.EMPTY; + } + + public static void drawHoveringText(PoseStack mStack, List textLines, int mouseX, + int mouseY, int screenWidth, int screenHeight, int maxTextWidth, Font font) { + drawHoveringText(mStack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, + GuiUtils.DEFAULT_BACKGROUND_COLOR, GuiUtils.DEFAULT_BORDER_COLOR_START, GuiUtils.DEFAULT_BORDER_COLOR_END, + font); + } + + public static void drawHoveringText(PoseStack mStack, List textLines, int mouseX, + int mouseY, int screenWidth, int screenHeight, int maxTextWidth, int backgroundColor, int borderColorStart, + int borderColorEnd, Font font) { + drawHoveringText(cachedTooltipStack, mStack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, + backgroundColor, borderColorStart, borderColorEnd, font); + } + + public static void drawHoveringText(@Nonnull final ItemStack stack, PoseStack mStack, + List textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, + int maxTextWidth, Font font) { + drawHoveringText(stack, mStack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, + GuiUtils.DEFAULT_BACKGROUND_COLOR, GuiUtils.DEFAULT_BORDER_COLOR_START, GuiUtils.DEFAULT_BORDER_COLOR_END, + font); + } + + public static void drawHoveringText(@Nonnull final ItemStack stack, PoseStack pStack, + List textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, + int maxTextWidth, int backgroundColor, int borderColorStart, int borderColorEnd, Font font) { + if (textLines.isEmpty()) + return; + + List list = ForgeHooksClient.gatherTooltipComponents(stack, textLines, + stack.getTooltipImage(), mouseX, screenWidth, screenHeight, font, font); + RenderTooltipEvent.Pre event = + new RenderTooltipEvent.Pre(stack, pStack, mouseX, mouseY, screenWidth, screenHeight, font, list); + if (MinecraftForge.EVENT_BUS.post(event)) + return; + + mouseX = event.getX(); + mouseY = event.getY(); + screenWidth = event.getScreenWidth(); + screenHeight = event.getScreenHeight(); + font = event.getFont(); + + // RenderSystem.disableRescaleNormal(); + RenderSystem.disableDepthTest(); + int tooltipTextWidth = 0; + + for (FormattedText textLine : textLines) { + int textLineWidth = font.width(textLine); + if (textLineWidth > tooltipTextWidth) + tooltipTextWidth = textLineWidth; + } + + boolean needsWrap = false; + + int titleLinesCount = 1; + int tooltipX = mouseX + 12; + if (tooltipX + tooltipTextWidth + 4 > screenWidth) { + tooltipX = mouseX - 16 - tooltipTextWidth; + if (tooltipX < 4) // if the tooltip doesn't fit on the screen + { + if (mouseX > screenWidth / 2) + tooltipTextWidth = mouseX - 12 - 8; + else + tooltipTextWidth = screenWidth - 16 - mouseX; + needsWrap = true; + } + } + + if (maxTextWidth > 0 && tooltipTextWidth > maxTextWidth) { + tooltipTextWidth = maxTextWidth; + needsWrap = true; + } + + if (needsWrap) { + int wrappedTooltipWidth = 0; + List wrappedTextLines = new ArrayList<>(); + for (int i = 0; i < textLines.size(); i++) { + FormattedText textLine = textLines.get(i); + List wrappedLine = font.getSplitter() + .splitLines(textLine, tooltipTextWidth, Style.EMPTY); + if (i == 0) + titleLinesCount = wrappedLine.size(); + + for (FormattedText line : wrappedLine) { + int lineWidth = font.width(line); + if (lineWidth > wrappedTooltipWidth) + wrappedTooltipWidth = lineWidth; + wrappedTextLines.add(line); + } + } + tooltipTextWidth = wrappedTooltipWidth; + textLines = wrappedTextLines; + + if (mouseX > screenWidth / 2) + tooltipX = mouseX - 16 - tooltipTextWidth; + else + tooltipX = mouseX + 12; + } + + int tooltipY = mouseY - 12; + int tooltipHeight = 8; + + if (textLines.size() > 1) { + tooltipHeight += (textLines.size() - 1) * 10; + if (textLines.size() > titleLinesCount) + tooltipHeight += 2; // gap between title lines and next lines + } + + if (tooltipY < 4) + tooltipY = 4; + else if (tooltipY + tooltipHeight + 4 > screenHeight) + tooltipY = screenHeight - tooltipHeight - 4; + + final int zLevel = 400; + RenderTooltipEvent.Color colorEvent = new RenderTooltipEvent.Color(stack, pStack, tooltipX, tooltipY, + font, backgroundColor, borderColorStart, borderColorEnd, list); + MinecraftForge.EVENT_BUS.post(colorEvent); + backgroundColor = colorEvent.getBackgroundStart(); + borderColorStart = colorEvent.getBorderStart(); + borderColorEnd = colorEvent.getBorderEnd(); + + pStack.pushPose(); + Matrix4f mat = pStack.last() + .pose(); + GuiUtils.drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY - 4, tooltipX + tooltipTextWidth + 3, + tooltipY - 3, backgroundColor, backgroundColor); + GuiUtils.drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY + tooltipHeight + 3, + tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 4, backgroundColor, backgroundColor); + GuiUtils.drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, + tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); + GuiUtils.drawGradientRect(mat, zLevel, tooltipX - 4, tooltipY - 3, tooltipX - 3, tooltipY + tooltipHeight + 3, + backgroundColor, backgroundColor); + GuiUtils.drawGradientRect(mat, zLevel, tooltipX + tooltipTextWidth + 3, tooltipY - 3, + tooltipX + tooltipTextWidth + 4, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); + GuiUtils.drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY - 3 + 1, tooltipX - 3 + 1, + tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); + GuiUtils.drawGradientRect(mat, zLevel, tooltipX + tooltipTextWidth + 2, tooltipY - 3 + 1, + tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); + GuiUtils.drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, + tooltipY - 3 + 1, borderColorStart, borderColorStart); + GuiUtils.drawGradientRect(mat, zLevel, tooltipX - 3, tooltipY + tooltipHeight + 2, + tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, borderColorEnd, borderColorEnd); + + MultiBufferSource.BufferSource renderType = MultiBufferSource.immediate(Tesselator.getInstance() + .getBuilder()); + pStack.translate(0.0D, 0.0D, zLevel); + + int tooltipTop = tooltipY; + + for (int lineNumber = 0; lineNumber < list.size(); ++lineNumber) { + ClientTooltipComponent line = list.get(lineNumber); + + if (line != null) + line.renderText(font, tooltipX, tooltipY, mat, renderType); + + if (lineNumber + 1 == titleLinesCount) + tooltipY += 2; + + tooltipY += 10; + } + + renderType.endBatch(); + pStack.popPose(); + + RenderSystem.enableDepthTest(); + } +} diff --git a/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java b/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java index 66365f1ef..7aa771f3b 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java +++ b/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java @@ -17,7 +17,7 @@ import com.simibubi.create.foundation.utility.Couple; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GameRenderer; -import net.minecraftforge.fmlclient.gui.GuiUtils; +import net.minecraftforge.client.gui.GuiUtils; public class UIRenderHelper { diff --git a/src/main/java/com/simibubi/create/foundation/gui/container/AbstractSimiContainerScreen.java b/src/main/java/com/simibubi/create/foundation/gui/container/AbstractSimiContainerScreen.java index 05197dd55..cda1dbfd7 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/container/AbstractSimiContainerScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/container/AbstractSimiContainerScreen.java @@ -110,7 +110,7 @@ public abstract class AbstractSimiContainerScreen tooltip = simiWidget.getToolTip(); if (!tooltip.isEmpty()) renderComponentTooltip(matrixStack, tooltip, mouseX, mouseY); diff --git a/src/main/java/com/simibubi/create/foundation/gui/container/ClearContainerPacket.java b/src/main/java/com/simibubi/create/foundation/gui/container/ClearContainerPacket.java index 6d5f4ef41..1fb21351c 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/container/ClearContainerPacket.java +++ b/src/main/java/com/simibubi/create/foundation/gui/container/ClearContainerPacket.java @@ -6,7 +6,7 @@ import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class ClearContainerPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/foundation/gui/container/GhostItemSubmitPacket.java b/src/main/java/com/simibubi/create/foundation/gui/container/GhostItemSubmitPacket.java index 32b0d1378..eb1813703 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/container/GhostItemSubmitPacket.java +++ b/src/main/java/com/simibubi/create/foundation/gui/container/GhostItemSubmitPacket.java @@ -7,7 +7,7 @@ import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; +import net.minecraftforge.network.NetworkEvent.Context; public class GhostItemSubmitPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/foundation/gui/widget/AbstractSimiWidget.java b/src/main/java/com/simibubi/create/foundation/gui/widget/AbstractSimiWidget.java index 146a476ef..e7f40b47b 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widget/AbstractSimiWidget.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widget/AbstractSimiWidget.java @@ -63,7 +63,7 @@ public abstract class AbstractSimiWidget extends AbstractWidget implements Ticka beforeRender(ms, mouseX, mouseY, partialTicks); renderButton(ms, mouseX, mouseY, partialTicks); afterRender(ms, mouseX, mouseY, partialTicks); - wasHovered = isHovered(); + wasHovered = isHoveredOrFocused(); } } diff --git a/src/main/java/com/simibubi/create/foundation/gui/widget/IconButton.java b/src/main/java/com/simibubi/create/foundation/gui/widget/IconButton.java index 844a718a0..f01feac99 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widget/IconButton.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widget/IconButton.java @@ -24,7 +24,7 @@ public class IconButton extends AbstractSimiWidget { isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height; AllGuiTextures button = !active ? AllGuiTextures.BUTTON_DOWN - : isHovered() ? AllGuiTextures.BUTTON_HOVER : AllGuiTextures.BUTTON; + : isHoveredOrFocused() ? AllGuiTextures.BUTTON_HOVER : AllGuiTextures.BUTTON; RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); AllGuiTextures.BUTTON.bind(); diff --git a/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModel.java b/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModel.java index b7781f507..21e6664c2 100644 --- a/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModel.java +++ b/src/main/java/com/simibubi/create/foundation/item/render/CustomRenderedItemModel.java @@ -13,7 +13,7 @@ import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.model.BakedModelWrapper; -import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.client.model.ForgeModelBakery; public abstract class CustomRenderedItemModel extends BakedModelWrapper { @@ -58,13 +58,13 @@ public abstract class CustomRenderedItemModel extends BakedModelWrapper extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/foundation/networking/TileEntityDataPacket.java b/src/main/java/com/simibubi/create/foundation/networking/TileEntityDataPacket.java index 9ec52c0de..d1e8ec497 100644 --- a/src/main/java/com/simibubi/create/foundation/networking/TileEntityDataPacket.java +++ b/src/main/java/com/simibubi/create/foundation/networking/TileEntityDataPacket.java @@ -9,7 +9,7 @@ import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.BlockPos; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; /** * A server to client version of {@link TileEntityConfigurationPacket} diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderScene.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderScene.java index a8cc92dee..9bf14f960 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderScene.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderScene.java @@ -174,7 +174,7 @@ public class PonderScene { .getFirst() .selectBlock(selectedPos); BlockState blockState = world.getBlockState(selectedPos); - ItemStack pickBlock = blockState.getPickBlock( + ItemStack pickBlock = blockState.getCloneItemStack( new BlockHitResult(VecHelper.getCenterOf(selectedPos), Direction.UP, selectedPos, true), world, selectedPos, Minecraft.getInstance().player); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderTooltipHandler.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderTooltipHandler.java index f76e99ec9..1e6dd6c2c 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderTooltipHandler.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderTooltipHandler.java @@ -124,7 +124,7 @@ public class PonderTooltipHandler { } public static void handleTooltipColor(RenderTooltipEvent.Color event) { - if (trackingStack != event.getStack()) + if (trackingStack != event.getItemStack()) return; if (holdWProgress.getValue() == 0) return; diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java index 5ebc3043f..358810e58 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java @@ -84,7 +84,7 @@ public class PonderWorld extends SchematicWorld { originalTileEntities.clear(); blocks.forEach((k, v) -> originalBlocks.put(k, v)); tileEntities.forEach( - (k, v) -> originalTileEntities.put(k, BlockEntity.loadStatic(k, blocks.get(k), v.save(new CompoundTag())))); + (k, v) -> originalTileEntities.put(k, BlockEntity.loadStatic(k, blocks.get(k), v.saveWithFullMetadata()))); entities.forEach(e -> EntityType.create(e.serializeNBT(), this) .ifPresent(originalEntities::add)); } @@ -97,7 +97,7 @@ public class PonderWorld extends SchematicWorld { renderedTileEntities.clear(); originalBlocks.forEach((k, v) -> blocks.put(k, v)); originalTileEntities.forEach((k, v) -> { - BlockEntity te = BlockEntity.loadStatic(k, originalBlocks.get(k), v.save(new CompoundTag())); + BlockEntity te = BlockEntity.loadStatic(k, originalBlocks.get(k), v.saveWithFullMetadata()); onTEadded(te, te.getBlockPos()); tileEntities.put(k, te); renderedTileEntities.add(te); @@ -114,7 +114,7 @@ public class PonderWorld extends SchematicWorld { blocks.put(p, originalBlocks.get(p)); if (originalTileEntities.containsKey(p)) { BlockEntity te = BlockEntity.loadStatic(p, originalBlocks.get(p), originalTileEntities.get(p) - .save(new CompoundTag())); + .saveWithFullMetadata()); onTEadded(te, te.getBlockPos()); tileEntities.put(p, te); } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/element/TextWindowElement.java b/src/main/java/com/simibubi/create/foundation/ponder/element/TextWindowElement.java index fd456a496..44f331929 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/element/TextWindowElement.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/element/TextWindowElement.java @@ -19,7 +19,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.fmlclient.gui.GuiUtils; +import net.minecraftforge.client.gui.GuiUtils; public class TextWindowElement extends AnimatedOverlayElement { diff --git a/src/main/java/com/simibubi/create/foundation/ponder/element/WorldSectionElement.java b/src/main/java/com/simibubi/create/foundation/ponder/element/WorldSectionElement.java index 58372b784..b8b8935ec 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/element/WorldSectionElement.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/element/WorldSectionElement.java @@ -404,7 +404,7 @@ public class WorldSectionElement extends AnimatedSceneElement { } private SuperByteBuffer buildStructureBuffer(PonderWorld world, RenderType layer) { - ForgeHooksClient.setRenderLayer(layer); + ForgeHooksClient.setRenderType(layer); BlockRenderDispatcher dispatcher = Minecraft.getInstance() .getBlockRenderer(); PoseStack ms = new PoseStack(); @@ -434,7 +434,7 @@ public class WorldSectionElement extends AnimatedSceneElement { world.clearMask(); builder.end(); - ForgeHooksClient.setRenderLayer(null); + ForgeHooksClient.setRenderType(null); return new SuperByteBuffer(builder); } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/instruction/TileEntityDataInstruction.java b/src/main/java/com/simibubi/create/foundation/ponder/instruction/TileEntityDataInstruction.java index 65de59767..84bcb6c0b 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/instruction/TileEntityDataInstruction.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/instruction/TileEntityDataInstruction.java @@ -34,7 +34,7 @@ public class TileEntityDataInstruction extends WorldModifyInstruction { BlockEntity tileEntity = world.getBlockEntity(pos); if (!type.isInstance(tileEntity)) return; - CompoundTag apply = data.apply(tileEntity.save(new CompoundTag())); + CompoundTag apply = data.apply(tileEntity.saveWithFullMetadata()); if (tileEntity instanceof SyncedTileEntity) ((SyncedTileEntity) tileEntity).readClientUpdate(apply); tileEntity.load(apply); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/ui/NavigatableSimiScreen.java b/src/main/java/com/simibubi/create/foundation/ponder/ui/NavigatableSimiScreen.java index fd58721bb..1a87e35a2 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/ui/NavigatableSimiScreen.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/ui/NavigatableSimiScreen.java @@ -95,7 +95,7 @@ public abstract class NavigatableSimiScreen extends AbstractSimiScreen { ms.pushPose(); ms.translate(0, 0, 500); - if (backTrack.isHovered()) { + if (backTrack.isHoveredOrFocused()) { TranslatableComponent translate = Lang.translate(backTrackingLangKey()); font.draw(ms, translate, 41 - font.width(translate) / 2, height - 16, Theme.i(Theme.Key.TEXT_DARKER)); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderProgressBar.java b/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderProgressBar.java index aea0edeac..fbb88aea7 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderProgressBar.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderProgressBar.java @@ -12,7 +12,7 @@ import com.simibubi.create.foundation.utility.animation.LerpedFloat; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.sounds.SoundManager; -import net.minecraftforge.fmlclient.gui.GuiUtils; +import net.minecraftforge.client.gui.GuiUtils; public class PonderProgressBar extends AbstractSimiWidget { diff --git a/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderUI.java b/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderUI.java index 0363d00c8..51ecfed07 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderUI.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderUI.java @@ -62,7 +62,7 @@ import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.fmlclient.gui.GuiUtils; +import net.minecraftforge.client.gui.GuiUtils; import net.minecraftforge.registries.ForgeRegistries; public class PonderUI extends NavigatableSimiScreen { @@ -736,19 +736,19 @@ public class PonderUI extends NavigatableSimiScreen { ms.pushPose(); ms.translate(0, 0, 500); int tooltipY = height - 16; - if (scan.isHovered()) + if (scan.isHoveredOrFocused()) drawCenteredString(ms, font, Lang.translate(IDENTIFY), scan.x + 10, tooltipY, tooltipColor); - if (index != 0 && left.isHovered()) + if (index != 0 && left.isHoveredOrFocused()) drawCenteredString(ms, font, Lang.translate(PREVIOUS), left.x + 10, tooltipY, tooltipColor); - if (close.isHovered()) + if (close.isHoveredOrFocused()) drawCenteredString(ms, font, Lang.translate(CLOSE), close.x + 10, tooltipY, tooltipColor); - if (index != scenes.size() - 1 && right.isHovered()) + if (index != scenes.size() - 1 && right.isHoveredOrFocused()) drawCenteredString(ms, font, Lang.translate(NEXT), right.x + 10, tooltipY, tooltipColor); - if (replay.isHovered()) + if (replay.isHoveredOrFocused()) drawCenteredString(ms, font, Lang.translate(REPLAY), replay.x + 10, tooltipY, tooltipColor); - if (slowMode.isHovered()) + if (slowMode.isHoveredOrFocused()) drawCenteredString(ms, font, Lang.translate(SLOW_TEXT), slowMode.x + 5, tooltipY, tooltipColor); - if (PonderIndex.editingModeActive() && userMode.isHovered()) + if (PonderIndex.editingModeActive() && userMode.isHoveredOrFocused()) drawCenteredString(ms, font, "Editor View", userMode.x + 10, tooltipY, tooltipColor); ms.popPose(); diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java b/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java index 0059fec11..908b0d10e 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java @@ -85,11 +85,10 @@ public abstract class SmartTileEntity extends SyncedTileEntity implements IParti behaviourList.forEach(TileEntityBehaviour::initialize); lazyTick(); } - + @Override - public final CompoundTag save(CompoundTag compound) { + public final void saveAdditional(CompoundTag compound) { write(compound, false); - return compound; } @Override @@ -128,13 +127,13 @@ public abstract class SmartTileEntity extends SyncedTileEntity implements IParti * Hook only these in future subclasses of STE */ protected void write(CompoundTag compound, boolean clientPacket) { - super.save(compound); + super.saveAdditional(compound); behaviourList.forEach(tb -> tb.write(compound, clientPacket)); } @Override public void writeSafe(CompoundTag compound, boolean clientPacket) { - super.save(compound); + super.saveAdditional(compound); behaviourList.forEach(tb -> { if (tb.isSafeNBT()) tb.write(compound, clientPacket); diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/SyncedTileEntity.java b/src/main/java/com/simibubi/create/foundation/tileEntity/SyncedTileEntity.java index be07ab6ac..5a591391a 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/SyncedTileEntity.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/SyncedTileEntity.java @@ -12,7 +12,7 @@ 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.minecraft.world.level.chunk.LevelChunk; -import net.minecraftforge.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.PacketDistributor; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault @@ -32,6 +32,11 @@ public abstract class SyncedTileEntity extends BlockEntity { return save(new CompoundTag()); } + @Override + public CompoundTag save(CompoundTag tag) { + saveAdditional(tag); + return super.save(tag); + } public void sendData() { if (level != null && !level.isClientSide) @@ -45,7 +50,8 @@ public abstract class SyncedTileEntity extends BlockEntity { @Override public ClientboundBlockEntityDataPacket getUpdatePacket() { - return new ClientboundBlockEntityDataPacket(getBlockPos(), 0, writeToClient(new CompoundTag())); + return ClientboundBlockEntityDataPacket.create(this, + te -> ((SyncedTileEntity) te).writeToClient(new CompoundTag())); } @Override 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 d5d3aac4a..a0e3049e6 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java @@ -10,6 +10,7 @@ import com.simibubi.create.content.contraptions.components.actors.SeatBlock; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.Registry; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; @@ -198,12 +199,13 @@ public class BlockHelper { int k = target.getZ() & 15; LevelChunk chunk = world.getChunkAt(target); LevelChunkSection chunksection = chunk.getSections()[j >> 4]; - if (chunksection == LevelChunk.EMPTY_SECTION) { - chunksection = new LevelChunkSection(j >> 4 << 4); + if (chunksection == null) { + chunksection = new LevelChunkSection(j >> 4 << 4, world.registryAccess() + .registryOrThrow(Registry.BIOME_REGISTRY)); chunk.getSections()[j >> 4] = chunksection; } BlockState old = chunksection.setBlockState(i, j & 15, k, state); - chunk.markUnsaved(); + chunk.setUnsaved(true); world.markAndNotifyBlock(target, chunk, old, state, 82, 512); world.setBlock(target, state, 82); diff --git a/src/main/java/com/simibubi/create/foundation/utility/ModelSwapper.java b/src/main/java/com/simibubi/create/foundation/utility/ModelSwapper.java index 45b99abf4..bfd0fd91f 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/ModelSwapper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/ModelSwapper.java @@ -18,7 +18,7 @@ import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.event.ModelRegistryEvent; -import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.client.model.ForgeModelBakery; import net.minecraftforge.eventbus.api.IEventBus; public class ModelSwapper { @@ -42,7 +42,7 @@ public class ModelSwapper { public void onModelRegistry(ModelRegistryEvent event) { customRenderedItems.forEach((item, modelFunc) -> modelFunc.apply(null) .getModelLocations() - .forEach(ModelLoader::addSpecialModel)); + .forEach(ForgeModelBakery::addSpecialModel)); } public void onModelBake(ModelBakeEvent event) { diff --git a/src/main/java/com/simibubi/create/foundation/utility/ServerSpeedProvider.java b/src/main/java/com/simibubi/create/foundation/utility/ServerSpeedProvider.java index 350c6d5dd..117dfa007 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/ServerSpeedProvider.java +++ b/src/main/java/com/simibubi/create/foundation/utility/ServerSpeedProvider.java @@ -11,8 +11,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; -import net.minecraftforge.fmllegacy.network.PacketDistributor; +import net.minecraftforge.network.NetworkEvent.Context; +import net.minecraftforge.network.PacketDistributor; public class ServerSpeedProvider { diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/PlacementSimulationWorld.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/PlacementSimulationWorld.java index a49fb790b..efc4598ff 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/PlacementSimulationWorld.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/PlacementSimulationWorld.java @@ -33,7 +33,7 @@ public class PlacementSimulationWorld extends WrappedWorld implements IFlywheelW public PlacementSimulationWorld(Level wrapped, WrappedChunkProvider chunkProvider) { super(wrapped, chunkProvider); - this.chunkProvider = chunkProvider.setWorld(this); + this.chunkProvider = chunkProvider.setPlacementWorld(this); spannedSections = new HashSet<>(); lighter = new LevelLightEngine(chunkProvider, true, false); // blockLight, skyLight blocksAdded = new HashMap<>(); diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedChunkProvider.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedChunkProvider.java index 072d46a30..9b82e8c21 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedChunkProvider.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedChunkProvider.java @@ -13,70 +13,76 @@ import com.simibubi.create.foundation.utility.worldWrappers.chunk.WrappedChunk; import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.Level; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkSource; import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.lighting.LevelLightEngine; public class WrappedChunkProvider extends ChunkSource { - private PlacementSimulationWorld world; + private PlacementSimulationWorld world; + private Level fallbackWorld; - public HashMap chunks; + public HashMap chunks; - public WrappedChunkProvider setWorld(PlacementSimulationWorld world) { - this.world = world; - this.chunks = new HashMap<>(); - return this; - } + public WrappedChunkProvider setFallbackWorld(Level world) { + fallbackWorld = world; + return this; + } + + public WrappedChunkProvider setPlacementWorld(PlacementSimulationWorld world) { + fallbackWorld = this.world = world; + this.chunks = new HashMap<>(); + return this; + } - public Stream getLightSources() { - return world.blocksAdded - .entrySet() - .stream() - .filter(it -> it.getValue().getLightEmission(world, it.getKey()) != 0) - .map(Map.Entry::getKey); - } + public Stream getLightSources() { + return world.blocksAdded.entrySet() + .stream() + .filter(it -> it.getValue() + .getLightEmission(world, it.getKey()) != 0) + .map(Map.Entry::getKey); + } - @Nullable - @Override - public BlockGetter getChunkForLighting(int x, int z) { - return getChunk(x, z); - } - - @Override - public BlockGetter getLevel() { - return world; - } - - @Nullable - @Override - public ChunkAccess getChunk(int x, int z, ChunkStatus status, boolean p_212849_4_) { - return getChunk(x, z); - } - - public ChunkAccess getChunk(int x, int z) { - long pos = ChunkPos.asLong(x, z); - - if (chunks == null) - return new EmptierChunk(); - - return chunks.computeIfAbsent(pos, $ -> new WrappedChunk(world, x, z)); - } - - @Override - public String gatherStats() { - return "WrappedChunkProvider"; - } - - @Override - public LevelLightEngine getLightEngine() { - return world.getLightEngine(); - } + @Nullable + @Override + public BlockGetter getChunkForLighting(int x, int z) { + return getChunk(x, z); + } @Override - public void tick(BooleanSupplier pHasTimeLeft) { + public Level getLevel() { + return fallbackWorld; } + @Nullable + @Override + public ChunkAccess getChunk(int x, int z, ChunkStatus status, boolean p_212849_4_) { + return getChunk(x, z); + } + + public ChunkAccess getChunk(int x, int z) { + long pos = ChunkPos.asLong(x, z); + + if (chunks == null) + return new EmptierChunk(fallbackWorld.registryAccess()); + + return chunks.computeIfAbsent(pos, $ -> new WrappedChunk(world, x, z)); + } + + @Override + public String gatherStats() { + return "WrappedChunkProvider"; + } + + @Override + public LevelLightEngine getLightEngine() { + return world.getLightEngine(); + } + + @Override + public void tick(BooleanSupplier pHasTimeLeft) {} + @Override public int getLoadedChunksCount() { return 0; diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedClientWorld.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedClientWorld.java index 12786d31d..3483ff287 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedClientWorld.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedClientWorld.java @@ -38,7 +38,9 @@ public class WrappedClientWorld extends ClientLevel { protected Level world; private WrappedClientWorld(Level world) { - super(mc.getConnection(), mc.level.getLevelData(), world.dimension(), world.dimensionType(), mc.getConnection().serverChunkRadius, world.getProfilerSupplier(), mc.levelRenderer, world.isDebug(), world.getBiomeManager().biomeZoomSeed); + super(mc.getConnection(), mc.level.getLevelData(), world.dimension(), world.dimensionType(), + mc.getConnection().serverChunkRadius, mc.level.getServerSimulationDistance(), + world.getProfilerSupplier(), mc.levelRenderer, world.isDebug(), world.getBiomeManager().biomeZoomSeed); this.world = world; } @@ -56,16 +58,6 @@ public class WrappedClientWorld extends ClientLevel { return world.isLoaded(pos); } - @Override - public Stream getBlockCollisions(@Nullable Entity entity, AABB AABB) { - return world.getBlockCollisions(entity, AABB); - } - - @Override - public Stream getBlockCollisions(@Nullable Entity entity, AABB AABB, BiPredicate blockStateBlockPosBiPredicate) { - return world.getBlockCollisions(entity, AABB, blockStateBlockPosBiPredicate); - } - @Override public BlockState getBlockState(BlockPos pos) { return world.getBlockState(pos); diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedServerWorld.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedServerWorld.java index c528d1f62..db9c3065c 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedServerWorld.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedServerWorld.java @@ -19,8 +19,6 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.level.Level; -import net.minecraft.world.level.ServerTickList; -import net.minecraft.world.level.TickList; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; @@ -28,6 +26,7 @@ import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.saveddata.maps.MapItemSavedData; import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraft.world.level.storage.ServerLevelData; +import net.minecraft.world.ticks.LevelTicks; import net.minecraftforge.fml.util.ObfuscationReflectionHelper; @ParametersAreNonnullByDefault @@ -60,19 +59,13 @@ public class WrappedServerWorld extends ServerLevel { } @Override - public ServerTickList getBlockTicks() { - TickList tl = world.getBlockTicks(); - if (tl instanceof ServerTickList) - return (ServerTickList) tl; + public LevelTicks getBlockTicks() { return super.getBlockTicks(); } - + @Override - public ServerTickList getLiquidTicks() { - TickList tl = world.getLiquidTicks(); - if (tl instanceof ServerTickList) - return (ServerTickList) tl; - return super.getLiquidTicks(); + public LevelTicks getFluidTicks() { + return super.getFluidTicks(); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedWorld.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedWorld.java index 7ece96804..fe405971a 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedWorld.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedWorld.java @@ -18,7 +18,6 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.level.Level; -import net.minecraft.world.level.TickList; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; @@ -31,6 +30,7 @@ import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.saveddata.maps.MapItemSavedData; import net.minecraft.world.level.storage.WritableLevelData; import net.minecraft.world.scores.Scoreboard; +import net.minecraft.world.ticks.LevelTickAccess; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault @@ -92,13 +92,13 @@ public class WrappedWorld extends Level { } @Override - public TickList getBlockTicks() { + public LevelTickAccess getBlockTicks() { return world.getBlockTicks(); } - + @Override - public TickList getLiquidTicks() { - return world.getLiquidTicks(); + public LevelTickAccess getFluidTicks() { + return world.getFluidTicks(); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/EmptierChunk.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/EmptierChunk.java index 00de4000d..a800298e9 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/EmptierChunk.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/EmptierChunk.java @@ -1,21 +1,23 @@ package com.simibubi.create.foundation.utility.worldWrappers.chunk; import java.util.List; +import java.util.function.Supplier; import javax.annotation.Nullable; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.RegistryAccess; +import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ChunkHolder; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; import net.minecraft.tags.TagContainer; +import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.level.Level; -import net.minecraft.world.level.TickList; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -30,21 +32,25 @@ 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.saveddata.maps.MapItemSavedData; +import net.minecraft.world.level.storage.WritableLevelData; import net.minecraft.world.scores.Scoreboard; +import net.minecraft.world.ticks.BlackholeTickAccess; +import net.minecraft.world.ticks.LevelTickAccess; import net.minecraftforge.fml.util.ObfuscationReflectionHelper; public class EmptierChunk extends LevelChunk { - private static final Level DUMMY_LEVEL = new Level(null, null, ObfuscationReflectionHelper.getPrivateValue(DimensionType.class, null, "f_63848_"), null, false, false, 0) { + private static final class DummyLevel extends Level { + RegistryAccess access; - @Override - public TickList getBlockTicks() { - return null; + private DummyLevel(WritableLevelData p_46450_, ResourceKey p_46451_, DimensionType p_46452_, + Supplier p_46453_, boolean p_46454_, boolean p_46455_, long p_46456_) { + super(p_46450_, p_46451_, p_46452_, p_46453_, p_46454_, p_46455_, p_46456_); } - @Override - public TickList getLiquidTicks() { - return null; + public Level withAccess(RegistryAccess access) { + this.access = access; + return this; } @Override @@ -53,16 +59,14 @@ public class EmptierChunk extends LevelChunk { } @Override - public void levelEvent(Player pPlayer, int pType, BlockPos pPos, int pData) { - } + public void levelEvent(Player pPlayer, int pType, BlockPos pPos, int pData) {} @Override - public void gameEvent(Entity pEntity, GameEvent pEvent, BlockPos pPos) { - } + public void gameEvent(Entity pEntity, GameEvent pEvent, BlockPos pPos) {} @Override public RegistryAccess registryAccess() { - return null; + return access; } @Override @@ -81,18 +85,15 @@ public class EmptierChunk extends LevelChunk { } @Override - public void sendBlockUpdated(BlockPos pPos, BlockState pOldState, BlockState pNewState, int pFlags) { - } + public void sendBlockUpdated(BlockPos pPos, BlockState pOldState, BlockState pNewState, int pFlags) {} @Override public void playSound(Player pPlayer, double pX, double pY, double pZ, SoundEvent pSound, SoundSource pCategory, - float pVolume, float pPitch) { - } + float pVolume, float pPitch) {} @Override public void playSound(Player pPlayer, Entity pEntity, SoundEvent pEvent, SoundSource pCategory, float pVolume, - float pPitch) { - } + float pPitch) {} @Override public String gatherChunkSourceStats() { @@ -110,8 +111,7 @@ public class EmptierChunk extends LevelChunk { } @Override - public void setMapData(String pMapId, MapItemSavedData pData) { - } + public void setMapData(String pMapId, MapItemSavedData pData) {} @Override public int getFreeMapId() { @@ -119,8 +119,7 @@ public class EmptierChunk extends LevelChunk { } @Override - public void destroyBlockProgress(int pBreakerId, BlockPos pPos, int pProgress) { - } + public void destroyBlockProgress(int pBreakerId, BlockPos pPos, int pProgress) {} @Override public Scoreboard getScoreboard() { @@ -141,11 +140,23 @@ public class EmptierChunk extends LevelChunk { protected LevelEntityGetter getEntities() { return null; } - - }; - public EmptierChunk() { - super(DUMMY_LEVEL, null, null); + @Override + public LevelTickAccess getBlockTicks() { + return BlackholeTickAccess.emptyLevelList(); + } + + @Override + public LevelTickAccess getFluidTicks() { + return BlackholeTickAccess.emptyLevelList(); + } + } + + private static final DummyLevel DUMMY_LEVEL = new DummyLevel(null, null, + ObfuscationReflectionHelper.getPrivateValue(DimensionType.class, null, "f_63848_"), null, false, false, 0); + + public EmptierChunk(RegistryAccess registryAccess) { + super(DUMMY_LEVEL.withAccess(registryAccess), null); } public BlockState getBlockState(BlockPos p_180495_1_) { @@ -170,13 +181,13 @@ public class EmptierChunk extends LevelChunk { return null; } - public void addAndRegisterBlockEntity(BlockEntity p_150813_1_) { } + public void addAndRegisterBlockEntity(BlockEntity p_150813_1_) {} - public void setBlockEntity(BlockEntity p_177426_2_) { } + public void setBlockEntity(BlockEntity p_177426_2_) {} - public void removeBlockEntity(BlockPos p_177425_1_) { } + public void removeBlockEntity(BlockPos p_177425_1_) {} - public void markUnsaved() { } + public void markUnsaved() {} public boolean isEmpty() { return true; diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunk.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunk.java index aad2e47fc..fbca9d03b 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunk.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunk.java @@ -12,195 +12,170 @@ import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationW import it.unimi.dsi.fastutil.longs.LongSet; import it.unimi.dsi.fastutil.shorts.ShortList; import net.minecraft.core.BlockPos; +import net.minecraft.core.Registry; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.TickList; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkBiomeContainer; import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.level.chunk.UpgradeData; import net.minecraft.world.level.levelgen.Heightmap; -import net.minecraft.world.level.levelgen.Heightmap.Types; import net.minecraft.world.level.levelgen.feature.StructureFeature; import net.minecraft.world.level.levelgen.structure.StructureStart; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.ticks.BlackholeTickAccess; +import net.minecraft.world.ticks.TickContainerAccess; -public class WrappedChunk implements ChunkAccess { +public class WrappedChunk extends ChunkAccess { - final PlacementSimulationWorld world; - boolean needsLight; - final int x; - final int z; - final ChunkPos pos; + final PlacementSimulationWorld world; + boolean needsLight; + final int x; + final int z; - private final LevelChunkSection[] sections; + private final LevelChunkSection[] sections; - public WrappedChunk(PlacementSimulationWorld world, int x, int z) { - this.world = world; - this.needsLight = true; - this.x = x; - this.z = z; - this.pos = new ChunkPos(x, z); + public WrappedChunk(PlacementSimulationWorld world, int x, int z) { + super(new ChunkPos(x, z), UpgradeData.EMPTY, world, world.registryAccess() + .registry(Registry.BIOME_REGISTRY) + .orElseThrow(), 0L, null, null); - this.sections = new LevelChunkSection[16]; + this.world = world; + this.needsLight = true; + this.x = x; + this.z = z; - for (int i = 0; i < 16; i++) { - sections[i] = new WrappedChunkSection(this, i << 4); - } - } + this.sections = new LevelChunkSection[16]; - @Override - public Stream getLights() { - return world.blocksAdded - .entrySet() - .stream() - .filter(it -> { - BlockPos blockPos = it.getKey(); - boolean chunkContains = blockPos.getX() >> 4 == x && blockPos.getZ() >> 4 == z; - return chunkContains && it.getValue().getLightEmission(world, blockPos) != 0; - }) - .map(Map.Entry::getKey); - } + for (int i = 0; i < 16; i++) { + sections[i] = new WrappedChunkSection(this, i << 4); + } + } - @Override - public LevelChunkSection[] getSections() { - return sections; - } + @Override + public Stream getLights() { + return world.blocksAdded.entrySet() + .stream() + .filter(it -> { + BlockPos blockPos = it.getKey(); + boolean chunkContains = blockPos.getX() >> 4 == x && blockPos.getZ() >> 4 == z; + return chunkContains && it.getValue() + .getLightEmission(world, blockPos) != 0; + }) + .map(Map.Entry::getKey); + } - @Override - public ChunkStatus getStatus() { - return ChunkStatus.LIGHT; - } + @Override + public LevelChunkSection[] getSections() { + return sections; + } - @Nullable - @Override - public BlockState setBlockState(BlockPos p_177436_1_, BlockState p_177436_2_, boolean p_177436_3_) { - return null; - } + @Override + public ChunkStatus getStatus() { + return ChunkStatus.LIGHT; + } - @Override - public void setBlockEntity(BlockEntity p_177426_2_) { - } + @Nullable + @Override + public BlockState setBlockState(BlockPos p_177436_1_, BlockState p_177436_2_, boolean p_177436_3_) { + return null; + } - @Override - public void addEntity(Entity p_76612_1_) { - } + @Override + public void setBlockEntity(BlockEntity p_177426_2_) {} - @Override - public Set getBlockEntitiesPos() { - return null; - } + @Override + public void addEntity(Entity p_76612_1_) {} - @Override - public Collection> getHeightmaps() { - return null; - } + @Override + public Set getBlockEntitiesPos() { + return null; + } - @Override - public void setHeightmap(Heightmap.Types p_201607_1_, long[] p_201607_2_) { - } + @Override + public Collection> getHeightmaps() { + return null; + } - @Override - public Heightmap getOrCreateHeightmapUnprimed(Heightmap.Types p_217303_1_) { - return null; - } + @Override + public void setHeightmap(Heightmap.Types p_201607_1_, long[] p_201607_2_) {} - @Override - public int getHeight(Heightmap.Types p_201576_1_, int p_201576_2_, int p_201576_3_) { - return 0; - } + @Override + public Heightmap getOrCreateHeightmapUnprimed(Heightmap.Types p_217303_1_) { + return null; + } - @Override - public ChunkPos getPos() { - return pos; - } + @Override + public int getHeight(Heightmap.Types p_201576_1_, int p_201576_2_, int p_201576_3_) { + return 0; + } - @Nullable - @Override - public ChunkBiomeContainer getBiomes() { - return null; - } + @Override + public void setUnsaved(boolean p_177427_1_) {} - @Override - public void setUnsaved(boolean p_177427_1_) { - } + @Override + public boolean isUnsaved() { + return false; + } - @Override - public boolean isUnsaved() { - return false; - } + @Override + public void removeBlockEntity(BlockPos p_177425_1_) {} - @Override - public void removeBlockEntity(BlockPos p_177425_1_) { - } + @Override + public ShortList[] getPostProcessing() { + return new ShortList[0]; + } - @Override - public ShortList[] getPostProcessing() { - return new ShortList[0]; - } + @Nullable + @Override + public CompoundTag getBlockEntityNbt(BlockPos p_201579_1_) { + return null; + } - @Nullable - @Override - public CompoundTag getBlockEntityNbt(BlockPos p_201579_1_) { - return null; - } + @Nullable + @Override + public CompoundTag getBlockEntityNbtForSaving(BlockPos p_223134_1_) { + return null; + } - @Nullable - @Override - public CompoundTag getBlockEntityNbtForSaving(BlockPos p_223134_1_) { - return null; - } + @Override + public UpgradeData getUpgradeData() { + return null; + } - @Override - public TickList getBlockTicks() { - return null; - } + @Override + public void setInhabitedTime(long p_177415_1_) {} - @Override - public TickList getLiquidTicks() { - return null; - } + @Override + public long getInhabitedTime() { + return 0; + } - @Override - public UpgradeData getUpgradeData() { - return null; - } + @Override + public boolean isLightCorrect() { + return needsLight; + } - @Override - public void setInhabitedTime(long p_177415_1_) { - } + @Override + public void setLightCorrect(boolean needsLight) { + this.needsLight = needsLight; + } - @Override - public long getInhabitedTime() { - return 0; - } + @Nullable + @Override + public BlockEntity getBlockEntity(BlockPos pos) { + return null; + } - @Override - public boolean isLightCorrect() { - return needsLight; - } - - @Override - public void setLightCorrect(boolean needsLight) { - this.needsLight = needsLight; - } - - @Nullable - @Override - public BlockEntity getBlockEntity(BlockPos pos) { - return null; - } - - @Override - public BlockState getBlockState(BlockPos pos) { - return world.getBlockState(pos); - } + @Override + public BlockState getBlockState(BlockPos pos) { + return world.getBlockState(pos); + } @Override public FluidState getFluidState(BlockPos p_204610_1_) { @@ -208,8 +183,7 @@ public class WrappedChunk implements ChunkAccess { } @Override - public void addReferenceForFeature(StructureFeature arg0, long arg1) { - } + public void addReferenceForFeature(StructureFeature arg0, long arg1) {} @Override public Map, LongSet> getAllReferences() { @@ -227,16 +201,13 @@ public class WrappedChunk implements ChunkAccess { } @Override - public void setAllReferences(Map, LongSet> arg0) { - } + public void setAllReferences(Map, LongSet> arg0) {} @Override - public void setStartForFeature(StructureFeature arg0, StructureStart arg1) { - } + public void setStartForFeature(StructureFeature arg0, StructureStart arg1) {} @Override - public void setAllStarts(Map, StructureStart> p_201612_1_) { - } + public void setAllStarts(Map, StructureStart> p_201612_1_) {} @Override public Map, StructureStart> getAllStarts() { @@ -254,8 +225,18 @@ public class WrappedChunk implements ChunkAccess { } @Override - public BlockPos getHeighestPosition(Types pType) { - return BlockPos.ZERO; + public TickContainerAccess getFluidTicks() { + return BlackholeTickAccess.emptyContainer(); + } + + @Override + public TicksToSave getTicksForSerialization() { + return null; + } + + @Override + public TickContainerAccess getBlockTicks() { + return BlackholeTickAccess.emptyContainer(); } } diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunkSection.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunkSection.java index bde5b28f8..6478ba4ee 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunkSection.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunkSection.java @@ -1,32 +1,39 @@ package com.simibubi.create.foundation.utility.worldWrappers.chunk; +import net.minecraft.core.Registry; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.LevelChunkSection; public class WrappedChunkSection extends LevelChunkSection { - public WrappedChunk owner; + public WrappedChunk owner; - public final int xStart; - public final int yStart; - public final int zStart; + public final int xStart; + public final int yStart; + public final int zStart; - public WrappedChunkSection(WrappedChunk owner, int yBase) { - super(yBase); - this.owner = owner; - this.xStart = owner.pos.getMinBlockX(); - this.yStart = yBase; - this.zStart = owner.pos.getMinBlockZ(); - } + public WrappedChunkSection(WrappedChunk owner, int yBase) { + super(yBase, owner.world.registryAccess() + .registry(Registry.BIOME_REGISTRY) + .orElseThrow()); + this.owner = owner; + this.xStart = owner.getPos() + .getMinBlockX(); + this.yStart = yBase; + this.zStart = owner.getPos() + .getMinBlockZ(); + } - @Override - public BlockState getBlockState(int x, int y, int z) { - // ChunkSection#getBlockState expects local chunk coordinates, so we add to get back into world coords. - return owner.world.getBlockState(x + xStart, y + yStart, z + zStart); - } + @Override + public BlockState getBlockState(int x, int y, int z) { + // ChunkSection#getBlockState expects local chunk coordinates, so we add to get + // back into world coords. + return owner.world.getBlockState(x + xStart, y + yStart, z + zStart); + } - @Override - public BlockState setBlockState(int p_177484_1_, int p_177484_2_, int p_177484_3_, BlockState p_177484_4_, boolean p_177484_5_) { - throw new IllegalStateException("Chunk sections should not be mutated in a fake world."); - } + @Override + public BlockState setBlockState(int p_177484_1_, int p_177484_2_, int p_177484_3_, BlockState p_177484_4_, + boolean p_177484_5_) { + throw new IllegalStateException("Chunk sections should not be mutated in a fake world."); + } } diff --git a/src/main/java/com/simibubi/create/foundation/worldgen/AllWorldFeatures.java b/src/main/java/com/simibubi/create/foundation/worldgen/AllWorldFeatures.java index 60434ba6a..5095e39d4 100644 --- a/src/main/java/com/simibubi/create/foundation/worldgen/AllWorldFeatures.java +++ b/src/main/java/com/simibubi/create/foundation/worldgen/AllWorldFeatures.java @@ -6,15 +6,19 @@ import java.util.Map; import com.simibubi.create.AllBlocks; import com.simibubi.create.Create; import com.simibubi.create.foundation.utility.Couple; +import com.simibubi.create.foundation.utility.Pair; import net.minecraft.core.Registry; import net.minecraft.data.BuiltinRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.biome.Biome.BiomeCategory; import net.minecraft.world.level.levelgen.GenerationStep; +import net.minecraft.world.level.levelgen.GenerationStep.Decoration; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.Feature; -import net.minecraft.world.level.levelgen.placement.FeatureDecorator; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; import net.minecraftforge.common.ForgeConfigSpec; +import net.minecraftforge.common.world.BiomeGenerationSettingsBuilder; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.world.BiomeLoadingEvent; @@ -29,11 +33,11 @@ public class AllWorldFeatures { // - public static final ConfigDrivenFeatureEntry ZINC_ORE = register("zinc_ore", 12, 3, OVERWORLD_BIOMES).between(1, 70) + public static final ConfigDrivenFeatureEntry ZINC_ORE = register("zinc_ore", 12, 8, OVERWORLD_BIOMES).between(-63, 70) .withBlocks(Couple.create(AllBlocks.ZINC_ORE, AllBlocks.DEEPSLATE_ZINC_ORE)); public static final ConfigDrivenFeatureEntry STRIATED_ORES_OVERWORLD = - register("striated_ores_overworld", 32, 1 / 18f, OVERWORLD_BIOMES).between(1, 70) + register("striated_ores_overworld", 32, 1 / 9f, OVERWORLD_BIOMES).between(-63, 70) .withLayerPattern(AllLayerPatterns.SCORIA) .withLayerPattern(AllLayerPatterns.CINNABAR) .withLayerPattern(AllLayerPatterns.MAGNETITE) @@ -66,18 +70,24 @@ public class AllWorldFeatures { public static void registerFeatures() { ENTRIES.entrySet() .forEach(entry -> { - Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, Create.ID + "_" + entry.getKey() - .getPath(), entry.getValue() - .getFeature()); + String id = Create.ID + "_" + entry.getKey() + .getPath(); + ConfigDrivenFeatureEntry value = entry.getValue(); + Pair, PlacedFeature> feature = value.getFeature(); + Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, feature.getFirst()); + Registry.register(BuiltinRegistries.PLACED_FEATURE, id, feature.getSecond()); }); } public static void reload(BiomeLoadingEvent event) { + BiomeGenerationSettingsBuilder generation = event.getGeneration(); + Decoration decoStep = GenerationStep.Decoration.UNDERGROUND_ORES; ENTRIES.values() .forEach(entry -> { - if (entry.biomeFilter.test(event.getName(), event.getCategory())) - event.getGeneration() - .addFeature(GenerationStep.Decoration.UNDERGROUND_ORES, entry.getFeature()); + if (!entry.biomeFilter.test(event.getName(), event.getCategory())) + return; + generation.addFeature(decoStep, entry.getFeature() + .getSecond()); }); } @@ -97,9 +107,9 @@ public class AllWorldFeatures { .registerAll(VanillaStyleOreFeature.INSTANCE, LayeredOreFeature.INSTANCE); } - public static void registerDecoratorFeatures(RegistryEvent.Register> event) { - event.getRegistry() - .register(ConfigDrivenDecorator.INSTANCE); + public static void registerPlacementTypes() { + ConfigDrivenDecorator.TYPE = + Registry.register(Registry.PLACEMENT_MODIFIERS, "create_config_driven", () -> ConfigDrivenDecorator.CODEC); } } diff --git a/src/main/java/com/simibubi/create/foundation/worldgen/ConfigDrivenDecorator.java b/src/main/java/com/simibubi/create/foundation/worldgen/ConfigDrivenDecorator.java index 916f8c609..26f4a49ba 100644 --- a/src/main/java/com/simibubi/create/foundation/worldgen/ConfigDrivenDecorator.java +++ b/src/main/java/com/simibubi/create/foundation/worldgen/ConfigDrivenDecorator.java @@ -4,24 +4,43 @@ import java.util.Random; import java.util.stream.IntStream; import java.util.stream.Stream; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import com.simibubi.create.Create; + import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; -import net.minecraft.world.level.levelgen.placement.DecorationContext; -import net.minecraft.world.level.levelgen.placement.FeatureDecorator; +import net.minecraft.world.level.levelgen.placement.PlacementContext; +import net.minecraft.world.level.levelgen.placement.PlacementModifier; +import net.minecraft.world.level.levelgen.placement.PlacementModifierType; -public class ConfigDrivenDecorator extends FeatureDecorator { +public class ConfigDrivenDecorator extends PlacementModifier { - public static final ConfigDrivenDecorator INSTANCE = new ConfigDrivenDecorator(); + public static PlacementModifierType TYPE; - public ConfigDrivenDecorator() { - super(ConfigDrivenOreConfiguration.CODEC); - setRegistryName("config_driven_decorator"); + public static final Codec CODEC = RecordCodecBuilder.create((p_67849_) -> { + return p_67849_.group(Codec.STRING.fieldOf("key") + .forGetter(t -> t.key.getPath())) + .apply(p_67849_, ConfigDrivenDecorator::new); + }); + + private ResourceLocation key; + + public ConfigDrivenDecorator(String key) { + this.key = Create.asResource(key); } @Override - public Stream getPositions(DecorationContext context, Random random, ConfigDrivenOreConfiguration config, BlockPos pos) { - float frequency = config.getFrequency(); + public PlacementModifierType type() { + return TYPE; + } + @Override + public Stream getPositions(PlacementContext context, Random random, BlockPos pos) { + ConfigDrivenOreConfiguration config = (ConfigDrivenOreConfiguration) entry().getFeature() + .getFirst().config; + float frequency = config.getFrequency(); int floored = Mth.floor(frequency); int count = floored + (random.nextFloat() < frequency - floored ? 1 : 0); if (count == 0) @@ -40,4 +59,8 @@ public class ConfigDrivenDecorator extends FeatureDecorator> factory; - Optional> feature = Optional.empty(); + Optional, PlacedFeature>> feature = Optional.empty(); public ConfigDrivenFeatureEntry(String id, int clusterSize, float frequency) { this.id = id; @@ -71,14 +74,16 @@ public class ConfigDrivenFeatureEntry extends ConfigBase { public ConfigDrivenFeatureEntry between(int minHeight, int maxHeight) { allValues.remove(this.minHeight); allValues.remove(this.maxHeight); - this.minHeight = i(minHeight, 0, "minHeight"); - this.maxHeight = i(maxHeight, 0, "maxHeight"); + this.minHeight = i(minHeight, -64, "minHeight"); + this.maxHeight = i(maxHeight, -64, "maxHeight"); return this; } - public ConfiguredFeature getFeature() { - if (!feature.isPresent()) - feature = Optional.of(factory.apply(this)); + public Pair, PlacedFeature> getFeature() { + if (!feature.isPresent()) { + ConfiguredFeature configured = factory.apply(this); + feature = Optional.of(Pair.of(configured, configured.placed(new ConfigDrivenDecorator(id)))); + } return feature.get(); } @@ -87,26 +92,24 @@ public class ConfigDrivenFeatureEntry extends ConfigBase { LayeredOreFeature.LAYER_PATTERNS.put(Create.asResource(id), layers.stream() .map(NonNullSupplier::get) .toList()); - return LayeredOreFeature.INSTANCE.configured(config) - .decorated(ConfigDrivenDecorator.INSTANCE.configured(config)); + return LayeredOreFeature.INSTANCE.configured(config); } private ConfiguredFeature standardFactory(ConfigDrivenFeatureEntry entry) { ConfigDrivenOreConfiguration config = new ConfigDrivenOreConfiguration(createTarget(), 0, id); - return VanillaStyleOreFeature.INSTANCE.configured(config) - .decorated(ConfigDrivenDecorator.INSTANCE.configured(config)); + return VanillaStyleOreFeature.INSTANCE.configured(config); } private List createTarget() { List list = new ArrayList<>(); if (block != null) - list.add(OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, block.get() + list.add(OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, block.get() .defaultBlockState())); if (deepblock != null) - list.add(OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, deepblock.get() + list.add(OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, deepblock.get() .defaultBlockState())); if (netherblock != null) - list.add(OreConfiguration.target(OreConfiguration.Predicates.NETHER_ORE_REPLACEABLES, netherblock.get() + list.add(OreConfiguration.target(OreFeatures.NETHER_ORE_REPLACEABLES, netherblock.get() .defaultBlockState())); return list; } diff --git a/src/main/java/com/simibubi/create/foundation/worldgen/ConfigDrivenOreConfiguration.java b/src/main/java/com/simibubi/create/foundation/worldgen/ConfigDrivenOreConfiguration.java index 2a7235eaa..7c567861f 100644 --- a/src/main/java/com/simibubi/create/foundation/worldgen/ConfigDrivenOreConfiguration.java +++ b/src/main/java/com/simibubi/create/foundation/worldgen/ConfigDrivenOreConfiguration.java @@ -8,11 +8,10 @@ import com.simibubi.create.Create; import com.simibubi.create.foundation.config.AllConfigs; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.levelgen.feature.configurations.DecoratorConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration.TargetBlockState; -public class ConfigDrivenOreConfiguration implements FeatureConfiguration, DecoratorConfiguration { +public class ConfigDrivenOreConfiguration implements FeatureConfiguration { public static final Codec CODEC = RecordCodecBuilder.create((p_67849_) -> { return p_67849_.group(Codec.list(TargetBlockState.CODEC) diff --git a/src/main/java/com/simibubi/create/foundation/worldgen/LayerPattern.java b/src/main/java/com/simibubi/create/foundation/worldgen/LayerPattern.java index 19b721601..07676a335 100644 --- a/src/main/java/com/simibubi/create/foundation/worldgen/LayerPattern.java +++ b/src/main/java/com/simibubi/create/foundation/worldgen/LayerPattern.java @@ -11,6 +11,7 @@ import com.simibubi.create.foundation.utility.Couple; import com.simibubi.create.foundation.worldgen.LayerPattern.Layer.LayerBuilder; import com.tterrag.registrate.util.nullness.NonNullSupplier; +import net.minecraft.data.worldgen.features.OreFeatures; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; @@ -111,7 +112,7 @@ public class LayerPattern { public LayerBuilder block(Block block) { if (netherMode) { Layer.this.targets.add(ImmutableList.of(OreConfiguration - .target(OreConfiguration.Predicates.NETHER_ORE_REPLACEABLES, block.defaultBlockState()))); + .target(OreFeatures.NETHER_ORE_REPLACEABLES, block.defaultBlockState()))); return this; } return blocks(block.defaultBlockState(), block.defaultBlockState()); @@ -128,8 +129,8 @@ public class LayerPattern { private LayerBuilder blocks(BlockState stone, BlockState deepslate) { Layer.this.targets.add( - ImmutableList.of(OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, stone), - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, deepslate))); + ImmutableList.of(OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, stone), + OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, deepslate))); return this; } diff --git a/src/main/java/com/simibubi/create/foundation/worldgen/LayeredOreFeature.java b/src/main/java/com/simibubi/create/foundation/worldgen/LayeredOreFeature.java index 82aa6937b..9b17ba183 100644 --- a/src/main/java/com/simibubi/create/foundation/worldgen/LayeredOreFeature.java +++ b/src/main/java/com/simibubi/create/foundation/worldgen/LayeredOreFeature.java @@ -17,7 +17,6 @@ import net.minecraft.util.Mth; import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.BulkSectionAccess; -import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; @@ -122,7 +121,7 @@ public class LayeredOreFeature extends OreFeatureBase { if (!worldgenlevel.ensureCanWrite(mutablePos)) continue; LevelChunkSection levelchunksection = bulksectionaccess.getSection(mutablePos); - if (levelchunksection == LevelChunk.EMPTY_SECTION) + if (levelchunksection == null) continue; int i3 = SectionPos.sectionRelative(currentX); diff --git a/src/main/java/com/simibubi/create/foundation/worldgen/VanillaStyleOreFeature.java b/src/main/java/com/simibubi/create/foundation/worldgen/VanillaStyleOreFeature.java index 36bc5c3c8..011ccda9d 100644 --- a/src/main/java/com/simibubi/create/foundation/worldgen/VanillaStyleOreFeature.java +++ b/src/main/java/com/simibubi/create/foundation/worldgen/VanillaStyleOreFeature.java @@ -9,7 +9,6 @@ import net.minecraft.util.Mth; import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.BulkSectionAccess; -import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; @@ -139,7 +138,7 @@ public class VanillaStyleOreFeature extends OreFeatureBase { continue; LevelChunkSection levelchunksection = bulksectionaccess.getSection(blockpos$mutableblockpos); - if (levelchunksection == LevelChunk.EMPTY_SECTION) + if (levelchunksection == null) continue; int i3 = SectionPos.sectionRelative(i2); int j3 = SectionPos.sectionRelative(j2); diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index b2e96ced7..e85ae9800 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -4,17 +4,8 @@ public net.minecraft.client.multiplayer.ClientPacketListener f_104897_ # serverC # For CubeParticle protected net.minecraft.client.particle.Particle f_107205_ # stoppedByCollision -# Needed for ChunkUtil, maybe remove these for releases -# ChunkMap -public net.minecraft.server.level.ChunkMap f_140129_ # updatingChunkMap -public net.minecraft.server.level.ChunkMap f_140140_ # modified -public net.minecraft.server.level.ChunkMap f_140131_ # pendingUnloads -public net.minecraft.server.level.ChunkMap m_140181_(JLnet/minecraft/server/level/ChunkHolder;)V # scheduleUnload - # ChunkStatus public-f net.minecraft.world.level.chunk.ChunkStatus f_62326_ # FULL -public net.minecraft.world.level.chunk.ChunkStatus$GenerationTask -public net.minecraft.world.level.chunk.ChunkStatus$LoadingTask # PotionBrewing public net.minecraft.world.item.alchemy.PotionBrewing f_43496_ # ALLOWED_CONTAINERS @@ -42,6 +33,7 @@ public net.minecraft.client.renderer.ItemInHandRenderer f_109300_ # mainHandItem public net.minecraft.client.renderer.ItemInHandRenderer f_109301_ # offHandItem # PaletteResize +public net.minecraft.world.level.chunk.HashMapPalette f_62658_ # values public net.minecraft.world.level.chunk.PaletteResize public net.minecraft.world.entity.LivingEntity m_21060_(Lnet/minecraft/world/item/ItemStack;I)V # spawnItemParticles diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 9b87d854e..2c073cb7e 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,5 +1,5 @@ modLoader="javafml" -loaderVersion="[37,)" +loaderVersion="[38,)" issueTrackerURL="https://github.com/Creators-of-Create/Create/issues" license="MIT" @@ -18,20 +18,20 @@ Technology that empowers the player.''' [[dependencies.create]] modId="forge" mandatory=true - versionRange="[37.1.0,)" + versionRange="[38.0.0,)" ordering="NONE" side="BOTH" [[dependencies.create]] modId="minecraft" mandatory=true - versionRange="[1.17.1,1.18)" + versionRange="[1.18,1.19)" ordering="NONE" side="BOTH" [[dependencies.create]] modId="flywheel" mandatory=true - versionRange="[1.17-0.3.0,1.17-0.3.1)" + versionRange="[1.18-0.3.0,1.18-0.3.1)" ordering="AFTER" side="BOTH" diff --git a/src/main/resources/opt_in/Copper Legacy Pack.zip b/src/main/resources/opt_in/Copper Legacy Pack.zip index 40ee8780084b9812eb22ce87051d48da25e2d08a..7789163a645e05b7ac7d86d65bae96f19eed14e1 100644 GIT binary patch delta 216 zcmbPgI>mHDr(pe*n)cv58WBQK3=9m}K+Fxq1&PVodb!EDsU?Z4pFIr<2+;EIITyAm zh@p7FogZ8NEV^?yw&&MaBQhmw!sHoqX3d@zz9?W)RA5ll zl&CcfSC$G)n=yUnUMQQ%e$cPup@e81Ohe+g z<=nfb)#e2SQv;Mmehc5?X!`Ol?Bx%;ivBQ$wu|%9n(V9c+)ptseQ8m0Z{>|Q5iwo8 zXPw?$3|gR}P;z?eN{8JEM_=r5pCN3V`uT3?>R(I&-pnjqlLG`qH_HgEXBV_*5CK}v z!2oyA