Create/src/main/java/com/simibubi/create/AllContainers.java
simibubi facef0ddb1 Bug Fixes in 0.1.1a
- Fixed id downcasing not working properly in non-english environments #25
- Removed event subscriber annotations for mod & registry events
- Added more displayable slots in the Washing JEI view
- Fixed Windowed blocks referencing IBakedModel on the server
- Changed stairs to use blockstate supplier
- Fixed Symmetry Wand crashing when configured in the off-hand
- Fixed "Hold Shift" in tooltips not being translated
- Chassis now drop applied slime balls
- Slime Balls are now craftable
- Mechanical Belts now lock living entities in place
- Blockzapper recipes can now be viewed from the uses of their ingredient materials
- Configured FlexPeaters now synchronize with other players
- Fixed client crash when rendering lava in a deployed schematic #15
- Made encased fans a little less expensive
- Added other coral types to tree fertilizer recipe
2019-10-15 22:22:19 +02:00

61 lines
2.3 KiB
Java

package com.simibubi.create;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.logistics.block.FlexcrateContainer;
import com.simibubi.create.modules.logistics.block.FlexcrateScreen;
import com.simibubi.create.modules.schematics.block.SchematicTableContainer;
import com.simibubi.create.modules.schematics.block.SchematicTableScreen;
import com.simibubi.create.modules.schematics.block.SchematicannonContainer;
import com.simibubi.create.modules.schematics.block.SchematicannonScreen;
import net.minecraft.client.gui.IHasContainer;
import net.minecraft.client.gui.ScreenManager;
import net.minecraft.client.gui.ScreenManager.IScreenFactory;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.inventory.container.ContainerType.IFactory;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.network.IContainerFactory;
import net.minecraftforge.registries.IForgeRegistry;
public enum AllContainers {
SCHEMATIC_TABLE(SchematicTableContainer::new),
SCHEMATICANNON(SchematicannonContainer::new),
FLEXCRATE(FlexcrateContainer::new),
;
public ContainerType<? extends Container> type;
private IFactory<?> factory;
private <C extends Container> AllContainers(IContainerFactory<C> factory) {
this.factory = factory;
}
public static void registerContainers(IForgeRegistry<ContainerType<?>> iForgeRegistry) {
for (AllContainers container : values()) {
container.type = new ContainerType<>(container.factory)
.setRegistryName(new ResourceLocation(Create.ID, Lang.asId(container.name())));
iForgeRegistry.register(container.type);
}
}
@OnlyIn(Dist.CLIENT)
public static void registerScreenFactories() {
bind(SCHEMATIC_TABLE, SchematicTableScreen::new);
bind(SCHEMATICANNON, SchematicannonScreen::new);
bind(FLEXCRATE, FlexcrateScreen::new);
}
@OnlyIn(Dist.CLIENT)
@SuppressWarnings("unchecked")
private static <C extends Container, S extends Screen & IHasContainer<C>> void bind(AllContainers c,
IScreenFactory<C, S> factory) {
ScreenManager.registerFactory((ContainerType<C>) c.type, factory);
}
}