Compare commits

..
3 changed files with 31 additions and 16 deletions

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
dependencies {
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.25-GTNH:dev')
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive=false}
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-999-GTNH:api')
api('com.github.GTNewHorizons:Applied-Energistics-2-NH:1.0.2:api')
api('com.github.GTNewHorizons:ThaumicBoots:1.5.13:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:Botania:1.13.39-GTNH:dev') {transitive=false}
@@ -9,6 +9,8 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.registry.GameRegistry;
/**
* Created by pixlepix on 3/31/14.
* <p/>
@@ -97,7 +99,7 @@ public enum EnumOreFrequency {
for (EnumOreFrequency e : getValidOres()) {
randInt -= e.freq;
if (randInt < 0) {
return OreDictionary.getOres(e.name).get(0);
return e.getOre();
}
}
return new ItemStack(Blocks.iron_ore);
@@ -105,6 +107,17 @@ public enum EnumOreFrequency {
public boolean isValid() {
return !Arrays.asList(OreClusterGenerator.blacklist).contains(name) && !OreDictionary.getOres(name).isEmpty()
&& OreDictionary.getOres(name).get(0).getItem() instanceof ItemBlock;
&& getOre().getItem() instanceof ItemBlock;
}
/// The ore block generated for this name: MaterialLib's when it registers one, since other mods' ore blocks
/// under the same name are copies of it, else the first block registered.
private ItemStack getOre() {
ArrayList<ItemStack> ores = OreDictionary.getOres(name);
for (ItemStack ore : ores) {
GameRegistry.UniqueIdentifier id = GameRegistry.findUniqueIdentifierFor(ore.getItem());
if (id != null && "materiallib".equals(id.modId) && ore.getItem() instanceof ItemBlock) return ore;
}
return ores.get(0);
}
}
@@ -116,6 +116,14 @@ public class TTRegistry {
loadSimpleItem(new thaumic.tinkerer.common.item.kami.tool.ItemIchorSword());
loadSimpleItem(new thaumic.tinkerer.common.item.kami.tool.ItemIchorSwordAdv());
loadSimpleItem(new thaumic.tinkerer.common.item.quartz.ItemDarkQuartz());
for (Item[] itemArrayList : itemRegistry.values()) {
for (Item item : itemArrayList) {
if (!(item instanceof ItemBlock)) {
GameRegistry.registerItem(item, ((ITTinkererItem) item).getItemName());
}
}
}
}
public void init() {
@@ -123,13 +131,9 @@ public class TTRegistry {
for (Item item : itemArrayList) {
registerRecipe((ITTinkererRegisterable) item);
if (!(item instanceof ItemBlock)) {
GameRegistry.registerItem(item, ((ITTinkererItem) item).getItemName());
if (((ITTinkererItem) item).shouldDisplayInTab()
&& FMLCommonHandler.instance().getSide() == Side.CLIENT) {
ModCreativeTab.INSTANCE.addItem(item);
}
if (!(item instanceof ItemBlock) && ((ITTinkererItem) item).shouldDisplayInTab()
&& FMLCommonHandler.instance().getSide() == Side.CLIENT) {
ModCreativeTab.INSTANCE.addItem(item);
}
}
}
@@ -194,15 +198,13 @@ public class TTRegistry {
blockRegistry.put(newBlock.getClass(), blockList);
blockList[0] = newBlock;
// Fill list before registering, ItemBlock constructors read it
int index = 1;
for (Block metaBlock : metaBlocks) {
metaBlock.setBlockName(((ITTinkererBlock) metaBlock).getBlockName());
blockList[index++] = metaBlock;
}
registerBlock(newBlock, ittBlock);
for (Block metaBlock : metaBlocks) {
registerBlock(metaBlock, (ITTinkererBlock) metaBlock);
ITTinkererBlock metaIttBlock = (ITTinkererBlock) metaBlock;
metaBlock.setBlockName(metaIttBlock.getBlockName());
blockList[index++] = metaBlock;
registerBlock(metaBlock, metaIttBlock);
}
Class<? extends ItemBlock> itemBlock = ittBlock.getItemBlock();