Fix multiplayer crashes

This commit is contained in:
modmuss50 2019-07-31 17:34:53 +01:00
parent 398d74dedc
commit 739f4c21e8
13 changed files with 232 additions and 220 deletions

View file

@ -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

View file

@ -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();
}

View file

@ -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) {

View file

@ -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);