Flattened dusts.
This commit is contained in:
parent
1ee9ffb007
commit
edd4e0df3e
23 changed files with 365 additions and 856 deletions
|
@ -50,6 +50,7 @@ import reborncore.common.util.OreDrop;
|
|||
import reborncore.common.util.StringUtils;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.init.ModDusts;
|
||||
import techreborn.init.ModGems;
|
||||
import techreborn.items.ItemDusts;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
@ -149,16 +150,16 @@ public class BlockOre extends Block implements IOreNameProvider {
|
|||
OreDrop sapphire = new OreDrop(ModGems.SAPPHIRE.getStack(sapphireMinQuantity), sapphireMaxQuantity);
|
||||
drops.add(sapphire.getDrops(fortune, random));
|
||||
} else if (variant.equalsIgnoreCase("Pyrite")) {
|
||||
OreDrop pyriteDust = new OreDrop(ItemDusts.getDustByName("pyrite", pyriteMinQuatity), pyriteMaxQuantity);
|
||||
OreDrop pyriteDust = new OreDrop(ModDusts.PYRITE.getStack(pyriteMinQuatity), pyriteMaxQuantity);
|
||||
drops.add(pyriteDust.getDrops(fortune, random));
|
||||
} else if (variant.equalsIgnoreCase("Sodalite")) {
|
||||
OreDrop sodalite = new OreDrop(ItemDusts.getDustByName("sodalite", sodaliteMinQuatity), sodaliteMaxQuantity);
|
||||
OreDrop sodalite = new OreDrop(ModDusts.SODALITE.getStack(sodaliteMinQuatity), sodaliteMaxQuantity);
|
||||
drops.add(sodalite.getDrops(fortune, random));
|
||||
} else if (variant.equalsIgnoreCase("Cinnabar")) {
|
||||
OreDrop cinnabar = new OreDrop(ItemDusts.getDustByName("cinnabar", cinnabarMinQuatity), cinnabarMaxQuantity);
|
||||
OreDrop cinnabar = new OreDrop(ModDusts.CINNABAR.getStack(cinnabarMinQuatity), cinnabarMaxQuantity);
|
||||
drops.add(cinnabar.getDrops(fortune, random));
|
||||
} else if (variant.equalsIgnoreCase("Sphalerite")) {
|
||||
OreDrop sphalerite = new OreDrop(ItemDusts.getDustByName("sphalerite", sphaleriteMinQuatity), sphaleriteMaxQuantity);
|
||||
OreDrop sphalerite = new OreDrop(ModDusts.SPHALERITE.getStack(sphaleriteMinQuatity), sphaleriteMaxQuantity);
|
||||
drops.add(sphalerite.getDrops(fortune, random));
|
||||
} else {
|
||||
drops.add(new ItemStack(Item.getItemFromBlock(this), 1, meta));
|
||||
|
|
|
@ -37,6 +37,7 @@ import techreborn.blocks.cable.BlockCable;
|
|||
import techreborn.blocks.cable.EnumCableType;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.init.ModDusts;
|
||||
import techreborn.init.ModGems;
|
||||
import techreborn.init.ModIngots;
|
||||
import techreborn.init.ModItems;
|
||||
|
@ -130,13 +131,10 @@ public class RegisterItemJsons {
|
|||
ModGems.registerModel();
|
||||
ModPlates.registerModel();
|
||||
ModNuggets.registerModel();
|
||||
ModDusts.registerModel();
|
||||
|
||||
String[] name = ItemDusts.types.clone();
|
||||
for (int i = 0; i < ItemDusts.types.length; ++i) {
|
||||
registerBlockstate(ModItems.DUSTS, i, name[i], "items/materials/");
|
||||
}
|
||||
|
||||
name = ItemDustsSmall.types.clone();
|
||||
String[] name = ItemDustsSmall.types.clone();
|
||||
for (int i = 0; i < ItemDustsSmall.types.length; ++i) {
|
||||
registerBlockstate(ModItems.SMALL_DUSTS, i, name[i], "items/materials/");
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|||
import reborncore.common.registration.RebornRegistry;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import reborncore.common.util.OreDrop;
|
||||
import techreborn.init.ModDusts;
|
||||
import techreborn.init.ModGems;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.items.ItemDusts;
|
||||
|
@ -76,7 +77,7 @@ public class BlockBreakHandler {
|
|||
drops.add(peridot.getDrops(event.getFortuneLevel(), random));
|
||||
}
|
||||
else if (OreDictUtils.isOre(state, "oreSodalite")) {
|
||||
OreDrop aluminium = new OreDrop(ItemDusts.getDustByName("aluminum"), aluminiumDropChance, 1);
|
||||
OreDrop aluminium = new OreDrop(ModDusts.ALUMINUM.getStack(), aluminiumDropChance, 1);
|
||||
drops.add(aluminium.getDrops(event.getFortuneLevel(), random));
|
||||
}
|
||||
else if (OreDictUtils.isOre(state, "oreCinnabar")) {
|
||||
|
|
88
src/main/java/techreborn/init/ModDusts.java
Normal file
88
src/main/java/techreborn/init/ModDusts.java
Normal file
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package techreborn.init;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.RebornRegistry;
|
||||
import techreborn.items.ItemDusts;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
*
|
||||
*/
|
||||
public enum ModDusts implements IStringSerializable {
|
||||
ALMANDINE, ALUMINUM, ANDESITE, ANDRADITE, ASHES, BASALT, BAUXITE, BRASS, BRONZE, CALCITE, CHARCOAL, CHROME,
|
||||
CINNABAR, CLAY, COAL, COPPER, DARK_ASHES, DIAMOND, DIORITE, ELECTRUM, EMERALD, ENDER_EYE, ENDER_PEARL, ENDSTONE,
|
||||
FLINT, GALENA, GOLD, GRANITE, GROSSULAR, INVAR, IRON, LAZURITE, LEAD, MAGNESIUM, MANGANESE, MARBLE, NETHERRACK,
|
||||
NICKEL, OBSIDIAN, OLIVINE, PERIDOT, PHOSPHOROUS, PLATINUM, PYRITE, PYROPE, RED_GARNET, RUBY, SALTPETER, SAPPHIRE,
|
||||
SAW, SILVER, SODALITE, SPESSARTINE, SPHALERITE, STEEL, SULFUR, TIN, TITANIUM, TUNGSTEN, UVAROVITE,
|
||||
YELLOW_GARNET, ZINC;
|
||||
|
||||
public final String name;
|
||||
public final Item item;
|
||||
|
||||
private ModDusts() {
|
||||
name = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "DUST_" + this.toString());
|
||||
item = new ItemDusts();
|
||||
item.setRegistryName(new ResourceLocation(ModInfo.MOD_ID, name));
|
||||
item.setTranslationKey(ModInfo.MOD_ID + "." + name);
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return new ItemStack(item);
|
||||
}
|
||||
|
||||
public ItemStack getStack(int amount) {
|
||||
return new ItemStack(item, amount);
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
Arrays.stream(ModDusts.values()).forEach(dust -> RebornRegistry.registerItem(dust.item));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerModel() {
|
||||
ResourceLocation blockstateJson = new ResourceLocation(ModInfo.MOD_ID, "items/materials/dusts");
|
||||
Arrays.stream(ModDusts.values()).forEach(dust -> ModelLoader.setCustomModelResourceLocation(dust.item, 0,
|
||||
new ModelResourceLocation(blockstateJson, "type=" + dust.name)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
|
@ -45,7 +45,6 @@ import javax.annotation.Nullable;
|
|||
|
||||
public class ModItems {
|
||||
|
||||
public static Item DUSTS;
|
||||
public static Item SMALL_DUSTS;
|
||||
public static Item PARTS;
|
||||
public static Item ROCK_CUTTER;
|
||||
|
@ -154,11 +153,10 @@ public class ModItems {
|
|||
|
||||
public static void init() {
|
||||
|
||||
DUSTS = new ItemDusts();
|
||||
registerItem(DUSTS, "dust");
|
||||
SMALL_DUSTS = new ItemDustsSmall();
|
||||
registerItem(SMALL_DUSTS, "smallDust");
|
||||
|
||||
ModDusts.register();
|
||||
ModIngots.register();
|
||||
ModGems.register();
|
||||
ModPlates.register();
|
||||
|
|
|
@ -81,8 +81,8 @@ public class OreDict {
|
|||
OreUtil.registerOre("materialResin", ItemParts.getPartByName("rubberSap"));
|
||||
OreUtil.registerOre("materialRubber", ItemParts.getPartByName("rubber"));
|
||||
OreUtil.registerOre("itemRubber", ItemParts.getPartByName("rubber"));
|
||||
OreUtil.registerOre("pulpWood", ItemDusts.getDustByName("saw_dust"));
|
||||
OreUtil.registerOre("dustAsh", ItemDusts.getDustByName("ashes"));
|
||||
// OreUtil.registerOre("pulpWood", ItemDusts.getDustByName("saw_dust"));
|
||||
// OreUtil.registerOre("dustAsh", ItemDusts.getDustByName("ashes"));
|
||||
|
||||
// TODO: fix recipe
|
||||
// for (String type : ItemGems.types) {
|
||||
|
|
|
@ -46,22 +46,26 @@ public class SubItemRetriever implements ISubItemRetriever {
|
|||
|
||||
@Override
|
||||
public ItemStack getDustByName(String name) {
|
||||
return ItemDusts.getDustByName(name);
|
||||
// return ItemDusts.getDustByName(name);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getDustByName(String name, int count) {
|
||||
return ItemDusts.getDustByName(name, count);
|
||||
// return ItemDusts.getDustByName(name, count);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getSmallDustByName(String name) {
|
||||
return ItemDustsSmall.getSmallDustByName(name);
|
||||
// return ItemDustsSmall.getSmallDustByName(name);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getSmallDustByName(String name, int count) {
|
||||
return ItemDustsSmall.getSmallDustByName(name, count);
|
||||
// return ItemDustsSmall.getSmallDustByName(name, count);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -40,7 +40,7 @@ import reborncore.common.registration.impl.ConfigRegistry;
|
|||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.machines.IndustrialSawmillRecipe;
|
||||
import techreborn.items.ItemDusts;
|
||||
import techreborn.init.ModDusts;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
@ -116,7 +116,7 @@ public class IndustrialSawmillRecipes extends RecipeMethods {
|
|||
|
||||
public static void addRecipe(ItemStack log, ItemStack plank) {
|
||||
plank.setCount(plankCount);
|
||||
register(log, WATER, 100, 128, plank, ItemDusts.getDustByName("sawDust", 3), getStack(Items.PAPER, 1));
|
||||
register(log, WATER, 100, 128, plank, ModDusts.SAW.getStack(3), getStack(Items.PAPER, 1));
|
||||
}
|
||||
|
||||
static void register(ItemStack input1, FluidStack fluid, int ticks, int euPerTick, ItemStack... outputs) {
|
||||
|
|
|
@ -24,88 +24,45 @@
|
|||
|
||||
package techreborn.items;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
public class ItemDusts extends ItemTR {
|
||||
public static final String[] types = new String[] { "almandine", "aluminum", "andradite", "ashes", "basalt",
|
||||
"bauxite", "brass", "bronze", "calcite", "charcoal", "chrome", "cinnabar", "clay", "coal", "copper",
|
||||
"dark_ashes", "diamond", "electrum", "emerald", "ender_eye", "ender_pearl", "endstone", "flint", "galena",
|
||||
"gold", "grossular", "invar", "iron", "lazurite", "lead", "magnesium", "manganese", "marble", "netherrack",
|
||||
"nickel", "obsidian", "peridot", "phosphorous", "platinum", "pyrite", "pyrope", "red_garnet",
|
||||
"ruby", "saltpeter", "sapphire", "saw_dust", "silver", "sodalite", "spessartine", "sphalerite", "steel",
|
||||
"sulfur", "tin", "titanium", "tungsten", "uvarovite", "yellow_garnet", "zinc",
|
||||
"andesite", "diorite", "granite" };
|
||||
|
||||
public ItemDusts() {
|
||||
setTranslationKey("techreborn.dust");
|
||||
//setHasSubtypes(true);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
TRRecipeHandler.hideEntry(this);
|
||||
}
|
||||
|
||||
public static ItemStack getDustByName(String name, int count) {
|
||||
name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModItems.DUSTS, count, i);
|
||||
}
|
||||
}
|
||||
|
||||
if (name.equalsIgnoreCase("glowstone")) {
|
||||
return new ItemStack(Items.GLOWSTONE_DUST, count);
|
||||
}
|
||||
if (name.equalsIgnoreCase("redstone")) {
|
||||
return new ItemStack(Items.REDSTONE, count);
|
||||
}
|
||||
if (name.equalsIgnoreCase("gunpowder")) {
|
||||
return new ItemStack(Items.GUNPOWDER, count);
|
||||
}
|
||||
throw new InvalidParameterException("The dust " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getDustByName(String name) {
|
||||
return getDustByName(name, 1);
|
||||
}
|
||||
|
||||
public static boolean hasDust(String name){
|
||||
for(String type : types){
|
||||
if(type.equals(name)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* @Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getTranslationKey(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
return super.getTranslationKey() + "." + types[meta];
|
||||
}*/
|
||||
|
||||
/* // Adds Dusts SubItems To Creative Tab
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs creativeTabs, NonNullList<ItemStack> list) {
|
||||
if (!isInCreativeTab(creativeTabs)) {
|
||||
return;
|
||||
}
|
||||
for (int meta = 0; meta < types.length; ++meta) {
|
||||
list.add(new ItemStack(this, 1, meta));
|
||||
}
|
||||
}*/
|
||||
// public static ItemStack getDustByName(String name, int count) {
|
||||
// name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
|
||||
// for (int i = 0; i < types.length; i++) {
|
||||
// if (types[i].equalsIgnoreCase(name)) {
|
||||
// return new ItemStack(ModItems.DUSTS, count, i);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (name.equalsIgnoreCase("glowstone")) {
|
||||
// return new ItemStack(Items.GLOWSTONE_DUST, count);
|
||||
// }
|
||||
// if (name.equalsIgnoreCase("redstone")) {
|
||||
// return new ItemStack(Items.REDSTONE, count);
|
||||
// }
|
||||
// if (name.equalsIgnoreCase("gunpowder")) {
|
||||
// return new ItemStack(Items.GUNPOWDER, count);
|
||||
// }
|
||||
// throw new InvalidParameterException("The dust " + name + " could not be found.");
|
||||
// }
|
||||
//
|
||||
// public static ItemStack getDustByName(String name) {
|
||||
// return getDustByName(name, 1);
|
||||
// }
|
||||
//
|
||||
// public static boolean hasDust(String name){
|
||||
// for(String type : types){
|
||||
// if(type.equals(name)){
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue