Add crates?
This commit is contained in:
parent
300c27d366
commit
a246cf5e25
@ -13,7 +13,11 @@ import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.level.material.MaterialColor;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
@ -75,6 +79,22 @@ public class Registry {
|
||||
|
||||
private static <T> Class<T> c(Class<?> cls) { return (Class<T>) cls; }
|
||||
|
||||
record CrateProps(MaterialColor color, ResourceLocation name) {
|
||||
public CrateProps(MaterialColor color, String name) {
|
||||
this(color, new ResourceLocation(OverdriveThatMatters.MOD_ID, "crate_" + name));
|
||||
}
|
||||
}
|
||||
|
||||
public static final CrateProps[] CRATES = new CrateProps[] {
|
||||
new CrateProps(MaterialColor.COLOR_RED, "red"),
|
||||
new CrateProps(MaterialColor.COLOR_BLUE, "blue"),
|
||||
new CrateProps(MaterialColor.COLOR_YELLOW, "yellow"),
|
||||
new CrateProps(MaterialColor.COLOR_GREEN, "green"),
|
||||
new CrateProps(MaterialColor.COLOR_BLACK, "black"),
|
||||
new CrateProps(MaterialColor.COLOR_PINK, "pink"),
|
||||
new CrateProps(MaterialColor.COLOR_PURPLE, "purple"),
|
||||
};
|
||||
|
||||
public static class Names {
|
||||
// blocks
|
||||
public static final ResourceLocation ANDROID_STATION = new ResourceLocation(OverdriveThatMatters.MOD_ID, "android_station");
|
||||
@ -178,7 +198,18 @@ public class Registry {
|
||||
public static final Block MATTER_BOTTLER = new BlockMatterBottler();
|
||||
public static final Block DRIVE_VIEWER = new BlockDriveViewer();
|
||||
|
||||
public static final Block[] CRATES = new Block[Registry.CRATES.length];
|
||||
|
||||
static {
|
||||
for (int i = 0; i < Registry.CRATES.length; i++) {
|
||||
CRATES[i] = new Block(BlockBehaviour.Properties.of(Material.METAL, Registry.CRATES[i].color)
|
||||
.sound(SoundType.METAL)
|
||||
.requiresCorrectToolForDrops()
|
||||
.strength(5.0F, 6.0F));
|
||||
|
||||
CRATES[i].setRegistryName(Registry.CRATES[i].name);
|
||||
}
|
||||
|
||||
ANDROID_STATION.setRegistryName(Names.ANDROID_STATION);
|
||||
BATTERY_BANK.setRegistryName(Names.BATTERY_BANK);
|
||||
MATTER_DECOMPOSER.setRegistryName(Names.MATTER_DECOMPOSER);
|
||||
@ -206,6 +237,10 @@ public class Registry {
|
||||
event.getRegistry().register(MATTER_BOTTLER);
|
||||
event.getRegistry().register(DRIVE_VIEWER);
|
||||
|
||||
for (var crate : CRATES) {
|
||||
event.getRegistry().register(crate);
|
||||
}
|
||||
|
||||
// OverdriveThatMatters.LOGGER.info("Registered blocks");
|
||||
}
|
||||
}
|
||||
@ -244,7 +279,14 @@ public class Registry {
|
||||
|
||||
public static final Item NUTRIENT_PASTE = new Item(new Item.Properties().stacksTo(64).food(new FoodProperties.Builder().meat().nutrition(8).saturationMod(0.9F).build()).tab(OverdriveThatMatters.CREATIVE_TAB));
|
||||
|
||||
public static final Item[] CRATES = new Item[Registry.CRATES.length];
|
||||
|
||||
static {
|
||||
for (int i = 0; i < Registry.CRATES.length; i++) {
|
||||
CRATES[i] = new BlockItem(Blocks.CRATES[i], new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
|
||||
CRATES[i].setRegistryName(Registry.CRATES[i].name);
|
||||
}
|
||||
|
||||
ANDROID_STATION.setRegistryName(Names.ANDROID_STATION);
|
||||
BATTERY_BANK.setRegistryName(Names.BATTERY_BANK);
|
||||
MATTER_DECOMPOSER.setRegistryName(Names.MATTER_DECOMPOSER);
|
||||
@ -310,6 +352,10 @@ public class Registry {
|
||||
|
||||
event.getRegistry().register(NUTRIENT_PASTE);
|
||||
|
||||
for (var crate : CRATES) {
|
||||
event.getRegistry().register(crate);
|
||||
}
|
||||
|
||||
// OverdriveThatMatters.LOGGER.info("Registered items");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user