From 179da1d8cfa02fd7003c5314915e8e961b5825fc Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Tue, 30 Nov 2021 22:48:37 +0000 Subject: [PATCH] Update to MC 1.18 - Build fails right now due to module issues, so this won't be pushed to GitHub. - Monitors render transparently when loaded into the world. I don't think this is a 1.17 bug, so not sure what's going on here! --- build.gradle | 17 +++++++++-------- gradle.properties | 4 ++-- .../computercraft/ComputerCraftAPIImpl.java | 2 +- .../computercraft/client/ClientRegistry.java | 4 ++-- .../client/gui/widgets/DynamicImageButton.java | 4 ++-- .../client/render/CableHighlightRenderer.java | 10 +++++----- .../client/render/ItemPocketRenderer.java | 2 +- .../client/render/ItemPrintoutRenderer.java | 10 +++++----- .../client/render/MonitorHighlightRenderer.java | 10 +++++----- .../computercraft/data/LootTableGenerator.java | 2 +- .../computercraft/shared/CommonHooks.java | 12 ++++++------ .../dan200/computercraft/shared/Registry.java | 2 +- .../shared/command/ClientCommands.java | 2 +- .../shared/common/BlockGeneric.java | 2 +- .../shared/common/TileGeneric.java | 7 ++++--- .../shared/computer/blocks/BlockComputer.java | 2 +- .../computer/blocks/BlockComputerBase.java | 6 +++--- .../computer/blocks/TileComputerBase.java | 2 +- .../shared/computer/core/ServerComputer.java | 2 +- .../shared/network/NetworkHandler.java | 10 +++++----- .../shared/network/NetworkMessage.java | 2 +- .../network/client/ChatTableClientMessage.java | 2 +- .../client/ComputerDataClientMessage.java | 2 +- .../client/ComputerDeletedClientMessage.java | 2 +- .../client/ComputerTerminalClientMessage.java | 2 +- .../network/client/MonitorClientMessage.java | 2 +- .../network/client/PlayRecordClientMessage.java | 2 +- .../client/SpeakerMoveClientMessage.java | 2 +- .../client/SpeakerPlayClientMessage.java | 2 +- .../client/SpeakerStopClientMessage.java | 2 +- .../network/client/UpgradesLoadedMessage.java | 2 +- .../network/client/UploadResultMessage.java | 2 +- .../shared/network/container/ContainerData.java | 12 ++++++------ .../server/ComputerActionServerMessage.java | 2 +- .../network/server/ComputerServerMessage.java | 2 +- .../network/server/ContinueUploadMessage.java | 2 +- .../network/server/KeyEventServerMessage.java | 2 +- .../network/server/MouseEventServerMessage.java | 2 +- .../network/server/QueueEventServerMessage.java | 2 +- .../network/server/RequestComputerMessage.java | 2 +- .../network/server/UploadFileMessage.java | 2 +- .../peripheral/diskdrive/TileDiskDrive.java | 2 +- .../peripheral/generic/data/ItemData.java | 4 ++-- .../peripheral/modem/wired/BlockCable.java | 6 +++--- .../peripheral/modem/wired/TileCable.java | 2 +- .../modem/wired/TileWiredModemFull.java | 2 +- .../modem/wireless/BlockWirelessModem.java | 2 +- .../shared/peripheral/monitor/BlockMonitor.java | 2 +- .../peripheral/monitor/MonitorWatcher.java | 2 +- .../shared/peripheral/monitor/TileMonitor.java | 4 ++-- .../shared/peripheral/printer/TilePrinter.java | 2 +- .../speaker/UpgradeSpeakerPeripheral.java | 5 ++--- .../shared/turtle/blocks/BlockTurtle.java | 2 +- .../shared/turtle/core/TurtleBrain.java | 2 +- .../shared/turtle/core/TurtleMoveCommand.java | 2 +- .../shared/turtle/core/TurtlePlaceCommand.java | 4 ++-- .../upgrades/TurtleInventoryCrafting.java | 4 ++-- .../shared/turtle/upgrades/TurtleTool.java | 2 +- .../computercraft/shared/util/IDAssigner.java | 2 +- .../shared/util/TickScheduler.java | 9 +++++---- .../shared/util/WaterloggableHelpers.java | 2 +- src/main/resources/META-INF/mods.toml | 4 ++-- .../computercraft/ingame/mod/ClientHooks.java | 8 ++++---- .../computercraft/ingame/mod/TestHooks.java | 8 ++++---- 64 files changed, 124 insertions(+), 122 deletions(-) diff --git a/build.gradle b/build.gradle index d52d21413..d789ba95a 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { maven { url = 'https://maven.parchmentmc.org' } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:5.1.24' + classpath 'net.minecraftforge.gradle:ForgeGradle:5.1.+' classpath 'org.parchmentmc:librarian:1.+' } } @@ -29,7 +29,7 @@ version = mod_version group = "org.squiddev" archivesBaseName = "cc-tweaked-${mc_version}" -def javaVersion = JavaLanguageVersion.of(16) +def javaVersion = JavaLanguageVersion.of(17) java { toolchain { languageVersion = javaVersion @@ -47,6 +47,7 @@ tasks.withType(JavaExec).configureEach { sourceSets { main.java { + exclude 'dan200/computercraft/shared/integration/jei/**' exclude 'dan200/computercraft/shared/integration/morered/**' } main.resources { @@ -122,7 +123,8 @@ minecraft { } } - mappings channel: 'parchment', version: "${mapping_version}-${mc_version}" + // mappings channel: 'parchment', version: "${mapping_version}-${mc_version}" + mappings channel: 'official', version: mc_version accessTransformer file('src/main/resources/META-INF/accesstransformer.cfg') accessTransformer file('src/testMod/resources/META-INF/accesstransformer.cfg') @@ -151,10 +153,8 @@ dependencies { minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}" - compileOnly fg.deobf("mezz.jei:jei-1.17.1:8.0.0.14:api") - // compileOnly fg.deobf("commoble.morered:morered-1.16.5:2.1.1.0") - - runtimeOnly fg.deobf("mezz.jei:jei-1.17.1:8.0.0.14") + // compileOnly fg.deobf("mezz.jei:jei-1.17.1:8.0.0.14:api") + // runtimeOnly fg.deobf("mezz.jei:jei-1.17.1:8.0.0.14") shade 'org.squiddev:Cobalt:0.5.2-SNAPSHOT' @@ -430,7 +430,8 @@ task setupServer(type: Copy) { if (name != "Client" || project.findProperty('cc.tweaked.clientTests') == 'true') { // Don't run client tests unless explicitly opted into them. They're a bit of a faff // to run and pretty flakey. - check.dependsOn("jacocoTest${name}Report") + // check.dependsOn("jacocoTest${name}Report") + // TODO: Fix this! Doesn't load due to jetbrains annotations appearing twice } } diff --git a/gradle.properties b/gradle.properties index ff056a55d..4d5dda7eb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx3G mod_version=1.99.0 # Minecraft properties (update mods.toml when changing) -mc_version=1.17.1 +mc_version=1.18 mapping_version=2021.09.05 -forge_version=37.0.85 +forge_version=38.0.0 # NO SERIOUSLY, UPDATE mods.toml WHEN CHANGING diff --git a/src/main/java/dan200/computercraft/ComputerCraftAPIImpl.java b/src/main/java/dan200/computercraft/ComputerCraftAPIImpl.java index d2098818e..75cb17776 100644 --- a/src/main/java/dan200/computercraft/ComputerCraftAPIImpl.java +++ b/src/main/java/dan200/computercraft/ComputerCraftAPIImpl.java @@ -38,7 +38,7 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fml.ModList; -import net.minecraftforge.fmllegacy.server.ServerLifecycleHooks; +import net.minecraftforge.server.ServerLifecycleHooks; import javax.annotation.Nonnull; import java.io.File; diff --git a/src/main/java/dan200/computercraft/client/ClientRegistry.java b/src/main/java/dan200/computercraft/client/ClientRegistry.java index e1be11a2e..a25ce8ef2 100644 --- a/src/main/java/dan200/computercraft/client/ClientRegistry.java +++ b/src/main/java/dan200/computercraft/client/ClientRegistry.java @@ -32,7 +32,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ColorHandlerEvent; import net.minecraftforge.client.event.EntityRenderersEvent; import net.minecraftforge.client.event.ModelRegistryEvent; -import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.client.model.ForgeModelBakery; import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -76,7 +76,7 @@ public final class ClientRegistry ModelLoaderRegistry.registerLoader( new ResourceLocation( ComputerCraft.MOD_ID, "turtle" ), TurtleModelLoader.INSTANCE ); for( String model : EXTRA_MODELS ) { - ModelLoader.addSpecialModel( new ModelResourceLocation( new ResourceLocation( ComputerCraft.MOD_ID, model ), "inventory" ) ); + ForgeModelBakery.addSpecialModel( new ModelResourceLocation( new ResourceLocation( ComputerCraft.MOD_ID, model ), "inventory" ) ); } } diff --git a/src/main/java/dan200/computercraft/client/gui/widgets/DynamicImageButton.java b/src/main/java/dan200/computercraft/client/gui/widgets/DynamicImageButton.java index ce6046dfe..f2e8b1518 100644 --- a/src/main/java/dan200/computercraft/client/gui/widgets/DynamicImageButton.java +++ b/src/main/java/dan200/computercraft/client/gui/widgets/DynamicImageButton.java @@ -71,12 +71,12 @@ public class DynamicImageButton extends Button RenderSystem.disableDepthTest(); int yTex = yTexStart; - if( isHovered() ) yTex += yDiffTex; + if( isHoveredOrFocused() ) yTex += yDiffTex; blit( stack, x, y, xTexStart.getAsInt(), yTex, width, height, textureWidth, textureHeight ); RenderSystem.enableDepthTest(); - if( isHovered() ) renderToolTip( stack, mouseX, mouseY ); + if( isHovered ) renderToolTip( stack, mouseX, mouseY ); } @Nonnull diff --git a/src/main/java/dan200/computercraft/client/render/CableHighlightRenderer.java b/src/main/java/dan200/computercraft/client/render/CableHighlightRenderer.java index 274750288..b2f401641 100644 --- a/src/main/java/dan200/computercraft/client/render/CableHighlightRenderer.java +++ b/src/main/java/dan200/computercraft/client/render/CableHighlightRenderer.java @@ -45,8 +45,8 @@ public final class CableHighlightRenderer { BlockHitResult hit = event.getTarget(); BlockPos pos = hit.getBlockPos(); - Level world = event.getInfo().getEntity().getCommandSenderWorld(); - Camera info = event.getInfo(); + Level world = event.getCamera().getEntity().getCommandSenderWorld(); + Camera info = event.getCamera(); BlockState state = world.getBlockState( pos ); @@ -67,9 +67,9 @@ public final class CableHighlightRenderer double yOffset = pos.getY() - cameraPos.y(); double zOffset = pos.getZ() - cameraPos.z(); - VertexConsumer buffer = event.getBuffers().getBuffer( RenderType.lines() ); - Matrix4f matrix4f = event.getMatrix().last().pose(); - Matrix3f normal = event.getMatrix().last().normal(); + VertexConsumer buffer = event.getMultiBufferSource().getBuffer( RenderType.lines() ); + Matrix4f matrix4f = event.getPoseStack().last().pose(); + Matrix3f normal = event.getPoseStack().last().normal(); // TODO: Can we just accesstransformer out LevelRenderer.renderShape? shape.forAllEdges( ( x1, y1, z1, x2, y2, z2 ) -> { float xDelta = (float) (x2 - x1); diff --git a/src/main/java/dan200/computercraft/client/render/ItemPocketRenderer.java b/src/main/java/dan200/computercraft/client/render/ItemPocketRenderer.java index 4a89c2d05..c2c81c0c9 100644 --- a/src/main/java/dan200/computercraft/client/render/ItemPocketRenderer.java +++ b/src/main/java/dan200/computercraft/client/render/ItemPocketRenderer.java @@ -48,7 +48,7 @@ public final class ItemPocketRenderer extends ItemMapLikeRenderer event.setCanceled( true ); INSTANCE.renderItemFirstPerson( - event.getMatrixStack(), event.getBuffers(), event.getLight(), + event.getPoseStack(), event.getMultiBufferSource(), event.getPackedLight(), event.getHand(), event.getInterpolatedPitch(), event.getEquipProgress(), event.getSwingProgress(), event.getItemStack() ); } diff --git a/src/main/java/dan200/computercraft/client/render/ItemPrintoutRenderer.java b/src/main/java/dan200/computercraft/client/render/ItemPrintoutRenderer.java index f3f17d3f5..80d149b1d 100644 --- a/src/main/java/dan200/computercraft/client/render/ItemPrintoutRenderer.java +++ b/src/main/java/dan200/computercraft/client/render/ItemPrintoutRenderer.java @@ -45,7 +45,7 @@ public final class ItemPrintoutRenderer extends ItemMapLikeRenderer event.setCanceled( true ); INSTANCE.renderItemFirstPerson( - event.getMatrixStack(), event.getBuffers(), event.getLight(), + event.getPoseStack(), event.getMultiBufferSource(), event.getPackedLight(), event.getHand(), event.getInterpolatedPitch(), event.getEquipProgress(), event.getSwingProgress(), event.getItemStack() ); } @@ -63,11 +63,11 @@ public final class ItemPrintoutRenderer extends ItemMapLikeRenderer @SubscribeEvent public static void onRenderInFrame( RenderItemInFrameEvent event ) { - ItemStack stack = event.getItem(); + ItemStack stack = event.getItemStack(); if( !(stack.getItem() instanceof ItemPrintout) ) return; event.setCanceled( true ); - PoseStack transform = event.getMatrix(); + PoseStack transform = event.getPoseStack(); // Move a little bit forward to ensure we're not clipping with the frame transform.translate( 0.0f, 0.0f, -0.001f ); @@ -75,8 +75,8 @@ public final class ItemPrintoutRenderer extends ItemMapLikeRenderer transform.scale( 0.95f, 0.95f, -0.95f ); transform.translate( -0.5f, -0.5f, 0.0f ); - int light = event.getEntityItemFrame().getType() == EntityType.GLOW_ITEM_FRAME ? 0xf000d2 : event.getLight(); // See getLightVal. - drawPrintout( transform, event.getBuffers(), stack, light ); + int light = event.getItemFrameEntity().getType() == EntityType.GLOW_ITEM_FRAME ? 0xf000d2 : event.getPackedLight(); // See getLightVal. + drawPrintout( transform, event.getMultiBufferSource(), stack, light ); } private static void drawPrintout( PoseStack transform, MultiBufferSource render, ItemStack stack, int light ) diff --git a/src/main/java/dan200/computercraft/client/render/MonitorHighlightRenderer.java b/src/main/java/dan200/computercraft/client/render/MonitorHighlightRenderer.java index 45aeb5435..9d10f6a12 100644 --- a/src/main/java/dan200/computercraft/client/render/MonitorHighlightRenderer.java +++ b/src/main/java/dan200/computercraft/client/render/MonitorHighlightRenderer.java @@ -41,9 +41,9 @@ public final class MonitorHighlightRenderer public static void drawHighlight( DrawSelectionEvent.HighlightBlock event ) { // Preserve normal behaviour when crouching. - if( event.getInfo().getEntity().isCrouching() ) return; + if( event.getCamera().getEntity().isCrouching() ) return; - Level world = event.getInfo().getEntity().getCommandSenderWorld(); + Level world = event.getCamera().getEntity().getCommandSenderWorld(); BlockPos pos = event.getTarget().getBlockPos(); BlockEntity tile = world.getBlockEntity( pos ); @@ -60,13 +60,13 @@ public final class MonitorHighlightRenderer if( monitor.getYIndex() != 0 ) faces.remove( monitor.getDown().getOpposite() ); if( monitor.getYIndex() != monitor.getHeight() - 1 ) faces.remove( monitor.getDown() ); - PoseStack transformStack = event.getMatrix(); - Vec3 cameraPos = event.getInfo().getPosition(); + PoseStack transformStack = event.getPoseStack(); + Vec3 cameraPos = event.getCamera().getPosition(); transformStack.pushPose(); transformStack.translate( pos.getX() - cameraPos.x(), pos.getY() - cameraPos.y(), pos.getZ() - cameraPos.z() ); // I wish I could think of a better way to do this - VertexConsumer buffer = event.getBuffers().getBuffer( RenderType.lines() ); + VertexConsumer buffer = event.getMultiBufferSource().getBuffer( RenderType.lines() ); Matrix4f transform = transformStack.last().pose(); Matrix3f normal = transformStack.last().normal(); if( faces.contains( NORTH ) || faces.contains( WEST ) ) line( buffer, transform, normal, 0, 0, 0, UP ); diff --git a/src/main/java/dan200/computercraft/data/LootTableGenerator.java b/src/main/java/dan200/computercraft/data/LootTableGenerator.java index 7f8384443..08054b15f 100644 --- a/src/main/java/dan200/computercraft/data/LootTableGenerator.java +++ b/src/main/java/dan200/computercraft/data/LootTableGenerator.java @@ -26,7 +26,7 @@ import net.minecraft.world.level.storage.loot.predicates.AlternativeLootItemCond import net.minecraft.world.level.storage.loot.predicates.ExplosionCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition; import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; -import net.minecraftforge.fmllegacy.RegistryObject; +import net.minecraftforge.registries.RegistryObject; import java.util.function.BiConsumer; diff --git a/src/main/java/dan200/computercraft/shared/CommonHooks.java b/src/main/java/dan200/computercraft/shared/CommonHooks.java index 07ab5f426..b6b5e75c7 100644 --- a/src/main/java/dan200/computercraft/shared/CommonHooks.java +++ b/src/main/java/dan200/computercraft/shared/CommonHooks.java @@ -28,11 +28,11 @@ import net.minecraft.world.level.storage.loot.entries.LootTableReference; import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; import net.minecraftforge.event.*; import net.minecraftforge.event.entity.player.PlayerContainerEvent; +import net.minecraftforge.event.server.ServerStartedEvent; +import net.minecraftforge.event.server.ServerStartingEvent; +import net.minecraftforge.event.server.ServerStoppedEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fmlserverevents.FMLServerStartedEvent; -import net.minecraftforge.fmlserverevents.FMLServerStartingEvent; -import net.minecraftforge.fmlserverevents.FMLServerStoppedEvent; import java.util.Arrays; import java.util.HashSet; @@ -84,7 +84,7 @@ public final class CommonHooks } @SubscribeEvent - public static void onServerStarting( FMLServerStartingEvent event ) + public static void onServerStarting( ServerStartingEvent event ) { MinecraftServer server = event.getServer(); if( server instanceof DedicatedServer dediServer && dediServer.getProperties().enableJmxMonitoring ) @@ -94,7 +94,7 @@ public final class CommonHooks } @SubscribeEvent - public static void onServerStarted( FMLServerStartedEvent event ) + public static void onServerStarted( ServerStartedEvent event ) { ComputerCraft.serverComputerRegistry.reset(); WirelessNetwork.resetNetworks(); @@ -104,7 +104,7 @@ public final class CommonHooks } @SubscribeEvent - public static void onServerStopped( FMLServerStoppedEvent event ) + public static void onServerStopped( ServerStoppedEvent event ) { ComputerCraft.serverComputerRegistry.reset(); WirelessNetwork.resetNetworks(); diff --git a/src/main/java/dan200/computercraft/shared/Registry.java b/src/main/java/dan200/computercraft/shared/Registry.java index dc28b92a5..e9f72b62c 100644 --- a/src/main/java/dan200/computercraft/shared/Registry.java +++ b/src/main/java/dan200/computercraft/shared/Registry.java @@ -96,11 +96,11 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.fmllegacy.RegistryObject; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryBuilder; +import net.minecraftforge.registries.RegistryObject; import java.util.function.BiFunction; diff --git a/src/main/java/dan200/computercraft/shared/command/ClientCommands.java b/src/main/java/dan200/computercraft/shared/command/ClientCommands.java index fc2a4c5fa..4423c80e0 100644 --- a/src/main/java/dan200/computercraft/shared/command/ClientCommands.java +++ b/src/main/java/dan200/computercraft/shared/command/ClientCommands.java @@ -13,7 +13,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ClientChatEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fmllegacy.server.ServerLifecycleHooks; +import net.minecraftforge.server.ServerLifecycleHooks; import java.io.File; diff --git a/src/main/java/dan200/computercraft/shared/common/BlockGeneric.java b/src/main/java/dan200/computercraft/shared/common/BlockGeneric.java index f8f26cbf0..12825881c 100644 --- a/src/main/java/dan200/computercraft/shared/common/BlockGeneric.java +++ b/src/main/java/dan200/computercraft/shared/common/BlockGeneric.java @@ -19,7 +19,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.phys.BlockHitResult; -import net.minecraftforge.fmllegacy.RegistryObject; +import net.minecraftforge.registries.RegistryObject; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/src/main/java/dan200/computercraft/shared/common/TileGeneric.java b/src/main/java/dan200/computercraft/shared/common/TileGeneric.java index 09565cf01..5e5aa1475 100644 --- a/src/main/java/dan200/computercraft/shared/common/TileGeneric.java +++ b/src/main/java/dan200/computercraft/shared/common/TileGeneric.java @@ -12,11 +12,11 @@ import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; +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.BlockState; import net.minecraft.world.phys.BlockHitResult; -import net.minecraftforge.common.util.Constants; import javax.annotation.Nonnull; @@ -36,7 +36,7 @@ public abstract class TileGeneric extends BlockEntity setChanged(); BlockPos pos = getBlockPos(); BlockState state = getBlockState(); - getLevel().sendBlockUpdated( pos, state, state, Constants.BlockFlags.DEFAULT ); + getLevel().sendBlockUpdated( pos, state, state, Block.UPDATE_ALL ); } @Nonnull @@ -76,7 +76,8 @@ public abstract class TileGeneric extends BlockEntity @Override public final void onDataPacket( Connection net, ClientboundBlockEntityDataPacket packet ) { - if( packet.getType() == 0 ) handleUpdateTag( packet.getTag() ); + var tag = packet.getTag(); + if( tag != null ) handleUpdateTag( tag ); } @Override diff --git a/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputer.java b/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputer.java index 55ec1d02f..4376a3647 100644 --- a/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputer.java +++ b/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputer.java @@ -18,7 +18,7 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.EnumProperty; -import net.minecraftforge.fmllegacy.RegistryObject; +import net.minecraftforge.registries.RegistryObject; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputerBase.java b/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputerBase.java index fd3241a37..efc6469b5 100644 --- a/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputerBase.java +++ b/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputerBase.java @@ -32,7 +32,7 @@ import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.fmllegacy.RegistryObject; +import net.minecraftforge.registries.RegistryObject; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -119,7 +119,7 @@ public abstract class BlockComputerBase extends Bloc @Nonnull @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 ) { BlockEntity tile = world.getBlockEntity( pos ); if( tile instanceof TileComputerBase ) @@ -128,7 +128,7 @@ public abstract class BlockComputerBase extends Bloc if( !result.isEmpty() ) return result; } - return super.getPickBlock( state, target, world, pos, player ); + return super.getCloneItemStack( state, target, world, pos, player ); } @Override diff --git a/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java b/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java index 3c8848cf2..e93fdb7f7 100644 --- a/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java +++ b/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java @@ -388,7 +388,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT @Override public final ClientboundBlockEntityDataPacket getUpdatePacket() { - return new ClientboundBlockEntityDataPacket( worldPosition, 0, getUpdateTag() ); + return ClientboundBlockEntityDataPacket.create( this ); } @Nonnull diff --git a/src/main/java/dan200/computercraft/shared/computer/core/ServerComputer.java b/src/main/java/dan200/computercraft/shared/computer/core/ServerComputer.java index 4afdcb6e6..963688aa1 100644 --- a/src/main/java/dan200/computercraft/shared/computer/core/ServerComputer.java +++ b/src/main/java/dan200/computercraft/shared/computer/core/ServerComputer.java @@ -28,7 +28,7 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.level.Level; -import net.minecraftforge.fmllegacy.server.ServerLifecycleHooks; +import net.minecraftforge.server.ServerLifecycleHooks; import net.minecraftforge.versions.mcp.MCPVersion; import javax.annotation.Nonnull; diff --git a/src/main/java/dan200/computercraft/shared/network/NetworkHandler.java b/src/main/java/dan200/computercraft/shared/network/NetworkHandler.java index 06339cd65..ca77ad7c6 100644 --- a/src/main/java/dan200/computercraft/shared/network/NetworkHandler.java +++ b/src/main/java/dan200/computercraft/shared/network/NetworkHandler.java @@ -16,11 +16,11 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.fmllegacy.network.NetworkDirection; -import net.minecraftforge.fmllegacy.network.NetworkEvent; -import net.minecraftforge.fmllegacy.network.NetworkRegistry; -import net.minecraftforge.fmllegacy.network.PacketDistributor; -import net.minecraftforge.fmllegacy.network.simple.SimpleChannel; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; +import net.minecraftforge.network.NetworkRegistry; +import net.minecraftforge.network.PacketDistributor; +import net.minecraftforge.network.simple.SimpleChannel; import java.util.function.Function; import java.util.function.Supplier; diff --git a/src/main/java/dan200/computercraft/shared/network/NetworkMessage.java b/src/main/java/dan200/computercraft/shared/network/NetworkMessage.java index df808d8d4..dadefb26b 100644 --- a/src/main/java/dan200/computercraft/shared/network/NetworkMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/NetworkMessage.java @@ -6,7 +6,7 @@ package dan200.computercraft.shared.network; import net.minecraft.network.FriendlyByteBuf; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; diff --git a/src/main/java/dan200/computercraft/shared/network/client/ChatTableClientMessage.java b/src/main/java/dan200/computercraft/shared/network/client/ChatTableClientMessage.java index b7670e83d..e6e7a0722 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/ChatTableClientMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/client/ChatTableClientMessage.java @@ -10,7 +10,7 @@ import dan200.computercraft.shared.command.text.TableBuilder; import dan200.computercraft.shared.network.NetworkMessage; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; diff --git a/src/main/java/dan200/computercraft/shared/network/client/ComputerDataClientMessage.java b/src/main/java/dan200/computercraft/shared/network/client/ComputerDataClientMessage.java index d818df679..973fa4552 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/ComputerDataClientMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/client/ComputerDataClientMessage.java @@ -9,7 +9,7 @@ import dan200.computercraft.shared.computer.core.ComputerState; import dan200.computercraft.shared.computer.core.ServerComputer; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; diff --git a/src/main/java/dan200/computercraft/shared/network/client/ComputerDeletedClientMessage.java b/src/main/java/dan200/computercraft/shared/network/client/ComputerDeletedClientMessage.java index 3fd7b7cc9..933d92493 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/ComputerDeletedClientMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/client/ComputerDeletedClientMessage.java @@ -7,7 +7,7 @@ package dan200.computercraft.shared.network.client; import dan200.computercraft.ComputerCraft; import net.minecraft.network.FriendlyByteBuf; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; public class ComputerDeletedClientMessage extends ComputerClientMessage { diff --git a/src/main/java/dan200/computercraft/shared/network/client/ComputerTerminalClientMessage.java b/src/main/java/dan200/computercraft/shared/network/client/ComputerTerminalClientMessage.java index c993febfb..7d2618884 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/ComputerTerminalClientMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/client/ComputerTerminalClientMessage.java @@ -6,7 +6,7 @@ package dan200.computercraft.shared.network.client; import net.minecraft.network.FriendlyByteBuf; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; diff --git a/src/main/java/dan200/computercraft/shared/network/client/MonitorClientMessage.java b/src/main/java/dan200/computercraft/shared/network/client/MonitorClientMessage.java index cc3fef39b..ccdf9c49d 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/MonitorClientMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/client/MonitorClientMessage.java @@ -12,7 +12,7 @@ import net.minecraft.client.player.LocalPlayer; 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; import javax.annotation.Nonnull; diff --git a/src/main/java/dan200/computercraft/shared/network/client/PlayRecordClientMessage.java b/src/main/java/dan200/computercraft/shared/network/client/PlayRecordClientMessage.java index b2e2b0071..2afc8214f 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/PlayRecordClientMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/client/PlayRecordClientMessage.java @@ -13,7 +13,7 @@ import net.minecraft.network.chat.TextComponent; import net.minecraft.sounds.SoundEvent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; diff --git a/src/main/java/dan200/computercraft/shared/network/client/SpeakerMoveClientMessage.java b/src/main/java/dan200/computercraft/shared/network/client/SpeakerMoveClientMessage.java index f27cda7cd..0972daef0 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/SpeakerMoveClientMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/client/SpeakerMoveClientMessage.java @@ -11,7 +11,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; import java.util.UUID; diff --git a/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java b/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java index 863af7a9d..e5ddabd18 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java @@ -12,7 +12,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; import java.util.UUID; diff --git a/src/main/java/dan200/computercraft/shared/network/client/SpeakerStopClientMessage.java b/src/main/java/dan200/computercraft/shared/network/client/SpeakerStopClientMessage.java index 87a223433..99a66004c 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/SpeakerStopClientMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/client/SpeakerStopClientMessage.java @@ -10,7 +10,7 @@ import dan200.computercraft.shared.network.NetworkMessage; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; import java.util.UUID; diff --git a/src/main/java/dan200/computercraft/shared/network/client/UpgradesLoadedMessage.java b/src/main/java/dan200/computercraft/shared/network/client/UpgradesLoadedMessage.java index 0bda971cd..562772eb8 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/UpgradesLoadedMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/client/UpgradesLoadedMessage.java @@ -17,7 +17,7 @@ import dan200.computercraft.shared.UpgradeManager; import dan200.computercraft.shared.network.NetworkMessage; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.RegistryManager; diff --git a/src/main/java/dan200/computercraft/shared/network/client/UploadResultMessage.java b/src/main/java/dan200/computercraft/shared/network/client/UploadResultMessage.java index a4d5932af..2fd041454 100644 --- a/src/main/java/dan200/computercraft/shared/network/client/UploadResultMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/client/UploadResultMessage.java @@ -13,7 +13,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; diff --git a/src/main/java/dan200/computercraft/shared/network/container/ContainerData.java b/src/main/java/dan200/computercraft/shared/network/container/ContainerData.java index d45285ac7..28cfe6063 100644 --- a/src/main/java/dan200/computercraft/shared/network/container/ContainerData.java +++ b/src/main/java/dan200/computercraft/shared/network/container/ContainerData.java @@ -12,16 +12,16 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.MenuType; -import net.minecraftforge.common.extensions.IForgeContainerType; -import net.minecraftforge.fmllegacy.network.IContainerFactory; -import net.minecraftforge.fmllegacy.network.NetworkHooks; +import net.minecraftforge.common.extensions.IForgeMenuType; +import net.minecraftforge.network.IContainerFactory; +import net.minecraftforge.network.NetworkHooks; import javax.annotation.Nonnull; import java.util.function.Consumer; import java.util.function.Function; /** - * An extension over the basic {@link IForgeContainerType}/{@link NetworkHooks#openGui(ServerPlayer, MenuProvider, Consumer)} + * An extension over the basic {@link IForgeMenuType}/{@link NetworkHooks#openGui(ServerPlayer, MenuProvider, Consumer)} * hooks, with a more convenient way of reading and writing data. */ public interface ContainerData @@ -35,7 +35,7 @@ public interface ContainerData static MenuType toType( Function reader, Factory factory ) { - return IForgeContainerType.create( ( id, player, data ) -> factory.create( id, player, reader.apply( data ) ) ); + return IForgeMenuType.create( ( id, player, data ) -> factory.create( id, player, reader.apply( data ) ) ); } static MenuType toType( Function reader, FixedFactory factory ) @@ -60,7 +60,7 @@ public interface ContainerData private FixedPointContainerFactory( Function reader, FixedFactory factory ) { - MenuType type = this.type = IForgeContainerType.create( this ); + MenuType type = this.type = IForgeMenuType.create( this ); impl = ( id, player, data ) -> factory.create( type, id, player, reader.apply( data ) ); } diff --git a/src/main/java/dan200/computercraft/shared/network/server/ComputerActionServerMessage.java b/src/main/java/dan200/computercraft/shared/network/server/ComputerActionServerMessage.java index e8a03e5a8..afd04185f 100644 --- a/src/main/java/dan200/computercraft/shared/network/server/ComputerActionServerMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/server/ComputerActionServerMessage.java @@ -8,7 +8,7 @@ package dan200.computercraft.shared.network.server; import dan200.computercraft.shared.computer.core.IContainerComputer; import dan200.computercraft.shared.computer.core.ServerComputer; import net.minecraft.network.FriendlyByteBuf; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; diff --git a/src/main/java/dan200/computercraft/shared/network/server/ComputerServerMessage.java b/src/main/java/dan200/computercraft/shared/network/server/ComputerServerMessage.java index 916972575..11f0b403b 100644 --- a/src/main/java/dan200/computercraft/shared/network/server/ComputerServerMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/server/ComputerServerMessage.java @@ -10,7 +10,7 @@ import dan200.computercraft.shared.computer.core.IContainerComputer; import dan200.computercraft.shared.computer.core.ServerComputer; import dan200.computercraft.shared.network.NetworkMessage; import net.minecraft.network.FriendlyByteBuf; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; diff --git a/src/main/java/dan200/computercraft/shared/network/server/ContinueUploadMessage.java b/src/main/java/dan200/computercraft/shared/network/server/ContinueUploadMessage.java index c371af183..591985a4f 100644 --- a/src/main/java/dan200/computercraft/shared/network/server/ContinueUploadMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/server/ContinueUploadMessage.java @@ -9,7 +9,7 @@ import dan200.computercraft.shared.computer.core.IContainerComputer; import dan200.computercraft.shared.computer.core.ServerComputer; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; diff --git a/src/main/java/dan200/computercraft/shared/network/server/KeyEventServerMessage.java b/src/main/java/dan200/computercraft/shared/network/server/KeyEventServerMessage.java index b736d26e9..3d371fb32 100644 --- a/src/main/java/dan200/computercraft/shared/network/server/KeyEventServerMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/server/KeyEventServerMessage.java @@ -9,7 +9,7 @@ import dan200.computercraft.shared.computer.core.IContainerComputer; import dan200.computercraft.shared.computer.core.InputState; import dan200.computercraft.shared.computer.core.ServerComputer; import net.minecraft.network.FriendlyByteBuf; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; diff --git a/src/main/java/dan200/computercraft/shared/network/server/MouseEventServerMessage.java b/src/main/java/dan200/computercraft/shared/network/server/MouseEventServerMessage.java index 8f8604915..789248d98 100644 --- a/src/main/java/dan200/computercraft/shared/network/server/MouseEventServerMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/server/MouseEventServerMessage.java @@ -9,7 +9,7 @@ import dan200.computercraft.shared.computer.core.IContainerComputer; import dan200.computercraft.shared.computer.core.InputState; import dan200.computercraft.shared.computer.core.ServerComputer; import net.minecraft.network.FriendlyByteBuf; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; diff --git a/src/main/java/dan200/computercraft/shared/network/server/QueueEventServerMessage.java b/src/main/java/dan200/computercraft/shared/network/server/QueueEventServerMessage.java index fafd579b2..26296804a 100644 --- a/src/main/java/dan200/computercraft/shared/network/server/QueueEventServerMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/server/QueueEventServerMessage.java @@ -10,7 +10,7 @@ import dan200.computercraft.shared.computer.core.ServerComputer; import dan200.computercraft.shared.util.NBTUtil; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/src/main/java/dan200/computercraft/shared/network/server/RequestComputerMessage.java b/src/main/java/dan200/computercraft/shared/network/server/RequestComputerMessage.java index d8d46dfe3..7fb02360d 100644 --- a/src/main/java/dan200/computercraft/shared/network/server/RequestComputerMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/server/RequestComputerMessage.java @@ -9,7 +9,7 @@ import dan200.computercraft.ComputerCraft; import dan200.computercraft.shared.computer.core.ServerComputer; import dan200.computercraft.shared.network.NetworkMessage; import net.minecraft.network.FriendlyByteBuf; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; diff --git a/src/main/java/dan200/computercraft/shared/network/server/UploadFileMessage.java b/src/main/java/dan200/computercraft/shared/network/server/UploadFileMessage.java index 235d6dcd4..4ad053c0e 100644 --- a/src/main/java/dan200/computercraft/shared/network/server/UploadFileMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/server/UploadFileMessage.java @@ -14,7 +14,7 @@ import dan200.computercraft.shared.network.NetworkHandler; import io.netty.handler.codec.DecoderException; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; -import net.minecraftforge.fmllegacy.network.NetworkEvent; +import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; import java.nio.ByteBuffer; diff --git a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java b/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java index 1edd21072..2fa856fd5 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java @@ -37,9 +37,9 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.fmllegacy.network.NetworkHooks; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.wrapper.InvWrapper; +import net.minecraftforge.network.NetworkHooks; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/src/main/java/dan200/computercraft/shared/peripheral/generic/data/ItemData.java b/src/main/java/dan200/computercraft/shared/peripheral/generic/data/ItemData.java index aa6759ffb..a5109ccaf 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/generic/data/ItemData.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/generic/data/ItemData.java @@ -60,9 +60,9 @@ public class ItemData data.put( "maxDamage", stack.getMaxDamage() ); } - if( stack.getItem().showDurabilityBar( stack ) ) + if( stack.getItem().isBarVisible( stack ) ) { - data.put( "durability", stack.getItem().getDurabilityForDisplay( stack ) ); + data.put( "durability", stack.getItem().getBarWidth( stack ) / 13.0 ); } data.put( "tags", DataHelpers.getTags( stack.getItem().getTags() ) ); diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockCable.java b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockCable.java index 6305220c7..2f389d71b 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockCable.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockCable.java @@ -98,7 +98,7 @@ public class BlockCable extends BlockGeneric implements SimpleWaterloggedBlock } @Override - public boolean removedByPlayer( BlockState state, Level world, BlockPos pos, Player player, boolean willHarvest, FluidState fluid ) + public boolean onDestroyedByPlayer( BlockState state, Level world, BlockPos pos, Player player, boolean willHarvest, FluidState fluid ) { if( state.getValue( CABLE ) && state.getValue( MODEM ).getFacing() != null ) { @@ -140,12 +140,12 @@ public class BlockCable extends BlockGeneric implements SimpleWaterloggedBlock } } - return super.removedByPlayer( state, world, pos, player, willHarvest, fluid ); + return super.onDestroyedByPlayer( state, world, pos, player, willHarvest, fluid ); } @Nonnull @Override - public ItemStack getPickBlock( BlockState state, HitResult hit, BlockGetter world, BlockPos pos, Player player ) + public ItemStack getCloneItemStack( BlockState state, HitResult hit, BlockGetter world, BlockPos pos, Player player ) { Direction modem = state.getValue( MODEM ).getFacing(); boolean cable = state.getValue( CABLE ); diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileCable.java b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileCable.java index c327d9d74..d985d1e87 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileCable.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileCable.java @@ -346,7 +346,7 @@ public class TileCable extends TileGeneric for( Direction facing : DirectionUtil.FACINGS ) { BlockPos offset = current.relative( facing ); - if( !world.isAreaLoaded( offset, 0 ) ) continue; + if( !world.isLoaded( offset ) ) continue; LazyOptional element = ComputerCraftAPI.getWiredElementAt( world, offset, facing.getOpposite() ); if( !element.isPresent() ) continue; diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileWiredModemFull.java b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileWiredModemFull.java index 514e0916a..1ea58ce93 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileWiredModemFull.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileWiredModemFull.java @@ -306,7 +306,7 @@ public class TileWiredModemFull extends TileGeneric for( Direction facing : DirectionUtil.FACINGS ) { BlockPos offset = current.relative( facing ); - if( !world.isAreaLoaded( offset, 0 ) ) continue; + if( !world.isLoaded( offset ) ) continue; LazyOptional element = ComputerCraftAPI.getWiredElementAt( world, offset, facing.getOpposite() ); if( !element.isPresent() ) continue; diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/BlockWirelessModem.java b/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/BlockWirelessModem.java index 4fa6c29c1..e0ceebe6c 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/BlockWirelessModem.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/BlockWirelessModem.java @@ -25,7 +25,7 @@ import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.fmllegacy.RegistryObject; +import net.minecraftforge.registries.RegistryObject; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/BlockMonitor.java b/src/main/java/dan200/computercraft/shared/peripheral/monitor/BlockMonitor.java index d827ae3a1..f7bc7c6b7 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/BlockMonitor.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/monitor/BlockMonitor.java @@ -21,7 +21,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.fmllegacy.RegistryObject; +import net.minecraftforge.registries.RegistryObject; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorWatcher.java b/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorWatcher.java index d70862b44..0394b23d8 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorWatcher.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorWatcher.java @@ -101,7 +101,7 @@ public final class MonitorWatcher if( !(world instanceof ServerLevel) ) continue; LevelChunk chunk = world.getChunkAt( pos ); - if( ((ServerLevel) world).getChunkSource().chunkMap.getPlayers( chunk.getPos(), false ).findAny().isEmpty() ) + if( ((ServerLevel) world).getChunkSource().chunkMap.getPlayers( chunk.getPos(), false ).isEmpty() ) { continue; } diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java b/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java index 666385150..470cdcd94 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java @@ -261,7 +261,7 @@ public class TileMonitor extends TileGeneric @Override public final ClientboundBlockEntityDataPacket getUpdatePacket() { - return new ClientboundBlockEntityDataPacket( worldPosition, 0, getUpdateTag() ); + return ClientboundBlockEntityDataPacket.create( this ); } @Nonnull @@ -398,7 +398,7 @@ public class TileMonitor extends TileGeneric BlockPos pos = toWorldPos( x, y ); Level world = getLevel(); - if( world == null || !world.isAreaLoaded( pos, 0 ) ) return MonitorState.UNLOADED; + if( world == null || !world.isLoaded( pos ) ) return MonitorState.UNLOADED; BlockEntity tile = world.getBlockEntity( pos ); if( !(tile instanceof TileMonitor monitor) ) return MonitorState.MISSING; diff --git a/src/main/java/dan200/computercraft/shared/peripheral/printer/TilePrinter.java b/src/main/java/dan200/computercraft/shared/peripheral/printer/TilePrinter.java index d7679098f..0337fcdc5 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/printer/TilePrinter.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/printer/TilePrinter.java @@ -31,10 +31,10 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.fmllegacy.network.NetworkHooks; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.wrapper.InvWrapper; import net.minecraftforge.items.wrapper.SidedInvWrapper; +import net.minecraftforge.network.NetworkHooks; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/src/main/java/dan200/computercraft/shared/peripheral/speaker/UpgradeSpeakerPeripheral.java b/src/main/java/dan200/computercraft/shared/peripheral/speaker/UpgradeSpeakerPeripheral.java index a81f294a4..0cb70b348 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/speaker/UpgradeSpeakerPeripheral.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/speaker/UpgradeSpeakerPeripheral.java @@ -9,8 +9,7 @@ import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.shared.network.NetworkHandler; import dan200.computercraft.shared.network.client.SpeakerStopClientMessage; import net.minecraft.server.MinecraftServer; -import net.minecraftforge.fml.LogicalSide; -import net.minecraftforge.fmllegacy.LogicalSidedProvider; +import net.minecraftforge.server.ServerLifecycleHooks; import javax.annotation.Nonnull; import java.util.UUID; @@ -34,7 +33,7 @@ public abstract class UpgradeSpeakerPeripheral extends SpeakerPeripheral public void detach( @Nonnull IComputerAccess computer ) { // We could be in the process of shutting down the server, so we can't send packets in this case. - MinecraftServer server = LogicalSidedProvider.INSTANCE.get( LogicalSide.SERVER ); + MinecraftServer server = ServerLifecycleHooks.getCurrentServer(); if( server == null || server.isStopped() ) return; NetworkHandler.sendToAllPlayers( new SpeakerStopClientMessage( source ) ); diff --git a/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java b/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java index 11bf1a3b6..3a30910c5 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java +++ b/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java @@ -42,7 +42,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.fmllegacy.RegistryObject; +import net.minecraftforge.registries.RegistryObject; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleBrain.java b/src/main/java/dan200/computercraft/shared/turtle/core/TurtleBrain.java index 8ab7dd576..e179c3a61 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleBrain.java +++ b/src/main/java/dan200/computercraft/shared/turtle/core/TurtleBrain.java @@ -304,7 +304,7 @@ public class TurtleBrain implements ITurtleAccess } // Ensure the chunk is loaded - if( !world.isAreaLoaded( pos, 0 ) ) return false; + if( !world.isLoaded( pos ) ) return false; // Ensure we're inside the world border if( !world.getWorldBorder().isWithinBounds( pos ) ) return false; diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleMoveCommand.java b/src/main/java/dan200/computercraft/shared/turtle/core/TurtleMoveCommand.java index 5589aac16..3b81ebda6 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleMoveCommand.java +++ b/src/main/java/dan200/computercraft/shared/turtle/core/TurtleMoveCommand.java @@ -137,7 +137,7 @@ public class TurtleMoveCommand implements ITurtleCommand return TurtleCommandResult.failure( "Cannot enter protected area" ); } - if( !world.isAreaLoaded( position, 0 ) ) return TurtleCommandResult.failure( "Cannot leave loaded world" ); + if( !world.isLoaded( position ) ) return TurtleCommandResult.failure( "Cannot leave loaded world" ); if( !world.getWorldBorder().isWithinBounds( position ) ) { return TurtleCommandResult.failure( "Cannot pass the world border" ); diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java b/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java index 0dba03e3b..359c8c128 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java +++ b/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java @@ -27,13 +27,13 @@ import net.minecraft.world.item.*; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.SignBlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.ForgeHooks; -import net.minecraftforge.common.util.Constants; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.Event.Result; import net.minecraftforge.items.IItemHandler; @@ -321,7 +321,7 @@ public class TurtlePlaceCommand implements ITurtleCommand } } signTile.setChanged(); - world.sendBlockUpdated( tile.getBlockPos(), tile.getBlockState(), tile.getBlockState(), Constants.BlockFlags.DEFAULT ); + world.sendBlockUpdated( tile.getBlockPos(), tile.getBlockState(), tile.getBlockState(), Block.UPDATE_ALL ); } private static class ErrorMessage diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleInventoryCrafting.java b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleInventoryCrafting.java index 8a58b3026..8ccfdf8fb 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleInventoryCrafting.java +++ b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleInventoryCrafting.java @@ -17,7 +17,7 @@ import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.Level; import net.minecraftforge.common.ForgeHooks; -import net.minecraftforge.fmllegacy.hooks.BasicEventHooks; +import net.minecraftforge.event.ForgeEventFactory; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -91,7 +91,7 @@ public class TurtleInventoryCrafting extends CraftingContainer results.add( result ); result.onCraftedBy( world, player, result.getCount() ); - BasicEventHooks.firePlayerCraftingEvent( player, result, this ); + ForgeEventFactory.firePlayerCraftingEvent( player, result, this ); ForgeHooks.setCraftingPlayer( player ); NonNullList remainders = recipe.getRemainingItems( this ); diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java index 42d45771a..b727dc351 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java +++ b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleTool.java @@ -255,7 +255,7 @@ public class TurtleTool extends AbstractTurtleUpgrade // Destroy the block boolean canHarvest = state.canHarvestBlock( world, blockPosition, turtlePlayer ); - boolean canBreak = state.removedByPlayer( world, blockPosition, turtlePlayer, canHarvest, fluidState ); + boolean canBreak = state.onDestroyedByPlayer( world, blockPosition, turtlePlayer, canHarvest, fluidState ); if( canBreak ) state.getBlock().destroy( world, blockPosition, state ); if( canHarvest && canBreak ) { diff --git a/src/main/java/dan200/computercraft/shared/util/IDAssigner.java b/src/main/java/dan200/computercraft/shared/util/IDAssigner.java index 6d49a8aa5..a18b6bb33 100644 --- a/src/main/java/dan200/computercraft/shared/util/IDAssigner.java +++ b/src/main/java/dan200/computercraft/shared/util/IDAssigner.java @@ -11,7 +11,7 @@ import com.google.gson.reflect.TypeToken; import dan200.computercraft.ComputerCraft; import net.minecraft.server.MinecraftServer; import net.minecraft.world.level.storage.LevelResource; -import net.minecraftforge.fmllegacy.server.ServerLifecycleHooks; +import net.minecraftforge.server.ServerLifecycleHooks; import java.io.File; import java.io.Reader; diff --git a/src/main/java/dan200/computercraft/shared/util/TickScheduler.java b/src/main/java/dan200/computercraft/shared/util/TickScheduler.java index f8e34411d..999d075c1 100644 --- a/src/main/java/dan200/computercraft/shared/util/TickScheduler.java +++ b/src/main/java/dan200/computercraft/shared/util/TickScheduler.java @@ -10,7 +10,8 @@ import dan200.computercraft.ComputerCraft; import dan200.computercraft.shared.common.TileGeneric; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; -import net.minecraft.world.level.TickList; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -21,7 +22,7 @@ import java.util.Iterator; import java.util.Set; /** - * A thread-safe version of {@link TickList#scheduleTick(BlockPos, Object, int)}. + * A thread-safe version of {@link LevelAccessor#scheduleTick(BlockPos, Block, int)}. * * We use this when modems and other peripherals change a block in a different thread. */ @@ -58,9 +59,9 @@ public final class TickScheduler Level world = tile.getLevel(); BlockPos pos = tile.getBlockPos(); - if( world != null && pos != null && world.isAreaLoaded( pos, 0 ) && world.getBlockEntity( pos ) == tile ) + if( world != null && pos != null && world.isLoaded( pos ) && world.getBlockEntity( pos ) == tile ) { - world.getBlockTicks().scheduleTick( pos, tile.getBlockState().getBlock(), 0 ); + world.scheduleTick( pos, tile.getBlockState().getBlock(), 0 ); } } } diff --git a/src/main/java/dan200/computercraft/shared/util/WaterloggableHelpers.java b/src/main/java/dan200/computercraft/shared/util/WaterloggableHelpers.java index 12f9a1ed1..ded90fe2e 100644 --- a/src/main/java/dan200/computercraft/shared/util/WaterloggableHelpers.java +++ b/src/main/java/dan200/computercraft/shared/util/WaterloggableHelpers.java @@ -48,7 +48,7 @@ public final class WaterloggableHelpers { if( state.getValue( WATERLOGGED ) ) { - world.getLiquidTicks().scheduleTick( pos, Fluids.WATER, Fluids.WATER.getTickDelay( world ) ); + world.scheduleTick( pos, Fluids.WATER, Fluids.WATER.getTickDelay( world ) ); } } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index ee8fd207e..12de56943 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,38)" +loaderVersion="[38,39)" issueTrackerURL="https://github.com/cc-tweaked/CC-Tweaked/issues" logoFile="pack.png" @@ -21,6 +21,6 @@ CC: Tweaked is a fork of ComputerCraft, adding programmable computers, turtles a [[dependencies.computercraft]] modId="forge" mandatory=true - versionRange="[37.0.85,38)" + versionRange="[38.0.0,39)" ordering="NONE" side="BOTH" diff --git a/src/testMod/java/dan200/computercraft/ingame/mod/ClientHooks.java b/src/testMod/java/dan200/computercraft/ingame/mod/ClientHooks.java index a6bd3d0a6..78bdc5684 100644 --- a/src/testMod/java/dan200/computercraft/ingame/mod/ClientHooks.java +++ b/src/testMod/java/dan200/computercraft/ingame/mod/ClientHooks.java @@ -27,7 +27,7 @@ import net.minecraft.world.level.levelgen.WorldGenSettings; import net.minecraft.world.level.levelgen.flat.FlatLayerInfo; import net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorSettings; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.client.event.ScreenEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import org.apache.logging.log4j.LogManager; @@ -50,9 +50,9 @@ public final class ClientHooks } @SubscribeEvent - public static void onGuiInit( GuiScreenEvent.InitGuiEvent event ) + public static void onGuiInit( ScreenEvent.InitScreenEvent event ) { - if( triggered || !(event.getGui() instanceof TitleScreen) ) return; + if( triggered || !(event.getScreen() instanceof TitleScreen) ) return; triggered = true; ClientHooks.openWorld(); @@ -93,7 +93,7 @@ public final class ClientHooks WorldGenSettings generator = new WorldGenSettings( 0, false, false, withOverworld( dimensions, - DimensionType.defaultDimensions( dimensions, biomes, registries.registryOrThrow( Registry.NOISE_GENERATOR_SETTINGS_REGISTRY ), 0 ), + DimensionType.defaultDimensions( registries, 0 ), new FlatLevelSource( flatSettings ) ) ); diff --git a/src/testMod/java/dan200/computercraft/ingame/mod/TestHooks.java b/src/testMod/java/dan200/computercraft/ingame/mod/TestHooks.java index 848d1d5c5..44be5d2be 100644 --- a/src/testMod/java/dan200/computercraft/ingame/mod/TestHooks.java +++ b/src/testMod/java/dan200/computercraft/ingame/mod/TestHooks.java @@ -5,9 +5,9 @@ */ package dan200.computercraft.ingame.mod; +import dan200.computercraft.ingame.api.Times; import net.minecraft.ChatFormatting; import net.minecraft.SharedConstants; -import dan200.computercraft.ingame.api.Times; import net.minecraft.client.Minecraft; import net.minecraft.commands.CommandSourceStack; import net.minecraft.core.BlockPos; @@ -21,11 +21,11 @@ import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraftforge.event.RegisterCommandsEvent; import net.minecraftforge.event.TickEvent; +import net.minecraftforge.event.server.ServerStartedEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.loading.FMLLoader; -import net.minecraftforge.fmllegacy.server.ServerLifecycleHooks; -import net.minecraftforge.fmlserverevents.FMLServerStartedEvent; +import net.minecraftforge.server.ServerLifecycleHooks; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -49,7 +49,7 @@ public class TestHooks } @SubscribeEvent - public static void onServerStarted( FMLServerStartedEvent event ) + public static void onServerStarted( ServerStartedEvent event ) { MinecraftServer server = event.getServer(); GameRules rules = server.getGameRules();