mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f373d5d94c | ||
|
|
1e816da486 | ||
|
|
68fa109b00 | ||
|
|
2b98cfa14b | ||
|
|
fa0ce8fd57 |
No files matched your search
+1
-1
@@ -12,7 +12,7 @@ dependencies {
|
||||
compileOnly('com.github.GTNewHorizons:EnderStorage:1.8.9:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.19.34:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.14.120-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:2.0.0:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.18:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.4.22:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.64-GTNH:api') {transitive=false}
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:api') {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);
|
||||
}
|
||||
}
|
||||
@@ -6,22 +6,20 @@
|
||||
package thaumic.tinkerer.common.multipart;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.multipart.MultiPartRegistry;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartConverter;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartFactory2;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartFactory;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
|
||||
// This class is used by FMP to recreate a part during loading and to convert already existing non-mutlipart blocks into
|
||||
// multiparts.
|
||||
// this is copied from the version FMP uses for vanilla torches
|
||||
public class RegisterBlockPart implements IPartFactory2, IPartConverter {
|
||||
public class RegisterBlockPart implements IPartFactory, IPartConverter {
|
||||
|
||||
Block block = null;
|
||||
Class<? extends TMultiPart> part = null;
|
||||
@@ -43,22 +41,7 @@ public class RegisterBlockPart implements IPartFactory2, IPartConverter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMultiPart createPart(String name, NBTTagCompound nbt) {
|
||||
return newPart(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMultiPart createPart(String name, MCDataInput packet) {
|
||||
return newPart(name);
|
||||
}
|
||||
|
||||
// Matches the legacy IPartFactory adapter, which answered previews with the client part.
|
||||
@Override
|
||||
public TMultiPart createPartForClientPreview(String name, NBTTagCompound nbt) {
|
||||
return newPart(name);
|
||||
}
|
||||
|
||||
private TMultiPart newPart(String name) {
|
||||
public TMultiPart createPart(String name, boolean client) {
|
||||
if (name.equals(name)) try {
|
||||
return part.getConstructor().newInstance();
|
||||
} catch (Exception e) {
|
||||
@@ -72,7 +55,7 @@ public class RegisterBlockPart implements IPartFactory2, IPartConverter {
|
||||
public void init() {
|
||||
if (name.isEmpty() || block == null || part == null) return;
|
||||
MultiPartRegistry.registerConverter(this);
|
||||
MultiPartRegistry.registerPartFactory(this, name);
|
||||
MultiPartRegistry.registerParts(this, new String[] { name });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user