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-08-31 08:37:57 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.belt.BeltItem;
|
2019-09-03 23:03:52 +02:00
|
|
|
import com.simibubi.create.modules.curiosities.ChromaticCompoundCubeItem;
|
2019-07-28 10:08:49 +02:00
|
|
|
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItem;
|
|
|
|
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItemRenderer;
|
|
|
|
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunModel;
|
2019-08-18 17:02:29 +02:00
|
|
|
import com.simibubi.create.modules.gardens.TreeFertilizerItem;
|
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-23 12:54:53 +02:00
|
|
|
import com.simibubi.create.modules.symmetry.SymmetryWandItem;
|
2019-07-28 10:08:49 +02:00
|
|
|
import com.simibubi.create.modules.symmetry.client.SymmetryWandItemRenderer;
|
|
|
|
import com.simibubi.create.modules.symmetry.client.SymmetryWandModel;
|
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.model.IBakedModel;
|
|
|
|
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
|
|
|
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.client.event.ModelBakeEvent;
|
|
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|
|
|
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
|
|
|
|
|
|
|
SYMMETRY_WAND(new SymmetryWandItem(
|
2019-08-08 23:10:01 +02:00
|
|
|
standardProperties().setTEISR(() -> () -> renderUsing(AllItemRenderers.SYMMETRY_WAND)))),
|
2019-09-03 23:03:52 +02:00
|
|
|
|
2019-08-08 23:10:01 +02:00
|
|
|
PLACEMENT_HANDGUN(
|
|
|
|
new BuilderGunItem(new Properties().setTEISR(() -> () -> renderUsing(AllItemRenderers.BUILDER_GUN)))),
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-09-07 13:12:12 +02:00
|
|
|
ANDESITE_ALLOY_CUBE(new Item(standardProperties())),
|
|
|
|
BLAZE_BRASS_CUBE(new Item(standardProperties())),
|
2019-07-28 10:08:49 +02:00
|
|
|
CHORUS_CHROME_CUBE(new Item(standardProperties().rarity(Rarity.UNCOMMON))),
|
2019-09-03 23:03:52 +02:00
|
|
|
SHADOW_STEEL_CUBE(new Item(standardProperties().rarity(Rarity.UNCOMMON))),
|
2019-09-07 13:12:12 +02:00
|
|
|
ROSE_QUARTZ(new Item(standardProperties())),
|
|
|
|
REFINED_ROSE_QUARTZ(new Item(standardProperties())),
|
|
|
|
CHROMATIC_COMPOUND_CUBE(new ChromaticCompoundCubeItem(standardProperties().rarity(Rarity.UNCOMMON))),
|
2019-09-09 18:18:32 +02:00
|
|
|
REFINED_RADIANCE_CUBE(new Item(standardProperties().rarity(Rarity.RARE))),
|
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-07-19 17:50:23 +02:00
|
|
|
TREE_FERTILIZER(new TreeFertilizerItem(standardProperties())),
|
2019-09-03 23:03:52 +02:00
|
|
|
|
2019-07-11 19:55:11 +02:00
|
|
|
EMPTY_BLUEPRINT(new Item(standardProperties().maxStackSize(1))),
|
2019-09-03 23:03:52 +02:00
|
|
|
BLUEPRINT_AND_QUILL(new SchematicAndQuillItem(standardProperties().maxStackSize(1))),
|
2019-09-07 13:12:12 +02:00
|
|
|
BLUEPRINT(new SchematicItem(standardProperties())),
|
|
|
|
BELT_CONNECTOR(new BeltItem(standardProperties())),
|
2019-08-08 16:19:16 +02:00
|
|
|
|
2019-08-06 19:00:51 +02:00
|
|
|
;
|
2019-07-11 09:03:08 +02:00
|
|
|
|
2019-08-08 23:10:01 +02:00
|
|
|
// Common
|
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
public Item item;
|
|
|
|
|
|
|
|
private AllItems(Item item) {
|
|
|
|
this.item = item;
|
|
|
|
this.item.setRegistryName(Create.ID, this.name().toLowerCase());
|
|
|
|
}
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
public static Properties standardProperties() {
|
|
|
|
return new Properties().group(Create.creativeTab);
|
|
|
|
}
|
2019-07-28 10:08:49 +02:00
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
public static void registerItems(IForgeRegistry<Item> iForgeRegistry) {
|
|
|
|
for (AllItems item : values()) {
|
|
|
|
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-08-08 23:10:01 +02:00
|
|
|
// Client
|
|
|
|
|
|
|
|
private enum AllItemRenderers {
|
|
|
|
SYMMETRY_WAND, BUILDER_GUN,;
|
|
|
|
}
|
|
|
|
|
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-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
|
|
|
|
|
|
|
@SubscribeEvent
|
|
|
|
@OnlyIn(Dist.CLIENT)
|
|
|
|
public static void onModelBake(ModelBakeEvent event) {
|
|
|
|
|
|
|
|
ModelResourceLocation wandLocation = getModelLocation(SYMMETRY_WAND);
|
|
|
|
IBakedModel template = event.getModelRegistry().get(wandLocation);
|
|
|
|
event.getModelRegistry().put(wandLocation, new SymmetryWandModel(template).loadPartials(event));
|
|
|
|
|
|
|
|
ModelResourceLocation handgunLocation = getModelLocation(PLACEMENT_HANDGUN);
|
|
|
|
template = event.getModelRegistry().get(handgunLocation);
|
|
|
|
event.getModelRegistry().put(handgunLocation, new BuilderGunModel(template).loadPartials(event));
|
|
|
|
}
|
|
|
|
|
|
|
|
protected static ModelResourceLocation getModelLocation(AllItems item) {
|
|
|
|
return new ModelResourceLocation(item.item.getRegistryName(), "inventory");
|
|
|
|
}
|
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|