2019-07-11 09:03:08 +02:00
|
|
|
package com.simibubi.create;
|
|
|
|
|
2019-09-03 23:03:52 +02:00
|
|
|
import com.simibubi.create.foundation.item.IItemWithColorHandler;
|
2019-10-15 22:22:19 +02:00
|
|
|
import com.simibubi.create.foundation.utility.Lang;
|
2019-09-12 10:00:15 +02:00
|
|
|
import com.simibubi.create.modules.IModule;
|
2019-12-05 23:42:01 +01:00
|
|
|
import com.simibubi.create.modules.contraptions.GogglesItem;
|
2019-10-29 19:02:20 +01:00
|
|
|
import com.simibubi.create.modules.contraptions.WrenchItem;
|
|
|
|
import com.simibubi.create.modules.contraptions.WrenchItemRenderer;
|
2019-11-12 21:09:32 +01:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.belt.BeltConnectorItem;
|
2019-12-12 10:56:34 +01:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.gearbox.VerticalGearboxItem;
|
2019-09-03 23:03:52 +02:00
|
|
|
import com.simibubi.create.modules.curiosities.ChromaticCompoundCubeItem;
|
2020-01-26 23:58:55 +01:00
|
|
|
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem;
|
|
|
|
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItemRenderer;
|
2019-10-30 02:05:26 +01:00
|
|
|
import com.simibubi.create.modules.curiosities.deforester.DeforesterItem;
|
|
|
|
import com.simibubi.create.modules.curiosities.deforester.DeforesterItemRenderer;
|
2019-09-14 18:21:30 +02:00
|
|
|
import com.simibubi.create.modules.curiosities.symmetry.SymmetryWandItem;
|
|
|
|
import com.simibubi.create.modules.curiosities.symmetry.client.SymmetryWandItemRenderer;
|
2020-01-26 23:58:55 +01:00
|
|
|
import com.simibubi.create.modules.curiosities.tools.SandPaperItem;
|
|
|
|
import com.simibubi.create.modules.curiosities.tools.SandPaperItemRenderer;
|
2019-08-18 17:02:29 +02:00
|
|
|
import com.simibubi.create.modules.gardens.TreeFertilizerItem;
|
2020-01-19 19:29:39 +01:00
|
|
|
import com.simibubi.create.modules.logistics.item.filter.FilterItem;
|
2019-09-03 23:03:52 +02:00
|
|
|
import com.simibubi.create.modules.schematics.item.SchematicAndQuillItem;
|
|
|
|
import com.simibubi.create.modules.schematics.item.SchematicItem;
|
2019-07-11 09:03:08 +02:00
|
|
|
|
2019-08-27 17:35:34 +02:00
|
|
|
import net.minecraft.client.Minecraft;
|
2019-09-03 23:03:52 +02:00
|
|
|
import net.minecraft.client.renderer.color.ItemColors;
|
2019-07-28 10:08:49 +02:00
|
|
|
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
|
2019-07-11 09:03:08 +02:00
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.Item.Properties;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2019-07-28 10:08:49 +02:00
|
|
|
import net.minecraft.item.Rarity;
|
2019-07-15 12:10:57 +02:00
|
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
|
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
2019-12-05 23:42:01 +01:00
|
|
|
import net.minecraftforge.event.RegistryEvent;
|
2019-07-28 10:08:49 +02:00
|
|
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
|
|
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
2019-07-11 09:03:08 +02:00
|
|
|
import net.minecraftforge.registries.IForgeRegistry;
|
|
|
|
|
2019-07-28 10:08:49 +02:00
|
|
|
@EventBusSubscriber(value = Dist.CLIENT, bus = Bus.MOD)
|
2019-07-11 09:03:08 +02:00
|
|
|
public enum AllItems {
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-09-12 10:00:15 +02:00
|
|
|
__MATERIALS__(),
|
2019-12-19 22:35:45 +01:00
|
|
|
COPPER_NUGGET(ingredient()),
|
|
|
|
ZINC_NUGGET(ingredient()),
|
|
|
|
BRASS_NUGGET(ingredient()),
|
2019-09-13 18:36:18 +02:00
|
|
|
IRON_SHEET(ingredient()),
|
2019-09-16 12:27:28 +02:00
|
|
|
GOLD_SHEET(ingredient()),
|
2020-01-26 23:58:55 +01:00
|
|
|
COPPER_SHEET(ingredient()),
|
2019-12-19 22:35:45 +01:00
|
|
|
BRASS_SHEET(ingredient()),
|
2020-01-26 23:58:55 +01:00
|
|
|
LAPIS_PLATE(ingredient()),
|
2019-09-05 02:16:44 +02:00
|
|
|
|
2019-12-19 22:35:45 +01:00
|
|
|
CRUSHED_IRON(ingredient()),
|
|
|
|
CRUSHED_GOLD(ingredient()),
|
|
|
|
CRUSHED_COPPER(ingredient()),
|
|
|
|
CRUSHED_ZINC(ingredient()),
|
|
|
|
CRUSHED_BRASS(ingredient()),
|
2020-01-26 23:58:55 +01:00
|
|
|
|
|
|
|
ANDESITE_ALLOY(ingredient()),
|
|
|
|
COPPER_INGOT(ingredient()),
|
|
|
|
ZINC_INGOT(ingredient()),
|
|
|
|
BRASS_INGOT(ingredient()),
|
|
|
|
SAND_PAPER(
|
|
|
|
new SandPaperItem(standardItemProperties().setTEISR(() -> () -> renderUsing(AllItemRenderers.SAND_PAPER)))),
|
|
|
|
RED_SAND_PAPER(
|
|
|
|
new SandPaperItem(standardItemProperties().setTEISR(() -> () -> renderUsing(AllItemRenderers.SAND_PAPER)))),
|
|
|
|
OBSIDIAN_DUST(ingredient()),
|
|
|
|
ROSE_QUARTZ(ingredient()),
|
|
|
|
POLISHED_ROSE_QUARTZ(ingredient()),
|
|
|
|
CHROMATIC_COMPOUND(new ChromaticCompoundCubeItem(standardItemProperties().rarity(Rarity.UNCOMMON))),
|
|
|
|
SHADOW_STEEL(new Item(standardItemProperties().rarity(Rarity.UNCOMMON))),
|
|
|
|
REFINED_RADIANCE(new Item(standardItemProperties().rarity(Rarity.UNCOMMON))),
|
2020-01-13 20:23:44 +01:00
|
|
|
ELECTRON_TUBE(ingredient()),
|
2020-01-26 23:58:55 +01:00
|
|
|
INTEGRATED_CIRCUIT(ingredient()),
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-09-12 10:00:15 +02:00
|
|
|
__GARDENS__(),
|
|
|
|
TREE_FERTILIZER(new TreeFertilizerItem(standardItemProperties())),
|
2019-09-03 23:03:52 +02:00
|
|
|
|
2019-09-12 10:00:15 +02:00
|
|
|
__SCHEMATICS__(),
|
|
|
|
EMPTY_BLUEPRINT(new Item(standardItemProperties().maxStackSize(1))),
|
|
|
|
BLUEPRINT_AND_QUILL(new SchematicAndQuillItem(standardItemProperties().maxStackSize(1))),
|
|
|
|
BLUEPRINT(new SchematicItem(standardItemProperties())),
|
2019-09-13 18:36:18 +02:00
|
|
|
|
2019-09-12 10:00:15 +02:00
|
|
|
__CONTRAPTIONS__(),
|
2019-11-12 21:09:32 +01:00
|
|
|
BELT_CONNECTOR(new BeltConnectorItem(standardItemProperties())),
|
2019-09-24 14:40:01 +02:00
|
|
|
VERTICAL_GEARBOX(new VerticalGearboxItem(new Properties())),
|
2019-09-13 18:36:18 +02:00
|
|
|
FLOUR(ingredient()),
|
|
|
|
DOUGH(ingredient()),
|
|
|
|
PROPELLER(ingredient()),
|
2019-12-19 22:35:45 +01:00
|
|
|
WRENCH(new WrenchItem(standardItemProperties().setTEISR(() -> () -> renderUsing(AllItemRenderers.WRENCH))), true),
|
|
|
|
GOGGLES(new GogglesItem(standardItemProperties()), true),
|
2019-08-08 16:19:16 +02:00
|
|
|
|
2019-10-05 19:00:43 +02:00
|
|
|
__LOGISTICS__(),
|
2020-01-26 23:58:55 +01:00
|
|
|
// CARDBOARD_BOX(new CardboardBoxItem(standardItemProperties())),
|
|
|
|
// CARDBOARD_BOX_1(new CardboardBoxItem(standardItemProperties())),
|
|
|
|
// CARDBOARD_BOX_2(new CardboardBoxItem(standardItemProperties())),
|
|
|
|
// CARDBOARD_BOX_3(new CardboardBoxItem(standardItemProperties())),
|
2019-10-30 02:05:26 +01:00
|
|
|
|
2020-01-13 20:23:44 +01:00
|
|
|
FILTER(new FilterItem(standardItemProperties()), true),
|
2020-01-19 19:29:39 +01:00
|
|
|
PROPERTY_FILTER(new FilterItem(standardItemProperties()), true),
|
2020-01-26 23:58:55 +01:00
|
|
|
// LOGISTICAL_FILTER(new FilterItem(standardItemProperties())),
|
|
|
|
// LOGISTICAL_DIAL(new LogisticalDialItem(standardItemProperties())),
|
|
|
|
// LOGISTICAL_CONTROLLER_SUPPLY(new LogisticalControllerItem(standardItemProperties(), Type.SUPPLY)),
|
|
|
|
// LOGISTICAL_CONTROLLER_REQUEST(new LogisticalControllerItem(standardItemProperties(), Type.REQUEST)),
|
|
|
|
// LOGISTICAL_CONTROLLER_STORAGE(new LogisticalControllerItem(standardItemProperties(), Type.STORAGE)),
|
|
|
|
// LOGISTICAL_CONTROLLER_CALCULATION(new LogisticalControllerItem(standardItemProperties(), Type.CALCULATION)),
|
|
|
|
// LOGISTICAL_CONTROLLER_TRANSACTIONS(new LogisticalControllerItem(standardItemProperties(), Type.TRANSACTIONS)),
|
2019-10-30 02:05:26 +01:00
|
|
|
|
2019-12-19 22:35:45 +01:00
|
|
|
__CURIOSITIES__(),
|
|
|
|
PLACEMENT_HANDGUN(
|
2020-01-26 23:58:55 +01:00
|
|
|
new BlockzapperItem(new Properties().setTEISR(() -> () -> renderUsing(AllItemRenderers.BUILDER_GUN))),
|
|
|
|
true),
|
2019-12-19 22:35:45 +01:00
|
|
|
DEFORESTER(
|
|
|
|
new DeforesterItem(standardItemProperties().setTEISR(() -> () -> renderUsing(AllItemRenderers.DEFORESTER))),
|
|
|
|
true),
|
|
|
|
SYMMETRY_WAND(new SymmetryWandItem(
|
|
|
|
standardItemProperties().setTEISR(() -> () -> renderUsing(AllItemRenderers.SYMMETRY_WAND))), true),
|
|
|
|
|
2019-08-06 19:00:51 +02:00
|
|
|
;
|
2019-07-11 09:03:08 +02:00
|
|
|
|
2019-09-12 10:00:15 +02:00
|
|
|
private static class CategoryTracker {
|
|
|
|
static IModule currentModule;
|
|
|
|
}
|
|
|
|
|
2019-08-08 23:10:01 +02:00
|
|
|
// Common
|
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
public Item item;
|
2019-09-12 10:00:15 +02:00
|
|
|
public IModule module;
|
2019-12-19 22:35:45 +01:00
|
|
|
public boolean firstInCreativeTab;
|
2019-09-12 10:00:15 +02:00
|
|
|
|
|
|
|
private AllItems() {
|
|
|
|
CategoryTracker.currentModule = new IModule() {
|
|
|
|
@Override
|
|
|
|
public String getModuleName() {
|
2019-10-15 22:22:19 +02:00
|
|
|
return Lang.asId(name()).replaceAll("__", "");
|
2019-09-12 10:00:15 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2019-07-11 09:03:08 +02:00
|
|
|
|
|
|
|
private AllItems(Item item) {
|
2019-12-19 22:35:45 +01:00
|
|
|
this(item, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
private AllItems(Item item, boolean firstInCreativeTab) {
|
2019-07-11 09:03:08 +02:00
|
|
|
this.item = item;
|
2019-10-15 22:22:19 +02:00
|
|
|
this.item.setRegistryName(Create.ID, Lang.asId(name()));
|
2019-09-12 10:00:15 +02:00
|
|
|
this.module = CategoryTracker.currentModule;
|
2019-12-19 22:35:45 +01:00
|
|
|
this.firstInCreativeTab = firstInCreativeTab;
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-09-12 10:00:15 +02:00
|
|
|
public static Properties standardItemProperties() {
|
2019-07-11 09:03:08 +02:00
|
|
|
return new Properties().group(Create.creativeTab);
|
|
|
|
}
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-09-13 18:36:18 +02:00
|
|
|
private static Item ingredient() {
|
|
|
|
return ingredient(Rarity.COMMON);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static Item ingredient(Rarity rarity) {
|
|
|
|
return new Item(standardItemProperties().rarity(rarity));
|
|
|
|
}
|
|
|
|
|
2019-12-05 23:42:01 +01:00
|
|
|
public static void register(RegistryEvent.Register<Item> event) {
|
|
|
|
IForgeRegistry<Item> registry = event.getRegistry();
|
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
for (AllItems item : values()) {
|
2019-09-12 10:00:15 +02:00
|
|
|
if (item.get() == null)
|
|
|
|
continue;
|
2019-12-05 23:42:01 +01:00
|
|
|
registry.register(item.get());
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|
2019-12-19 22:35:45 +01:00
|
|
|
|
2019-12-05 23:42:01 +01:00
|
|
|
AllBlocks.registerItemBlocks(registry);
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
public Item get() {
|
|
|
|
return item;
|
|
|
|
}
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
public boolean typeOf(ItemStack stack) {
|
|
|
|
return stack.getItem() == item;
|
|
|
|
}
|
2019-10-30 02:05:26 +01:00
|
|
|
|
2019-10-05 19:00:43 +02:00
|
|
|
public ItemStack asStack() {
|
|
|
|
return new ItemStack(item);
|
|
|
|
}
|
2019-07-11 09:03:08 +02:00
|
|
|
|
2019-08-08 23:10:01 +02:00
|
|
|
// Client
|
|
|
|
|
|
|
|
private enum AllItemRenderers {
|
2020-01-26 23:58:55 +01:00
|
|
|
SYMMETRY_WAND, BUILDER_GUN, WRENCH, DEFORESTER, SAND_PAPER;
|
2019-08-08 23:10:01 +02:00
|
|
|
}
|
|
|
|
|
2019-07-15 12:10:57 +02:00
|
|
|
@OnlyIn(Dist.CLIENT)
|
2019-08-27 17:35:34 +02:00
|
|
|
public static void registerColorHandlers() {
|
2019-09-03 23:03:52 +02:00
|
|
|
ItemColors itemColors = Minecraft.getInstance().getItemColors();
|
|
|
|
for (AllItems item : values()) {
|
|
|
|
if (item.item instanceof IItemWithColorHandler) {
|
|
|
|
itemColors.register(((IItemWithColorHandler) item.item).getColorHandler(), item.item);
|
|
|
|
}
|
|
|
|
}
|
2019-08-27 17:35:34 +02:00
|
|
|
}
|
2019-09-03 23:03:52 +02:00
|
|
|
|
2019-08-27 17:35:34 +02:00
|
|
|
@OnlyIn(Dist.CLIENT)
|
2019-08-08 23:10:01 +02:00
|
|
|
public static ItemStackTileEntityRenderer renderUsing(AllItemRenderers renderer) {
|
|
|
|
switch (renderer) {
|
2019-09-03 23:03:52 +02:00
|
|
|
|
2019-08-08 23:10:01 +02:00
|
|
|
case SYMMETRY_WAND:
|
2019-07-28 10:08:49 +02:00
|
|
|
return new SymmetryWandItemRenderer();
|
2019-08-08 23:10:01 +02:00
|
|
|
case BUILDER_GUN:
|
2020-01-26 23:58:55 +01:00
|
|
|
return new BlockzapperItemRenderer();
|
2019-10-29 19:02:20 +01:00
|
|
|
case WRENCH:
|
|
|
|
return new WrenchItemRenderer();
|
2019-10-30 02:05:26 +01:00
|
|
|
case DEFORESTER:
|
|
|
|
return new DeforesterItemRenderer();
|
2020-01-26 23:58:55 +01:00
|
|
|
case SAND_PAPER:
|
|
|
|
return new SandPaperItemRenderer();
|
2019-08-08 23:10:01 +02:00
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|