2020-04-13 21:48:35 +02:00
|
|
|
package de.ellpeck.prettypipes;
|
|
|
|
|
|
|
|
import de.ellpeck.prettypipes.blocks.PipeBlock;
|
2020-04-13 22:54:18 +02:00
|
|
|
import de.ellpeck.prettypipes.items.WrenchItem;
|
2020-04-13 21:48:35 +02:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.client.renderer.RenderType;
|
|
|
|
import net.minecraft.client.renderer.RenderTypeLookup;
|
|
|
|
import net.minecraft.item.BlockItem;
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemGroup;
|
2020-04-13 22:54:18 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
2020-04-13 21:48:35 +02:00
|
|
|
import net.minecraftforge.event.RegistryEvent;
|
|
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|
|
|
import net.minecraftforge.fml.common.Mod;
|
|
|
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
|
|
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
|
|
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
|
|
|
import net.minecraftforge.registries.ForgeRegistries;
|
|
|
|
|
|
|
|
@Mod.EventBusSubscriber(bus = Bus.MOD)
|
|
|
|
public final class Registry {
|
|
|
|
|
2020-04-13 22:54:18 +02:00
|
|
|
public static final ItemGroup GROUP = new ItemGroup(PrettyPipes.ID) {
|
|
|
|
@Override
|
|
|
|
public ItemStack createIcon() {
|
|
|
|
return new ItemStack(wrench);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
public static Item wrench;
|
2020-04-13 21:48:35 +02:00
|
|
|
public static Block pipe;
|
|
|
|
|
|
|
|
@SubscribeEvent
|
|
|
|
public static void registerBlocks(RegistryEvent.Register<Block> event) {
|
|
|
|
event.getRegistry().registerAll(
|
|
|
|
pipe = new PipeBlock().setRegistryName("pipe")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@SubscribeEvent
|
|
|
|
public static void registerItems(RegistryEvent.Register<Item> event) {
|
2020-04-13 22:54:18 +02:00
|
|
|
event.getRegistry().registerAll(
|
|
|
|
wrench = new WrenchItem().setRegistryName("wrench")
|
|
|
|
);
|
|
|
|
|
2020-04-13 21:48:35 +02:00
|
|
|
ForgeRegistries.BLOCKS.getValues().stream()
|
|
|
|
.filter(b -> b.getRegistryName().getNamespace().equals(PrettyPipes.ID))
|
2020-04-13 22:54:18 +02:00
|
|
|
.forEach(b -> event.getRegistry().register(new BlockItem(b, new Item.Properties().group(GROUP)).setRegistryName(b.getRegistryName())));
|
2020-04-13 21:48:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void setup(FMLCommonSetupEvent event) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setupClient(FMLClientSetupEvent event) {
|
|
|
|
RenderTypeLookup.setRenderLayer(pipe, RenderType.cutout());
|
|
|
|
}
|
|
|
|
}
|