Oops (x2)
This commit is contained in:
parent
0080b1a69b
commit
a5d2eaffa3
4 changed files with 31 additions and 6 deletions
|
@ -9,9 +9,12 @@ import ic2.core.block.type.ResourceBlock;
|
||||||
import ic2.core.item.type.CraftingItemType;
|
import ic2.core.item.type.CraftingItemType;
|
||||||
import ic2.core.ref.BlockName;
|
import ic2.core.ref.BlockName;
|
||||||
import ic2.core.ref.ItemName;
|
import ic2.core.ref.ItemName;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.common.*;
|
import net.minecraftforge.fml.common.*;
|
||||||
import net.minecraftforge.fml.common.event.*;
|
import net.minecraftforge.fml.common.event.*;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||||
import forestry.api.recipes.ICentrifugeRecipe;
|
import forestry.api.recipes.ICentrifugeRecipe;
|
||||||
import forestry.api.recipes.ISqueezerRecipe;
|
import forestry.api.recipes.ISqueezerRecipe;
|
||||||
|
@ -69,12 +72,22 @@ public class GT_Mod implements IGT_Mod {
|
||||||
|
|
||||||
public static GT_Achievements achievements;
|
public static GT_Achievements achievements;
|
||||||
|
|
||||||
|
//@SubscribeEvent
|
||||||
|
//public void onOreDictReg(OreDictionary.OreRegisterEvent event) {
|
||||||
|
// if(event.getOre().getItem() == Item.getItemFromBlock(Blocks.STONE)) {
|
||||||
|
// System.out.println("Register stone as " + event.getName());
|
||||||
|
// new Throwable().printStackTrace();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void onPreLoad(FMLPreInitializationEvent aEvent) {
|
public void onPreLoad(FMLPreInitializationEvent aEvent) {
|
||||||
if (GregTech_API.sPreloadStarted) {
|
if (GregTech_API.sPreloadStarted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
|
||||||
GT_Values.GT = this;
|
GT_Values.GT = this;
|
||||||
GT_Values.DW = new GT_DummyWorld();
|
GT_Values.DW = new GT_DummyWorld();
|
||||||
GT_Values.NW = new GT_PacketHandler();
|
GT_Values.NW = new GT_PacketHandler();
|
||||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry;
|
import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;
|
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;
|
||||||
|
@ -204,4 +205,10 @@ public class GT_Generic_Item extends Item implements IProjectileItem, IIconRegis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void invokeOnClient(Runnable runnable) {
|
||||||
|
if(FMLCommonHandler.instance().getSide().isClient()) {
|
||||||
|
runnable.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -91,6 +91,14 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements
|
||||||
mItemAmount = (short) Math.min(aItemAmount, 32766 - mOffset);
|
mItemAmount = (short) Math.min(aItemAmount, 32766 - mOffset);
|
||||||
|
|
||||||
sInstances.put(getUnlocalizedName(), this);
|
sInstances.put(getUnlocalizedName(), this);
|
||||||
|
invokeOnClient(this::initClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void initClient() {
|
||||||
|
mIconList = new TextureAtlasSprite[mItemAmount][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -213,15 +221,13 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements
|
||||||
if (aMaxCharge == 0) mElectricStats.remove((short) aMetaValue);
|
if (aMaxCharge == 0) mElectricStats.remove((short) aMetaValue);
|
||||||
else {
|
else {
|
||||||
mElectricStats.put((short) aMetaValue, new Long[]{aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData});
|
mElectricStats.put((short) aMetaValue, new Long[]{aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData});
|
||||||
if(FMLCommonHandler.instance().getSide().isClient()) {
|
invokeOnClient(() -> setElectricStatsIcon(aMetaValue, aUseAnimations));
|
||||||
setIconElectricStats(aMetaValue, aUseAnimations);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void setIconElectricStats(int aMetaValue, boolean aUseAnimations) {
|
public void setElectricStatsIcon(int aMetaValue, boolean aUseAnimations) {
|
||||||
if (aMetaValue >= mOffset && aUseAnimations)
|
if (aMetaValue >= mOffset && aUseAnimations)
|
||||||
mIconList[aMetaValue - mOffset] = Arrays.copyOf(mIconList[aMetaValue - mOffset], Math.max(9, mIconList[aMetaValue - mOffset].length));
|
mIconList[aMetaValue - mOffset] = Arrays.copyOf(mIconList[aMetaValue - mOffset], Math.max(9, mIconList[aMetaValue - mOffset].length));
|
||||||
}
|
}
|
||||||
|
@ -342,7 +348,6 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public final void registerIcons(TextureMap aIconRegister) {
|
public final void registerIcons(TextureMap aIconRegister) {
|
||||||
System.out.println("Registering item icons");
|
System.out.println("Registering item icons");
|
||||||
mIconList = new TextureAtlasSprite[mItemAmount][1];
|
|
||||||
for (short i = 0, j = (short) mEnabledItems.length(); i < j; i++)
|
for (short i = 0, j = (short) mEnabledItems.length(); i < j; i++)
|
||||||
if (mEnabledItems.get(i)) {
|
if (mEnabledItems.get(i)) {
|
||||||
for (byte k = 1; k < mIconList[i].length; k++) {
|
for (byte k = 1; k < mIconList[i].length; k++) {
|
||||||
|
|
|
@ -307,7 +307,7 @@ public class GT_ModHandler {
|
||||||
stack.stackSize = (int) aAmount;
|
stack.stackSize = (int) aAmount;
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
return new ItemStack(Blocks.STONE);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue