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-10-29 19:02:20 +01:00
|
|
|
import com.simibubi.create.modules.contraptions.WrenchItem;
|
|
|
|
import com.simibubi.create.modules.contraptions.WrenchItemRenderer;
|
2019-09-24 14:40:01 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.VerticalGearboxItem;
|
2019-11-12 21:09:32 +01:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.belt.BeltConnectorItem;
|
2019-09-03 23:03:52 +02:00
|
|
|
import com.simibubi.create.modules.curiosities.ChromaticCompoundCubeItem;
|
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-07-28 10:08:49 +02:00
|
|
|
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItem;
|
|
|
|
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItemRenderer;
|
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;
|
2019-08-18 17:02:29 +02:00
|
|
|
import com.simibubi.create.modules.gardens.TreeFertilizerItem;
|
2019-10-05 19:00:43 +02:00
|
|
|
import com.simibubi.create.modules.logistics.item.CardboardBoxItem;
|
2019-10-30 02:05:26 +01:00
|
|
|
import com.simibubi.create.modules.logistics.item.FilterItem;
|
2019-10-05 19:00:43 +02:00
|
|
|
import com.simibubi.create.modules.logistics.management.LogisticalDialItem;
|
|
|
|
import com.simibubi.create.modules.logistics.management.base.LogisticalControllerBlock.Type;
|
|
|
|
import com.simibubi.create.modules.logistics.management.base.LogisticalControllerItem;
|
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-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
|
|
|
__CURIOSITIES__(),
|
2019-07-28 10:08:49 +02:00
|
|
|
SYMMETRY_WAND(new SymmetryWandItem(
|
2019-09-12 10:00:15 +02:00
|
|
|
standardItemProperties().setTEISR(() -> () -> renderUsing(AllItemRenderers.SYMMETRY_WAND)))),
|
2019-08-08 23:10:01 +02:00
|
|
|
PLACEMENT_HANDGUN(
|
|
|
|
new BuilderGunItem(new Properties().setTEISR(() -> () -> renderUsing(AllItemRenderers.BUILDER_GUN)))),
|
2019-10-30 02:05:26 +01:00
|
|
|
DEFORESTER(new DeforesterItem(
|
|
|
|
standardItemProperties().setTEISR(() -> () -> renderUsing(AllItemRenderers.DEFORESTER)))),
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-09-12 10:00:15 +02:00
|
|
|
__MATERIALS__(),
|
2019-09-13 18:36:18 +02:00
|
|
|
IRON_SHEET(ingredient()),
|
2019-09-16 12:27:28 +02:00
|
|
|
GOLD_SHEET(ingredient()),
|
2019-09-13 18:36:18 +02:00
|
|
|
ANDESITE_ALLOY_CUBE(ingredient()),
|
|
|
|
BLAZE_BRASS_CUBE(ingredient()),
|
|
|
|
CHORUS_CHROME_CUBE(ingredient(Rarity.UNCOMMON)),
|
2019-09-18 11:16:57 +02:00
|
|
|
SHADOW_STEEL_CUBE(new Item(new Properties().rarity(Rarity.UNCOMMON))),
|
|
|
|
ROSE_QUARTZ(new Item(new Properties())),
|
|
|
|
REFINED_ROSE_QUARTZ(new Item(new Properties())),
|
|
|
|
CHROMATIC_COMPOUND_CUBE(new ChromaticCompoundCubeItem(new Properties().rarity(Rarity.UNCOMMON))),
|
|
|
|
REFINED_RADIANCE_CUBE(new Item(new Properties().rarity(Rarity.UNCOMMON))),
|
2019-09-05 02:16:44 +02:00
|
|
|
|
2019-09-09 18:18:32 +02:00
|
|
|
// BLAZING_PICKAXE(new BlazingToolItem(1, -2.8F, standardProperties(), PICKAXE)),
|
|
|
|
// BLAZING_SHOVEL(new BlazingToolItem(1.5F, -3.0F, standardProperties(), SHOVEL)),
|
|
|
|
// BLAZING_AXE(new BlazingToolItem(5.0F, -3.0F, standardProperties(), AXE)),
|
|
|
|
// BLAZING_SWORD(new BlazingToolItem(3, -2.4F, standardProperties(), SWORD)),
|
|
|
|
//
|
|
|
|
// ROSE_QUARTZ_PICKAXE(new RoseQuartzToolItem(1, -2.8F, standardProperties(), PICKAXE)),
|
|
|
|
// ROSE_QUARTZ_SHOVEL(new RoseQuartzToolItem(1.5F, -3.0F, standardProperties(), SHOVEL)),
|
|
|
|
// ROSE_QUARTZ_AXE(new RoseQuartzToolItem(5.0F, -3.0F, standardProperties(), AXE)),
|
|
|
|
// ROSE_QUARTZ_SWORD(new RoseQuartzToolItem(3, -2.4F, standardProperties(), SWORD)),
|
|
|
|
//
|
|
|
|
// SHADOW_STEEL_PICKAXE(new ShadowSteelToolItem(2.5F, -2.0F, standardProperties(), PICKAXE)),
|
|
|
|
// SHADOW_STEEL_MATTOCK(new ShadowSteelToolItem(2.5F, -1.5F, standardProperties(), SHOVEL, AXE, HOE)),
|
|
|
|
// SHADOW_STEEL_SWORD(new ShadowSteelToolItem(3, -2.0F, standardProperties(), SWORD)),
|
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-10-29 19:02:20 +01:00
|
|
|
WRENCH(new WrenchItem(standardItemProperties().setTEISR(() -> () -> renderUsing(AllItemRenderers.WRENCH)))),
|
2019-08-08 16:19:16 +02:00
|
|
|
|
2019-10-19 23:42:44 +02:00
|
|
|
CRUSHED_IRON(ingredient()),
|
|
|
|
CRUSHED_GOLD(ingredient()),
|
2019-10-27 14:15:39 +01:00
|
|
|
TIME_SCARF(ingredient()),
|
|
|
|
MOTION_SCARF(ingredient()),
|
2019-08-08 16:19:16 +02:00
|
|
|
|
2019-10-05 19:00:43 +02:00
|
|
|
__LOGISTICS__(),
|
|
|
|
CARDBOARD_BOX_1616(new CardboardBoxItem(standardItemProperties())),
|
|
|
|
CARDBOARD_BOX_1612(new CardboardBoxItem(standardItemProperties())),
|
|
|
|
CARDBOARD_BOX_1416(new CardboardBoxItem(standardItemProperties())),
|
|
|
|
CARDBOARD_BOX_1410(new CardboardBoxItem(standardItemProperties())),
|
2019-10-30 02:05:26 +01:00
|
|
|
|
|
|
|
FILTER(new FilterItem(standardItemProperties())),
|
2019-10-05 19:00:43 +02:00
|
|
|
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-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;
|
|
|
|
|
|
|
|
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) {
|
|
|
|
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-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-07-11 09:03:08 +02:00
|
|
|
public static void registerItems(IForgeRegistry<Item> iForgeRegistry) {
|
|
|
|
for (AllItems item : values()) {
|
2019-09-12 10:00:15 +02:00
|
|
|
if (item.get() == null)
|
|
|
|
continue;
|
2019-07-11 09:03:08 +02:00
|
|
|
iForgeRegistry.register(item.get());
|
|
|
|
}
|
|
|
|
}
|
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 {
|
2019-10-30 02:05:26 +01:00
|
|
|
SYMMETRY_WAND, BUILDER_GUN, WRENCH, DEFORESTER;
|
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:
|
2019-07-28 10:08:49 +02:00
|
|
|
return new BuilderGunItemRenderer();
|
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();
|
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
|
|
|
}
|