From 739f4c21e8ceebb0f1d24e197670516c21061986 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Wed, 31 Jul 2019 17:34:53 +0100 Subject: [PATCH] Fix multiplayer crashes --- src/main/java/techreborn/TechReborn.java | 3 -- .../java/techreborn/TechRebornClient.java | 5 ++ .../recipe/recipes/BlastFurnaceRecipe.java | 6 +++ .../java/techreborn/client/GuiHandler.java | 10 ++-- .../recipes/implosion_compressor/diamond.json | 48 +++++++++---------- .../recipes/implosion_compressor/emerald.json | 48 +++++++++---------- .../iridium_alloy_plate.json | 44 ++++++++--------- .../implosion_compressor/peridot_gem.json | 48 +++++++++---------- .../implosion_compressor/red_garnet_dust.json | 48 +++++++++---------- .../implosion_compressor/red_garnet_gem.json | 48 +++++++++---------- .../implosion_compressor/ruby_gem.json | 48 +++++++++---------- .../implosion_compressor/sapphire_gem.json | 48 +++++++++---------- .../yellow_garnet_gem.json | 48 +++++++++---------- 13 files changed, 232 insertions(+), 220 deletions(-) diff --git a/src/main/java/techreborn/TechReborn.java b/src/main/java/techreborn/TechReborn.java index 0b0babc84..5bd58b377 100644 --- a/src/main/java/techreborn/TechReborn.java +++ b/src/main/java/techreborn/TechReborn.java @@ -84,9 +84,6 @@ public class TechReborn implements ModInitializer { // WorldGen WorldGenerator.initBiomeFeatures(); - StackToolTipHandler.setup(); - StackWIPHandler.setup(); - // WorldGen // GameRegistry.registerWorldGenerator(new OilLakeGenerator(), 0); // Register Gui Handler diff --git a/src/main/java/techreborn/TechRebornClient.java b/src/main/java/techreborn/TechRebornClient.java index 90c04d014..f962659bd 100644 --- a/src/main/java/techreborn/TechRebornClient.java +++ b/src/main/java/techreborn/TechRebornClient.java @@ -34,6 +34,8 @@ import net.minecraft.client.texture.Sprite; import net.minecraft.client.util.ModelIdentifier; import net.minecraft.util.Identifier; import techreborn.client.render.DynamicCellBakedModel; +import techreborn.events.StackToolTipHandler; +import techreborn.utils.StackWIPHandler; import javax.annotation.Nullable; import java.util.Collection; @@ -77,6 +79,9 @@ public class TechRebornClient implements ClientModInitializer { } }; }); + + StackToolTipHandler.setup(); + StackWIPHandler.setup(); } diff --git a/src/main/java/techreborn/api/recipe/recipes/BlastFurnaceRecipe.java b/src/main/java/techreborn/api/recipe/recipes/BlastFurnaceRecipe.java index 733b93800..b404ca0ce 100644 --- a/src/main/java/techreborn/api/recipe/recipes/BlastFurnaceRecipe.java +++ b/src/main/java/techreborn/api/recipe/recipes/BlastFurnaceRecipe.java @@ -46,6 +46,12 @@ public class BlastFurnaceRecipe extends RebornRecipe { heat = JsonHelper.getInt(jsonObject, "heat"); } + @Override + public void serialize(JsonObject jsonObject) { + super.serialize(jsonObject); + jsonObject.addProperty("heat", heat); + } + @Override public boolean canCraft(final BlockEntity blockEntity) { if (blockEntity instanceof IndustrialBlastFurnaceBlockEntity) { diff --git a/src/main/java/techreborn/client/GuiHandler.java b/src/main/java/techreborn/client/GuiHandler.java index 05b8dce30..eab99091d 100644 --- a/src/main/java/techreborn/client/GuiHandler.java +++ b/src/main/java/techreborn/client/GuiHandler.java @@ -24,15 +24,16 @@ package techreborn.client; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.client.screen.ScreenProviderRegistry; import net.fabricmc.fabric.api.container.ContainerProviderRegistry; import net.minecraft.block.entity.BlockEntity; import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.BlockPos; +import reborncore.RebornCore; import reborncore.client.containerBuilder.IContainerProvider; -import techreborn.client.container.ContainerDestructoPack; -import techreborn.client.gui.*; import techreborn.blockentity.ChargeOMatBlockEntity; import techreborn.blockentity.DigitalChestBlockEntity; import techreborn.blockentity.IndustrialCentrifugeBlockEntity; @@ -57,6 +58,8 @@ import techreborn.blockentity.storage.LowVoltageSUBlockEntity; import techreborn.blockentity.storage.MediumVoltageSUBlockEntity; import techreborn.blockentity.storage.idsu.InterdimensionalSUBlockEntity; import techreborn.blockentity.storage.lesu.LapotronicSUBlockEntity; +import techreborn.client.container.ContainerDestructoPack; +import techreborn.client.gui.*; public class GuiHandler { @@ -67,9 +70,10 @@ public class GuiHandler { return ((IContainerProvider) blockEntity).createContainer(syncID, playerEntity); })); - EGui.stream().forEach(gui -> ScreenProviderRegistry.INSTANCE.registerFactory(gui.getID(), (syncID, identifier, playerEntity, packetByteBuf) -> getClientGuiElement(EGui.byID(identifier), playerEntity, packetByteBuf.readBlockPos(), syncID))); + RebornCore.clientOnly(() -> () -> EGui.stream().forEach(gui -> ScreenProviderRegistry.INSTANCE.registerFactory(gui.getID(), (syncID, identifier, playerEntity, packetByteBuf) -> getClientGuiElement(EGui.byID(identifier), playerEntity, packetByteBuf.readBlockPos(), syncID)))); } + @Environment(EnvType.CLIENT) private static AbstractContainerScreen getClientGuiElement(final EGui gui, final PlayerEntity player, BlockPos pos, int syncID) { final BlockEntity blockEntity = player.world.getBlockEntity(pos); diff --git a/src/main/resources/data/techreborn/recipes/implosion_compressor/diamond.json b/src/main/resources/data/techreborn/recipes/implosion_compressor/diamond.json index e702d91c6..c5e070db8 100644 --- a/src/main/resources/data/techreborn/recipes/implosion_compressor/diamond.json +++ b/src/main/resources/data/techreborn/recipes/implosion_compressor/diamond.json @@ -1,25 +1,25 @@ -{ - "type": "techreborn:implosion_compressor", - "power": 32, - "time": 20, - "ingredients" : [ - { - "item": "minecraft:tnt", - "count": 16 - }, - { - "item": "techreborn:diamond_dust", - "count": 4 - } - ], - "results" : [ - { - "item": "minecraft:diamond", - "count": 3 - }, - { - "item": "techreborn:dark_ashes_dust", - "count": 16 - } - ] +{ + "type": "techreborn:implosion_compressor", + "power": 32, + "time": 20, + "ingredients" : [ + { + "item": "minecraft:tnt", + "count": 16 + }, + { + "item": "techreborn:diamond_dust", + "count": 4 + } + ], + "results" : [ + { + "item": "minecraft:diamond", + "count": 3 + }, + { + "item": "techreborn:dark_ashes_dust", + "count": 16 + } + ] } \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/implosion_compressor/emerald.json b/src/main/resources/data/techreborn/recipes/implosion_compressor/emerald.json index 168e90c13..b046fe222 100644 --- a/src/main/resources/data/techreborn/recipes/implosion_compressor/emerald.json +++ b/src/main/resources/data/techreborn/recipes/implosion_compressor/emerald.json @@ -1,25 +1,25 @@ -{ - "type": "techreborn:implosion_compressor", - "power": 32, - "time": 20, - "ingredients" : [ - { - "item": "minecraft:tnt", - "count": 16 - }, - { - "item": "techreborn:emerald_dust", - "count": 4 - } - ], - "results" : [ - { - "item": "minecraft:emerald", - "count": 3 - }, - { - "item": "techreborn:dark_ashes_dust", - "count": 12 - } - ] +{ + "type": "techreborn:implosion_compressor", + "power": 32, + "time": 20, + "ingredients" : [ + { + "item": "minecraft:tnt", + "count": 16 + }, + { + "item": "techreborn:emerald_dust", + "count": 4 + } + ], + "results" : [ + { + "item": "minecraft:emerald", + "count": 3 + }, + { + "item": "techreborn:dark_ashes_dust", + "count": 12 + } + ] } \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/implosion_compressor/iridium_alloy_plate.json b/src/main/resources/data/techreborn/recipes/implosion_compressor/iridium_alloy_plate.json index db8484534..eacb6b9a5 100644 --- a/src/main/resources/data/techreborn/recipes/implosion_compressor/iridium_alloy_plate.json +++ b/src/main/resources/data/techreborn/recipes/implosion_compressor/iridium_alloy_plate.json @@ -1,23 +1,23 @@ -{ - "type": "techreborn:implosion_compressor", - "power": 32, - "time": 20, - "ingredients" : [ - { - "item": "minecraft:tnt", - "count": 16 - }, - { - "item": "techreborn:iridium_alloy_ingot" - } - ], - "results" : [ - { - "item": "techreborn:iridium_alloy_plate" - }, - { - "item": "techreborn:dark_ashes_dust", - "count": 4 - } - ] +{ + "type": "techreborn:implosion_compressor", + "power": 32, + "time": 20, + "ingredients" : [ + { + "item": "minecraft:tnt", + "count": 16 + }, + { + "item": "techreborn:iridium_alloy_ingot" + } + ], + "results" : [ + { + "item": "techreborn:iridium_alloy_plate" + }, + { + "item": "techreborn:dark_ashes_dust", + "count": 4 + } + ] } \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/implosion_compressor/peridot_gem.json b/src/main/resources/data/techreborn/recipes/implosion_compressor/peridot_gem.json index 9ba59f902..6b44fd10f 100644 --- a/src/main/resources/data/techreborn/recipes/implosion_compressor/peridot_gem.json +++ b/src/main/resources/data/techreborn/recipes/implosion_compressor/peridot_gem.json @@ -1,25 +1,25 @@ -{ - "type": "techreborn:implosion_compressor", - "power": 32, - "time": 20, - "ingredients" : [ - { - "item": "minecraft:tnt", - "count": 16 - }, - { - "item": "techreborn:peridot_dust", - "count": 4 - } - ], - "results" : [ - { - "item": "techreborn:peridot_gem", - "count": 3 - }, - { - "item": "techreborn:dark_ashes_dust", - "count": 12 - } - ] +{ + "type": "techreborn:implosion_compressor", + "power": 32, + "time": 20, + "ingredients" : [ + { + "item": "minecraft:tnt", + "count": 16 + }, + { + "item": "techreborn:peridot_dust", + "count": 4 + } + ], + "results" : [ + { + "item": "techreborn:peridot_gem", + "count": 3 + }, + { + "item": "techreborn:dark_ashes_dust", + "count": 12 + } + ] } \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/implosion_compressor/red_garnet_dust.json b/src/main/resources/data/techreborn/recipes/implosion_compressor/red_garnet_dust.json index 0b61da1f4..b02e5ef01 100644 --- a/src/main/resources/data/techreborn/recipes/implosion_compressor/red_garnet_dust.json +++ b/src/main/resources/data/techreborn/recipes/implosion_compressor/red_garnet_dust.json @@ -1,25 +1,25 @@ -{ - "type": "techreborn:implosion_compressor", - "power": 32, - "time": 20, - "ingredients" : [ - { - "item": "minecraft:tnt", - "count": 16 - }, - { - "item": "minecraft:redstone_block", - "count": 9 - } - ], - "results" : [ - { - "item": "techreborn:red_garnet_dust", - "count": 4 - }, - { - "item": "techreborn:dark_ashes_dust", - "count": 4 - } - ] +{ + "type": "techreborn:implosion_compressor", + "power": 32, + "time": 20, + "ingredients" : [ + { + "item": "minecraft:tnt", + "count": 16 + }, + { + "item": "minecraft:redstone_block", + "count": 9 + } + ], + "results" : [ + { + "item": "techreborn:red_garnet_dust", + "count": 4 + }, + { + "item": "techreborn:dark_ashes_dust", + "count": 4 + } + ] } \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/implosion_compressor/red_garnet_gem.json b/src/main/resources/data/techreborn/recipes/implosion_compressor/red_garnet_gem.json index 52feac746..527f63c6a 100644 --- a/src/main/resources/data/techreborn/recipes/implosion_compressor/red_garnet_gem.json +++ b/src/main/resources/data/techreborn/recipes/implosion_compressor/red_garnet_gem.json @@ -1,25 +1,25 @@ -{ - "type": "techreborn:implosion_compressor", - "power": 32, - "time": 20, - "ingredients" : [ - { - "item": "minecraft:tnt", - "count": 16 - }, - { - "item": "techreborn:red_garnet_dust", - "count": 4 - } - ], - "results" : [ - { - "item": "techreborn:red_garnet_gem", - "count": 3 - }, - { - "item": "techreborn:dark_ashes_dust", - "count": 8 - } - ] +{ + "type": "techreborn:implosion_compressor", + "power": 32, + "time": 20, + "ingredients" : [ + { + "item": "minecraft:tnt", + "count": 16 + }, + { + "item": "techreborn:red_garnet_dust", + "count": 4 + } + ], + "results" : [ + { + "item": "techreborn:red_garnet_gem", + "count": 3 + }, + { + "item": "techreborn:dark_ashes_dust", + "count": 8 + } + ] } \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/implosion_compressor/ruby_gem.json b/src/main/resources/data/techreborn/recipes/implosion_compressor/ruby_gem.json index fcf5a5e67..b7b2c8370 100644 --- a/src/main/resources/data/techreborn/recipes/implosion_compressor/ruby_gem.json +++ b/src/main/resources/data/techreborn/recipes/implosion_compressor/ruby_gem.json @@ -1,25 +1,25 @@ -{ - "type": "techreborn:implosion_compressor", - "power": 32, - "time": 20, - "ingredients" : [ - { - "item": "minecraft:tnt", - "count": 16 - }, - { - "item": "techreborn:ruby_dust", - "count": 4 - } - ], - "results" : [ - { - "item": "techreborn:ruby_gem", - "count": 3 - }, - { - "item": "techreborn:dark_ashes_dust", - "count": 12 - } - ] +{ + "type": "techreborn:implosion_compressor", + "power": 32, + "time": 20, + "ingredients" : [ + { + "item": "minecraft:tnt", + "count": 16 + }, + { + "item": "techreborn:ruby_dust", + "count": 4 + } + ], + "results" : [ + { + "item": "techreborn:ruby_gem", + "count": 3 + }, + { + "item": "techreborn:dark_ashes_dust", + "count": 12 + } + ] } \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/implosion_compressor/sapphire_gem.json b/src/main/resources/data/techreborn/recipes/implosion_compressor/sapphire_gem.json index dccdfbb9b..dcec313fa 100644 --- a/src/main/resources/data/techreborn/recipes/implosion_compressor/sapphire_gem.json +++ b/src/main/resources/data/techreborn/recipes/implosion_compressor/sapphire_gem.json @@ -1,25 +1,25 @@ -{ - "type": "techreborn:implosion_compressor", - "power": 32, - "time": 20, - "ingredients" : [ - { - "item": "minecraft:tnt", - "count": 16 - }, - { - "item": "techreborn:sapphire_dust", - "count": 4 - } - ], - "results" : [ - { - "item": "techreborn:sapphire_gem", - "count": 3 - }, - { - "item": "techreborn:dark_ashes_dust", - "count": 12 - } - ] +{ + "type": "techreborn:implosion_compressor", + "power": 32, + "time": 20, + "ingredients" : [ + { + "item": "minecraft:tnt", + "count": 16 + }, + { + "item": "techreborn:sapphire_dust", + "count": 4 + } + ], + "results" : [ + { + "item": "techreborn:sapphire_gem", + "count": 3 + }, + { + "item": "techreborn:dark_ashes_dust", + "count": 12 + } + ] } \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/implosion_compressor/yellow_garnet_gem.json b/src/main/resources/data/techreborn/recipes/implosion_compressor/yellow_garnet_gem.json index 559d237b2..d09bdbcdd 100644 --- a/src/main/resources/data/techreborn/recipes/implosion_compressor/yellow_garnet_gem.json +++ b/src/main/resources/data/techreborn/recipes/implosion_compressor/yellow_garnet_gem.json @@ -1,25 +1,25 @@ -{ - "type": "techreborn:implosion_compressor", - "power": 32, - "time": 20, - "ingredients" : [ - { - "item": "minecraft:tnt", - "count": 16 - }, - { - "item": "techreborn:yellow_garnet_dust", - "count": 4 - } - ], - "results" : [ - { - "item": "techreborn:yellow_garnet_gem", - "count": 3 - }, - { - "item": "techreborn:dark_ashes_dust", - "count": 8 - } - ] +{ + "type": "techreborn:implosion_compressor", + "power": 32, + "time": 20, + "ingredients" : [ + { + "item": "minecraft:tnt", + "count": 16 + }, + { + "item": "techreborn:yellow_garnet_dust", + "count": 4 + } + ], + "results" : [ + { + "item": "techreborn:yellow_garnet_gem", + "count": 3 + }, + { + "item": "techreborn:dark_ashes_dust", + "count": 8 + } + ] } \ No newline at end of file