1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-01-28 09:54:47 +00:00

Fix several thread-unsafe client registrations

Also remove deprecated usage of DeferredWorkQueue. Oh goodness, some of
this code is so old now.

Fixes #1084
This commit is contained in:
Jonathan Coates 2022-05-03 18:44:37 +01:00
parent 79467499e6
commit e2189535b8
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
2 changed files with 13 additions and 13 deletions

View File

@ -122,8 +122,6 @@ public final class ClientRegistry
@SubscribeEvent
public static void setupClient( FMLClientSetupEvent event )
{
registerContainers();
// While turtles themselves are not transparent, their upgrades may be.
RenderTypeLookup.setRenderLayer( Registry.ModBlocks.TURTLE_NORMAL.get(), RenderType.translucent() );
RenderTypeLookup.setRenderLayer( Registry.ModBlocks.TURTLE_ADVANCED.get(), RenderType.translucent() );
@ -138,14 +136,18 @@ public final class ClientRegistry
net.minecraftforge.fml.client.registry.ClientRegistry.bindTileEntityRenderer( Registry.ModTiles.TURTLE_NORMAL.get(), TileEntityTurtleRenderer::new );
net.minecraftforge.fml.client.registry.ClientRegistry.bindTileEntityRenderer( Registry.ModTiles.TURTLE_ADVANCED.get(), TileEntityTurtleRenderer::new );
registerItemProperty( "state",
( stack, world, player ) -> ItemPocketComputer.getState( stack ).ordinal(),
Registry.ModItems.POCKET_COMPUTER_NORMAL, Registry.ModItems.POCKET_COMPUTER_ADVANCED
);
registerItemProperty( "coloured",
( stack, world, player ) -> IColouredItem.getColourBasic( stack ) != -1 ? 1 : 0,
Registry.ModItems.POCKET_COMPUTER_NORMAL, Registry.ModItems.POCKET_COMPUTER_ADVANCED
);
event.enqueueWork( () -> {
registerContainers();
registerItemProperty( "state",
( stack, world, player ) -> ItemPocketComputer.getState( stack ).ordinal(),
Registry.ModItems.POCKET_COMPUTER_NORMAL, Registry.ModItems.POCKET_COMPUTER_ADVANCED
);
registerItemProperty( "coloured",
( stack, world, player ) -> IColouredItem.getColourBasic( stack ) != -1 ? 1 : 0,
Registry.ModItems.POCKET_COMPUTER_NORMAL, Registry.ModItems.POCKET_COMPUTER_ADVANCED
);
} );
}
@SafeVarargs

View File

@ -82,7 +82,6 @@ import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fml.DeferredWorkQueue;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.common.Mod;
@ -339,12 +338,11 @@ public final class Registry
}
@SubscribeEvent
@SuppressWarnings( "deprecation" )
public static void init( FMLCommonSetupEvent event )
{
NetworkHandler.setup();
DeferredWorkQueue.runLater( () -> {
event.enqueueWork( () -> {
registerProviders();
ArgumentSerializers.register();
registerLoot();