Fixed a lot of code

Fixed next classes:

* GregTech_API

* GTDummyWorld

* GT_BlockMetaID_Block
This commit is contained in:
TheDarkDnKTv 2020-08-04 16:30:51 +03:00
parent cfd9f46038
commit 717aa982b0
10 changed files with 133 additions and 115 deletions

View file

@ -129,7 +129,7 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
/** /**
* @author Gregorius Techneticies * @author Gregorius Techneticies
*/ */
@Mod(modid = "gregtech_addon", name="GregTech-Addon", version="MC162", useMetadata=false, dependencies="required-after:IC2; after:UndergroundBiomes; after:factorization; after:Railcraft; after:ThermalExpansion; after:ThermalExpansion|Transport; after:ThermalExpansion|Energy; after:ThermalExpansion|Factory; after:XyCraft; after:MetallurgyCore; after:MetallurgyBase; after:MetallurgyEnder; after:MetallurgyFantasy; after:MetallurgyNether; after:MetallurgyPrecious; after:MetallurgyUtility; after:BuildCraft|Silicon; after:BuildCraft|Core; after:BuildCraft|Transport; after:BuildCraft|Factory; after:BuildCraft|Energy; after:BuildCraft|Builders; after:LiquidUU; after:TwilightForest; after:Forestry; after:RedPowerCore; after:RedPowerBase; after:RedPowerMachine; after:RedPowerCompat; after:RedPowerWiring; after:RedPowerLogic; after:RedPowerLighting; after:RedPowerWorld; after:RedPowerControl; after:Tubestuff; after:ICBM; after:Mekanism; after:MekanismGenerators; after:MekanismTools; after:ThaumicTinkerer; after:LiquidXP; after:MineFactoryReloaded; after:TConstruct; after:factorization.misc; after:AtomicScience; after:MFFS; after:ICBM|Contraption; after:ICBM|Explosion; after:ICBM|Sentry; after:mmmPowersuits;") @Mod(modid = "gregtech_addon", name="GregTech-Addon", version="MC1710", useMetadata=false, dependencies="required-after:IC2; after:UndergroundBiomes; after:factorization; after:Railcraft; after:ThermalExpansion; after:ThermalExpansion|Transport; after:ThermalExpansion|Energy; after:ThermalExpansion|Factory; after:XyCraft; after:MetallurgyCore; after:MetallurgyBase; after:MetallurgyEnder; after:MetallurgyFantasy; after:MetallurgyNether; after:MetallurgyPrecious; after:MetallurgyUtility; after:BuildCraft|Silicon; after:BuildCraft|Core; after:BuildCraft|Transport; after:BuildCraft|Factory; after:BuildCraft|Energy; after:BuildCraft|Builders; after:LiquidUU; after:TwilightForest; after:Forestry; after:RedPowerCore; after:RedPowerBase; after:RedPowerMachine; after:RedPowerCompat; after:RedPowerWiring; after:RedPowerLogic; after:RedPowerLighting; after:RedPowerWorld; after:RedPowerControl; after:Tubestuff; after:ICBM; after:Mekanism; after:MekanismGenerators; after:MekanismTools; after:ThaumicTinkerer; after:LiquidXP; after:MineFactoryReloaded; after:TConstruct; after:factorization.misc; after:AtomicScience; after:MFFS; after:ICBM|Contraption; after:ICBM|Explosion; after:ICBM|Sentry; after:mmmPowersuits;")
// @NetworkMod(clientSideRequired = true, serverSideRequired = false, channels = {GregTech_API.GENERIC_CHANNEL, GregTech_API.SOUND_PACKET_CHANNEL, GregTech_API.TILEENTITY_PACKET_CHANNEL/*, "EB", "RC", "XT|TradeSel", "mystcraft", "fz.bounce", "TwilightForest", "mmmPowerSuits", "tfmagicmap", "FOR", "BC", "TC", "TCF", "NuclearControl", "TConstruct", "BasicComponents", "RecipeRemover", "IronChest", "MFFS", "ICBM", "CoFH", "SC2", "ICBM|C", "ICBM|E", "InventoryTweaks", "BIN", "tfmazemap", "BCLP"/**/}, packetHandler = GT_PacketHandler.class, connectionHandler = GT_ConnectionHandler.class) // @NetworkMod(clientSideRequired = true, serverSideRequired = false, channels = {GregTech_API.GENERIC_CHANNEL, GregTech_API.SOUND_PACKET_CHANNEL, GregTech_API.TILEENTITY_PACKET_CHANNEL/*, "EB", "RC", "XT|TradeSel", "mystcraft", "fz.bounce", "TwilightForest", "mmmPowerSuits", "tfmagicmap", "FOR", "BC", "TC", "TCF", "NuclearControl", "TConstruct", "BasicComponents", "RecipeRemover", "IronChest", "MFFS", "ICBM", "CoFH", "SC2", "ICBM|C", "ICBM|E", "InventoryTweaks", "BIN", "tfmazemap", "BCLP"/**/}, packetHandler = GT_PacketHandler.class, connectionHandler = GT_ConnectionHandler.class)
public class GT_Mod implements IGT_Mod, IGT_RecipeAdder { public class GT_Mod implements IGT_Mod, IGT_RecipeAdder {
@Instance @Instance
@ -184,10 +184,10 @@ public class GT_Mod implements IGT_Mod, IGT_RecipeAdder {
public GT_Mod() { public GT_Mod() {
// checkVersions(); // checkVersions();
// if (GregTech_API.isGregTechLoaded()) throw new GT_ItsNotMyFaultException("Why did you install my Addon twice? Remove the second gregtechmod.zip out of your mods-Folder, you need only one of them."); if (GregTech_API.isGregTechLoaded()) throw new GT_ItsNotMyFaultException("Why did you install my Addon twice? Remove the second gregtechmod.zip out of your mods-Folder, you need only one of them.");
// GregTech_API.gregtechmod = this; GregTech_API.gregtechmod = this;
// GregTech_API.sRecipeAdder = this; GregTech_API.sRecipeAdder = this;
// GregTech_API.sDummyWorld = new GT_DummyWorld(); GregTech_API.sDummyWorld = new GT_DummyWorld();
// GregTech_API.sGTCoverload.add(new GT_CoverLoader()); // GregTech_API.sGTCoverload.add(new GT_CoverLoader());
// GT_OreDictHandler.instance.registerHandler(); // GT_OreDictHandler.instance.registerHandler();
// new GT_Cover_None(); // new GT_Cover_None();

View file

@ -22,12 +22,15 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
import net.minecraft.world.ChunkPosition; import net.minecraft.world.ChunkPosition;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
@ -82,7 +85,8 @@ public class GregTech_API {
public static final short MAXIMUM_METATILE_IDS = Short.MAX_VALUE - 1; public static final short MAXIMUM_METATILE_IDS = Short.MAX_VALUE - 1;
/** Icon which represents failed rendering */ /** Icon which represents failed rendering */
public static Icon FAIL_ICON = null; @SideOnly(Side.CLIENT)
public static IIcon FAIL_ICON = null;
/** My Creative Tab */ /** My Creative Tab */
public static final CreativeTabs TAB_GREGTECH = new GT_CreativeTab(); public static final CreativeTabs TAB_GREGTECH = new GT_CreativeTab();
@ -119,7 +123,8 @@ public class GregTech_API {
public static boolean sPreloadStarted = false, sPreloadFinished = false, sLoadStarted = false, sLoadFinished = false, sPostloadStarted = false, sPostloadFinished = false; public static boolean sPreloadStarted = false, sPreloadFinished = false, sLoadStarted = false, sLoadFinished = false, sPostloadStarted = false, sPostloadFinished = false;
/** The Icon List for Covers */ /** The Icon List for Covers */
public static final Map<Integer, Icon> sCovers = new HashMap<Integer, Icon>(); @SideOnly(Side.CLIENT)
public static final Map<Integer, IIcon> sCovers = new HashMap<Integer, IIcon>();
/** The List of Circuit Behaviors for the Redstone Circuit Block */ /** The List of Circuit Behaviors for the Redstone Circuit Block */
public static final Map<Integer, GT_CircuitryBehavior> sCircuitryBehaviors = new HashMap<Integer, GT_CircuitryBehavior>(); public static final Map<Integer, GT_CircuitryBehavior> sCircuitryBehaviors = new HashMap<Integer, GT_CircuitryBehavior>();
@ -197,8 +202,8 @@ public class GregTech_API {
if (aIndex < GregTech_API.sBlockList.length && aIndex >= 0) { if (aIndex < GregTech_API.sBlockList.length && aIndex >= 0) {
if (GregTech_API.sBlockList[aIndex] != null) { if (GregTech_API.sBlockList[aIndex] != null) {
return new ItemStack(GregTech_API.sBlockList[aIndex], aAmount, aMeta); return new ItemStack(GregTech_API.sBlockList[aIndex], aAmount, aMeta);
} else GT_Log.err.println("GregTech_API ERROR: This Block Index " + aIndex + " wasn't initialized, you either called it before the Init-Phase (Only Post-Init or later will work), or this Item doesn't exist now"); } else GT_Log.log.error("GregTech_API ERROR: This Block Index " + aIndex + " wasn't initialized, you either called it before the Init-Phase (Only Post-Init or later will work), or this Item doesn't exist now");
} else GT_Log.err.println("GregTech_API ERROR: The Index " + aIndex + " is not part of my Block Range"); } else GT_Log.log.error("GregTech_API ERROR: The Index " + aIndex + " is not part of my Block Range");
return null; return null;
} }
@ -230,8 +235,8 @@ public class GregTech_API {
if (aIndex < GregTech_API.sItemList.length && aIndex >= 0) { if (aIndex < GregTech_API.sItemList.length && aIndex >= 0) {
if (GregTech_API.sItemList[aIndex] != null) { if (GregTech_API.sItemList[aIndex] != null) {
return GT_OreDictUnificator.get(true, new ItemStack(GregTech_API.sItemList[aIndex], aAmount, aMeta)); return GT_OreDictUnificator.get(true, new ItemStack(GregTech_API.sItemList[aIndex], aAmount, aMeta));
} else GT_Log.err.println("GregTech_API ERROR: This Item Index " + aIndex + " wasn't initialized, you either called it before the Init-Phase (Only Post-Init or later will work), or this Item doesn't exist now"); } else GT_Log.log.error("GregTech_API ERROR: This Item Index " + aIndex + " wasn't initialized, you either called it before the Init-Phase (Only Post-Init or later will work), or this Item doesn't exist now");;
} else GT_Log.err.println("GregTech_API ERROR: The Index " + aIndex + " is not part of my Item Range"); } else GT_Log.log.error("GregTech_API ERROR: The Index " + aIndex + " is not part of my Item Range");
return null; return null;
} }
@ -252,7 +257,7 @@ public class GregTech_API {
* @return Either an unificated Stack or the stack you toss in, but it should never be null, unless you throw a Nullpointer into it. * @return Either an unificated Stack or the stack you toss in, but it should never be null, unless you throw a Nullpointer into it.
*/ */
public static ItemStack getUnificatedOreDictStack(ItemStack aOreStack) { public static ItemStack getUnificatedOreDictStack(ItemStack aOreStack) {
if (!GregTech_API.sLoadFinished) GT_Log.err.println("GregTech_API ERROR: " + aOreStack.getItem() + "." + aOreStack.getItemDamage() + " - OreDict Unification Entries are not registered now, please call it in the postload phase."); if (!GregTech_API.sLoadFinished) GT_Log.log.error("GregTech_API ERROR: " + aOreStack.getItem() + "." + aOreStack.getItemDamage() + " - OreDict Unification Entries are not registered now, please call it in the postload phase.");
return GT_OreDictUnificator.get(true, aOreStack); return GT_OreDictUnificator.get(true, aOreStack);
} }
@ -453,7 +458,7 @@ public class GregTech_API {
return new gregtechmod.api.items.GT_Tool_Item(aID, aName, "Doesn't work as intended, this is a Bug", aMaxDamage, 0); return new gregtechmod.api.items.GT_Tool_Item(aID, aName, "Doesn't work as intended, this is a Bug", aMaxDamage, 0);
} }
private static Class sBaseMetaTileEntityClass = null; private static Class<?> sBaseMetaTileEntityClass = null;
/** /**
* This gives you a new BaseMetaTileEntity. As some Interfaces are not always loaded (Buildcraft, Univeral Electricity) I have to use Invocation at the Constructor of the BaseMetaTileEntity * This gives you a new BaseMetaTileEntity. As some Interfaces are not always loaded (Buildcraft, Univeral Electricity) I have to use Invocation at the Constructor of the BaseMetaTileEntity
@ -489,8 +494,8 @@ public class GregTech_API {
try { try {
return (BaseMetaTileEntity)(sBaseMetaTileEntityClass.newInstance()); return (BaseMetaTileEntity)(sBaseMetaTileEntityClass.newInstance());
} catch(Throwable e) { } catch(Throwable e) {
GT_Log.err.println("GT_Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); GT_Log.log.error("GT_Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
e.printStackTrace(GT_Log.err); GT_Log.log.catching(e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@ -500,7 +505,7 @@ public class GregTech_API {
* *
* Best is you make a Runnable with all Cover Registrations, and add it to the Cover Registration ArrayList ontop of this File. * Best is you make a Runnable with all Cover Registrations, and add it to the Cover Registration ArrayList ontop of this File.
*/ */
public static void registerCover(ItemStack aStack, Icon aCover) { public static void registerCover(ItemStack aStack, IIcon aCover) {
int tStack = GT_Utility.stackToInt(aStack); int tStack = GT_Utility.stackToInt(aStack);
if (tStack != 0 && sCovers.get(tStack) == null) sCovers.put(tStack, aCover); if (tStack != 0 && sCovers.get(tStack) == null) sCovers.put(tStack, aCover);
} }
@ -510,16 +515,16 @@ public class GregTech_API {
*/ */
public static void registerCover(ItemStack aStack, String aCover) { public static void registerCover(ItemStack aStack, String aCover) {
if (aCover != null && !aCover.equals("") && sBlockIcons != null) {try { if (aCover != null && !aCover.equals("") && sBlockIcons != null) {try {
registerCover(aStack, ((net.minecraft.client.renderer.texture.IconRegister)sBlockIcons).registerIcon(aCover)); registerCover(aStack, ((IIconRegister) sBlockIcons).registerIcon(aCover));
return; return;
} catch(Throwable e) {}} } catch(Throwable e) {}}
registerCover(aStack, (Icon)null); registerCover(aStack, (IIcon) null);
} }
/** /**
* Registers multiple Cover Items. I use that for the OreDict Functionality. * Registers multiple Cover Items. I use that for the OreDict Functionality.
*/ */
public static void registerCover(Collection<ItemStack> aStackList, Icon aCover) { public static void registerCover(Collection<ItemStack> aStackList, IIcon aCover) {
for (ItemStack tStack : aStackList) { for (ItemStack tStack : aStackList) {
registerCover(tStack, aCover); registerCover(tStack, aCover);
} }

View file

@ -2,7 +2,7 @@ package gregtechmod.api.interfaces;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidHandler;
/** /**
@ -103,5 +103,5 @@ public interface IGregTechTileEntity extends IGearEnergyTileEntity, ICoverable,
public boolean onRightclick(EntityPlayer aPlayer, byte aSide, float par1, float par2, float par3); public boolean onRightclick(EntityPlayer aPlayer, byte aSide, float par1, float par2, float par3);
public int getTextureIndex(byte aSide, byte aMeta); public int getTextureIndex(byte aSide, byte aMeta);
public Icon getTextureIcon(byte aSide, byte aMeta); public IIcon getTextureIcon(byte aSide, byte aMeta);
} }

View file

@ -4,12 +4,12 @@ import gregtechmod.api.util.GT_Config;
import java.util.ArrayList; import java.util.ArrayList;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fluids.IFluidTank;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -275,7 +275,7 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand
* @param aActive if the Machine is currently active (use this instead of calling mBaseMetaTileEntity.mActive!!!) * @param aActive if the Machine is currently active (use this instead of calling mBaseMetaTileEntity.mActive!!!)
* @param aRedstone if the Machine is currently outputting a RedstoneSignal (use this instead of calling mBaseMetaTileEntity.mRedstone!!!) * @param aRedstone if the Machine is currently outputting a RedstoneSignal (use this instead of calling mBaseMetaTileEntity.mRedstone!!!)
*/ */
public Icon getTextureIcon(byte aSide, byte aFacing, boolean aActive, boolean aRedstone); public IIcon getTextureIcon(byte aSide, byte aFacing, boolean aActive, boolean aRedstone);
/** /**
* Register Icons here. This gets called when the Icons get initialized by the Base Block * Register Icons here. This gets called when the Icons get initialized by the Base Block
@ -283,7 +283,7 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand
* @param aBlockIconRegister The Block Icon Register * @param aBlockIconRegister The Block Icon Register
*/ */
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister aBlockIconRegister); public void registerIcons(IIconRegister aBlockIconRegister);
/** /**
* Gets the Output for the comparator on the given Side * Gets the Output for the comparator on the given Side

View file

@ -1,13 +1,15 @@
package gregtechmod.api.util; package gregtechmod.api.util;
import gregtechmod.api.GregTech_API; import gregtechmod.api.GregTech_API;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.common.registry.LanguageRegistry;
public class GT_CreativeTab extends CreativeTabs { public class GT_CreativeTab extends CreativeTabs {
@SuppressWarnings("deprecation")
public GT_CreativeTab() { public GT_CreativeTab() {
super("GregTech"); super("GregTech");
LanguageRegistry.instance().addStringLocalization("itemGroup.GregTech", "GregTech Intergalactical"); LanguageRegistry.instance().addStringLocalization("itemGroup.GregTech", "GregTech Intergalactical");
@ -16,7 +18,12 @@ public class GT_CreativeTab extends CreativeTabs {
@Override @Override
public ItemStack getIconItemStack() { public ItemStack getIconItemStack() {
ItemStack rStack = GregTech_API.getGregTechItem(55, 1, 0); ItemStack rStack = GregTech_API.getGregTechItem(55, 1, 0);
if (rStack == null) rStack = new ItemStack(Block.blockIron, 1); if (rStack == null) rStack = new ItemStack(Blocks.iron_block, 1);
return rStack; return rStack;
} }
@Override
public Item getTabIconItem() {
return null;
}
} }

View file

@ -1,7 +1,8 @@
package gregtechmod.api.util; package gregtechmod.api.util;
import java.io.File; import java.io.File;
import java.io.PrintStream; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/** /**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!! * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@ -9,7 +10,6 @@ import java.io.PrintStream;
* Just a simple Logging Function. If on Server, then this will point to System.out and System.err * Just a simple Logging Function. If on Server, then this will point to System.out and System.err
*/ */
public class GT_Log { public class GT_Log {
public static PrintStream out = System.out; public static Logger log = LogManager.getLogger("GregTech");
public static PrintStream err = System.err;
public static File mLogFile; public static File mLogFile;
} }

View file

@ -706,7 +706,7 @@ public class GT_Utility {
public static int stackToInt(ItemStack aStack) { public static int stackToInt(ItemStack aStack) {
if (aStack == null) return 0; if (aStack == null) return 0;
return aStack.itemID | (aStack.getItemDamage()<<16); return Item.getIdFromItem(aStack.getItem()) | (aStack.getItemDamage() << 16);
} }
public static ItemStack intToStack(int aStack) { public static ItemStack intToStack(int aStack) {

View file

@ -1,16 +0,0 @@
package gregtechmod.common;
public class GT_Bukkit extends GT_Server {
public boolean isServerSide() {
return true;
}
public boolean isClientSide() {
return false;
}
public boolean isBukkitSide() {
return true;
}
}

View file

@ -4,6 +4,7 @@ import java.io.File;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.profiler.Profiler; import net.minecraft.profiler.Profiler;
@ -24,7 +25,7 @@ public class GT_DummyWorld extends World {
public ItemStack mLastSetBlock = null; public ItemStack mLastSetBlock = null;
public GT_DummyWorld(ISaveHandler par1iSaveHandler, String par2Str, WorldProvider par3WorldProvider, WorldSettings par4WorldSettings, Profiler par5Profiler) { public GT_DummyWorld(ISaveHandler par1iSaveHandler, String par2Str, WorldProvider par3WorldProvider, WorldSettings par4WorldSettings, Profiler par5Profiler) {
super(par1iSaveHandler, par2Str, par4WorldSettings, par3WorldProvider, par5Profiler, null); super(par1iSaveHandler, par2Str, par4WorldSettings, par3WorldProvider, par5Profiler);
rand = mRandom; rand = mRandom;
} }
@ -40,6 +41,7 @@ public class GT_DummyWorld extends World {
@Override public void flush() {} @Override public void flush() {}
@Override public void checkSessionLock() throws MinecraftException {} @Override public void checkSessionLock() throws MinecraftException {}
@Override public String getWorldDirectoryName() {return null;} @Override public String getWorldDirectoryName() {return null;}
@Override public File getWorldDirectory() {return null;}
}, },
"DUMMY_DIMENSION", "DUMMY_DIMENSION",
new WorldProvider() { new WorldProvider() {
@ -61,8 +63,8 @@ public class GT_DummyWorld extends World {
} }
@Override @Override
public boolean setBlock(int aX, int aY, int aZ, int aID, int aMeta, int aFlags) { public boolean setBlock(int aX, int aY, int aZ, Block block, int aMeta, int aFlags) {
mLastSetBlock = new ItemStack(aID, 1, aMeta); mLastSetBlock = new ItemStack(block, 1, aMeta);
return true; return true;
} }
@ -78,9 +80,9 @@ public class GT_DummyWorld extends World {
} }
@Override @Override
public int getBlockId(int aX, int aY, int aZ) { public Block getBlock(int aX, int aY, int aZ) {
if (aX >= 16 && aZ >= 16 && aX < 32 && aZ < 32) return aY == 64?Block.grass.blockID:0; if (aX >= 16 && aZ >= 16 && aX < 32 && aZ < 32) return aY == 64 ? Blocks.grass : Blocks.air;
return 0; return Blocks.air;
} }
@Override @Override
@ -93,5 +95,19 @@ public class GT_DummyWorld extends World {
if (aX >= 16 && aZ >= 16 && aX < 32 && aZ < 32) return aY > 64; if (aX >= 16 && aZ >= 16 && aX < 32 && aZ < 32) return aY > 64;
return true; return true;
} }
@Override
protected int func_152379_p() {
/* Looks like, this is neede to get render distance
*
* Next implementation on WorldServer
* protected int func_152379_p()
* {
* return this.mcServer.getConfigurationManager().getViewDistance();
* }
*/
return 0;
}
} }

View file

@ -7,6 +7,7 @@ import gregtechmod.api.interfaces.IGregTechTileEntity;
import gregtechmod.api.interfaces.IMetaTileEntity; import gregtechmod.api.interfaces.IMetaTileEntity;
import gregtechmod.api.metatileentity.BaseMetaPipeEntity; import gregtechmod.api.metatileentity.BaseMetaPipeEntity;
import gregtechmod.api.metatileentity.BaseMetaTileEntity; import gregtechmod.api.metatileentity.BaseMetaTileEntity;
import gregtechmod.api.util.GT_Config;
import gregtechmod.api.util.GT_Log; import gregtechmod.api.util.GT_Log;
import gregtechmod.api.util.GT_Utility; import gregtechmod.api.util.GT_Utility;
import gregtechmod.common.GT_FluidRegistry; import gregtechmod.common.GT_FluidRegistry;
@ -24,44 +25,45 @@ import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemDye; import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugableBlock { public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugableBlock {
public static Icon mIcons[] = new Icon[390]; public static IIcon mIcons[] = new IIcon[390];
public GT_BlockMetaID_Machine(int aID) { public GT_BlockMetaID_Machine(int aID) {
super(aID, new GT_MachineMaterial()); super(new GT_MachineMaterial());
setHardness(10.0F); setHardness(10.0F);
setResistance(10.0F); setResistance(10.0F);
setUnlocalizedName("BlockMetaID_Machine"); setBlockName("BlockMetaID_Machine");
setStepSound(Block.soundMetalFootstep); setStepSound(Block.soundTypeMetal);
setCreativeTab(GregTech_API.TAB_GREGTECH); setCreativeTab(GregTech_API.TAB_GREGTECH);
for (int i = 0; i < 16; i++) MinecraftForge.setBlockHarvestLevel(this, i, "wrench", 1); for (int i = 0; i < 16; i++) setHarvestLevel("wrench", 1, i); // MinecraftForge.setBlockHarvestLevel(this, i, "wrench", 1);
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister aIconRegister) { public void registerBlockIcons(IIconRegister aIconRegister) {
GregTech_API.FAIL_ICON = aIconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + (GregTech_API.sConfiguration.system?"troll":getUnlocalizedName() + "/failed")); GregTech_API.FAIL_ICON = aIconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + (GT_Config.system ? "troll" : getUnlocalizedName() + "/failed"));
mIcons[ 0] = aIconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + getUnlocalizedName() + "/adv_machine"); mIcons[ 0] = aIconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + getUnlocalizedName() + "/adv_machine");
mIcons[ 2] = aIconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + getUnlocalizedName() + "/adv_machine_logo"); mIcons[ 2] = aIconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + getUnlocalizedName() + "/adv_machine_logo");
@ -353,10 +355,10 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
mIcons[ 9] = mIcons[ 0]; mIcons[ 9] = mIcons[ 0];
mIcons[ 10] = Block.planks.getIcon(0, 0); // wood mIcons[ 10] = Blocks.planks.getIcon(0, 0); // wood
mIcons[ 208] = aIconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + getUnlocalizedName() + "/wood_shelf"); mIcons[ 208] = aIconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + getUnlocalizedName() + "/wood_shelf");
mIcons[ 209] = aIconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + getUnlocalizedName() + "/wood_shelf_paper"); mIcons[ 209] = aIconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + getUnlocalizedName() + "/wood_shelf_paper");
mIcons[ 210] = Block.bookShelf.getIcon(2, 0); // wood_shelf_books mIcons[ 210] = Blocks.bookshelf.getIcon(2, 0); // wood_shelf_books
mIcons[ 211] = aIconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + getUnlocalizedName() + "/wood_shelf_cans"); mIcons[ 211] = aIconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + getUnlocalizedName() + "/wood_shelf_cans");
mIcons[ 35] = aIconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + getUnlocalizedName() + "/audio_out_active"); mIcons[ 35] = aIconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + getUnlocalizedName() + "/audio_out_active");
@ -521,11 +523,11 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
} }
@Override @Override
public Icon getBlockTexture(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) { public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) {
byte tMeta = (byte)aIBlockAccess.getBlockMetadata(aX, aY, aZ); byte tMeta = (byte)aIBlockAccess.getBlockMetadata(aX, aY, aZ);
TileEntity tTileEntity = aIBlockAccess.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aIBlockAccess.getTileEntity(aX, aY, aZ);
Icon rIcon = null; IIcon rIcon = null;
int tIndex = -1; int tIndex = -1;
if (tTileEntity == null) { if (tTileEntity == null) {
@ -551,15 +553,15 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
} }
} }
if (GregTech_API.sConfiguration.system || rIcon == null) rIcon = GregTech_API.FAIL_ICON; if (GT_Config.system || rIcon == null) rIcon = GregTech_API.FAIL_ICON;
return rIcon; return rIcon;
} }
@Override @Override
public Icon getIcon(int aSide, int aMeta) { public IIcon getIcon(int aSide, int aMeta) {
if (aMeta < 0 || aMeta >= GregTech_API.MAXIMUM_METATILE_IDS) return GregTech_API.FAIL_ICON; if (aMeta < 0 || aMeta >= GregTech_API.MAXIMUM_METATILE_IDS) return GregTech_API.FAIL_ICON;
Icon rIcon = null; IIcon rIcon = null;
int tIndex = -1; int tIndex = -1;
try { try {
@ -574,13 +576,13 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
} }
if (rIcon == null && tIndex >= 0 && tIndex < mIcons.length) rIcon = mIcons[tIndex]; if (rIcon == null && tIndex >= 0 && tIndex < mIcons.length) rIcon = mIcons[tIndex];
if (GregTech_API.sConfiguration.system || rIcon == null) rIcon = GregTech_API.FAIL_ICON; if (GT_Config.system || rIcon == null) rIcon = GregTech_API.FAIL_ICON;
return rIcon; return rIcon;
} }
@Override @Override
public float getBlockHardness(World aWorld, int aX, int aY, int aZ) { public float getBlockHardness(World aWorld, int aX, int aY, int aZ) {
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof BaseMetaTileEntity) { if (tTileEntity instanceof BaseMetaTileEntity) {
if (((BaseMetaTileEntity)tTileEntity).privateAccess()) return -1; if (((BaseMetaTileEntity)tTileEntity).privateAccess()) return -1;
if (((BaseMetaTileEntity)tTileEntity).unbreakable()) return -1; if (((BaseMetaTileEntity)tTileEntity).unbreakable()) return -1;
@ -593,7 +595,7 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
@Override @Override
public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) { public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) {
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity instanceof BaseMetaTileEntity) { if (tTileEntity instanceof BaseMetaTileEntity) {
if (((BaseMetaTileEntity)tTileEntity).privateAccess()) return -1; if (((BaseMetaTileEntity)tTileEntity).privateAccess()) return -1;
if (((BaseMetaTileEntity)tTileEntity).unbreakable()) return -1; if (((BaseMetaTileEntity)tTileEntity).unbreakable()) return -1;
@ -606,7 +608,7 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
@Override @Override
public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, float par1, float par2, float par3) { public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, float par1, float par2, float par3) {
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity == null || aPlayer.isSneaking()) return false; if (tTileEntity == null || aPlayer.isSneaking()) return false;
@ -633,7 +635,7 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
@Override @Override
public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) {
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity != null) { if (tTileEntity != null) {
if (tTileEntity instanceof IGregTechTileEntity) { if (tTileEntity instanceof IGregTechTileEntity) {
((IGregTechTileEntity)tTileEntity).onLeftclick(aPlayer); ((IGregTechTileEntity)tTileEntity).onLeftclick(aPlayer);
@ -643,7 +645,7 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
@Override @Override
public int getDamageValue(World aWorld, int aX, int aY, int aZ) { public int getDamageValue(World aWorld, int aX, int aY, int aZ) {
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity != null && tTileEntity instanceof IGregTechTileEntity) { if (tTileEntity != null && tTileEntity instanceof IGregTechTileEntity) {
return ((IGregTechTileEntity)tTileEntity).getMetaTileID(); return ((IGregTechTileEntity)tTileEntity).getMetaTileID();
@ -653,11 +655,11 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
} }
@Override @Override
public ArrayList<ItemStack> getBlockDropped(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) { public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) {
ArrayList<ItemStack> ret = new ArrayList<ItemStack>(); ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(GT_MetaItem_Component.instance.getStack(22, 1)); ret.add(GT_MetaItem_Component.instance.getStack(22, 1));
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity == null) return ret; if (tTileEntity == null) return ret;
@ -665,7 +667,7 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
} }
@Override @Override
public void breakBlock(World aWorld, int aX, int aY, int aZ, int par5, int par6) { public void breakBlock(World aWorld, int aX, int aY, int aZ, Block par5, int par6) {
dropItems(aWorld, aX, aY, aZ); dropItems(aWorld, aX, aY, aZ);
GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
super.breakBlock(aWorld, aX, aY, aZ, par5, par6); super.breakBlock(aWorld, aX, aY, aZ, par5, par6);
@ -674,7 +676,7 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
private void dropItems(World aWorld, int aX, int aY, int aZ){ private void dropItems(World aWorld, int aX, int aY, int aZ){
Random rand = new Random(); Random rand = new Random();
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity == null) return; if (tTileEntity == null) return;
@ -713,7 +715,7 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
@Override @Override
public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) { public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) {
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity != null && tTileEntity instanceof IGregTechTileEntity) return ((IGregTechTileEntity)tTileEntity).getComparatorValue((byte)aSide); if (tTileEntity != null && tTileEntity instanceof IGregTechTileEntity) return ((IGregTechTileEntity)tTileEntity).getComparatorValue((byte)aSide);
return 0; return 0;
} }
@ -722,7 +724,7 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
public int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { public int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
if (aSide < 0 || aSide > 5) return 0; if (aSide < 0 || aSide > 5) return 0;
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity != null && tTileEntity instanceof IGregTechTileEntity) return ((IGregTechTileEntity)tTileEntity).getOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)); if (tTileEntity != null && tTileEntity instanceof IGregTechTileEntity) return ((IGregTechTileEntity)tTileEntity).getOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide));
@ -733,7 +735,7 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
if (aSide < 0 || aSide > 5) return 0; if (aSide < 0 || aSide > 5) return 0;
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity != null && tTileEntity instanceof IGregTechTileEntity) return ((IGregTechTileEntity)tTileEntity).getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)); if (tTileEntity != null && tTileEntity instanceof IGregTechTileEntity) return ((IGregTechTileEntity)tTileEntity).getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide));
@ -741,8 +743,8 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
} }
@Override @Override
public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z) { public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
TileEntity tTileEntity = world.getBlockTileEntity(x, y, z); TileEntity tTileEntity = world.getTileEntity(x, y, z);
if (GregTech_API.sMachineNonWrenchExplosions && tTileEntity != null && (player == null || !player.capabilities.isCreativeMode)) if (GregTech_API.sMachineNonWrenchExplosions && tTileEntity != null && (player == null || !player.capabilities.isCreativeMode))
if (tTileEntity instanceof GT_TileEntityMetaID_Machine) if (tTileEntity instanceof GT_TileEntityMetaID_Machine)
@ -751,13 +753,13 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
if (tTileEntity instanceof BaseMetaTileEntity) if (tTileEntity instanceof BaseMetaTileEntity)
((BaseMetaTileEntity)tTileEntity).doEnergyExplosion(); ((BaseMetaTileEntity)tTileEntity).doEnergyExplosion();
return world.setBlock(x, y, z, 0, 0, 3); return world.setBlock(x, y, z, Blocks.air, 0, 3);
} }
@Override @Override
public void dropBlockAsItemWithChance(World aWorld, int aX, int aY, int aZ, int par5, float chance, int par7) { public void dropBlockAsItemWithChance(World aWorld, int aX, int aY, int aZ, int par5, float chance, int par7) {
if (!aWorld.isRemote && GregTech_API.sMachineNonWrenchExplosions) { if (!aWorld.isRemote && GregTech_API.sMachineNonWrenchExplosions) {
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity != null && chance < 1.0F) { if (tTileEntity != null && chance < 1.0F) {
if (tTileEntity instanceof GT_TileEntityMetaID_Machine) if (tTileEntity instanceof GT_TileEntityMetaID_Machine)
@ -786,34 +788,36 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
return false; return false;
} }
@SideOnly(Side.CLIENT)
@Override @Override
public float getBlockBrightness(IBlockAccess aWorld, int aX, int aY, int aZ) { public int getMixedBrightnessForBlock(IBlockAccess aWorld, int aX, int aY, int aZ) {
return 0; return 0;
} }
@Override @Override
public boolean isBlockSolidOnSide(World aWorld, int aX, int aY, int aZ, ForgeDirection aSide) { public boolean isBlockSolid(IBlockAccess aWorld, int aX, int aY, int aZ, int side) {
ForgeDirection aSide = ForgeDirection.getOrientation(side);
if (aWorld.getBlockMetadata(aX, aY, aZ) == 0) return true; if (aWorld.getBlockMetadata(aX, aY, aZ) == 0) return true;
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity != null && tTileEntity instanceof ICoverable) return ((ICoverable)tTileEntity).getCoverIDAtSide((byte)aSide.ordinal()) != 0; if (tTileEntity != null && tTileEntity instanceof ICoverable) return ((ICoverable)tTileEntity).getCoverIDAtSide((byte)aSide.ordinal()) != 0;
return false; return false;
} }
@Override @Override
public boolean isBlockNormalCube(World aWorld, int aX, int aY, int aZ) { public boolean isBlockNormalCube() {
return false; return false;
} }
@Override @Override
public int getLightOpacity(World aWorld, int aX, int aY, int aZ) { public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) {
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity != null && tTileEntity instanceof BaseMetaTileEntity) return ((BaseMetaTileEntity)tTileEntity).getLightValue() == 0 ? 255 : 0; if (tTileEntity != null && tTileEntity instanceof BaseMetaTileEntity) return ((BaseMetaTileEntity)tTileEntity).getLightValue() == 0 ? 255 : 0;
return aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 255 : 0; return aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 255 : 0;
} }
@Override @Override
public int getLightValue(IBlockAccess aWorld, int aX, int aY, int aZ) { public int getLightValue(IBlockAccess aWorld, int aX, int aY, int aZ) {
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity != null && tTileEntity instanceof BaseMetaTileEntity) return ((BaseMetaTileEntity)tTileEntity).getLightValue(); if (tTileEntity != null && tTileEntity instanceof BaseMetaTileEntity) return ((BaseMetaTileEntity)tTileEntity).getLightValue();
return 0; return 0;
} }
@ -830,12 +834,12 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
} }
@Override @Override
public boolean canBeReplacedByLeaves(World aWorld, int aX, int aY, int aZ) { public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) {
return false; return false;
} }
@Override @Override
public TileEntity createNewTileEntity(World aWorld) { public TileEntity createNewTileEntity(World aWorld, int meta) { // TODO: there wasnt meta before
return GregTech_API.constructBaseMetaTileEntity(); return GregTech_API.constructBaseMetaTileEntity();
} }
@ -859,24 +863,26 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
return 30.0F; return 30.0F;
} }
@Override @SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) { @SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List par3List) {
for (int i = 4; i < GregTech_API.mMetaTileList.length; ++i) for (int i = 4; i < GregTech_API.mMetaTileList.length; ++i)
if (i < 16 && createTileEntity(null, i) != null) if (i < 16 && createTileEntity(null, i) != null)
par3List.add(new ItemStack(par1, 1, i)); par3List.add(new ItemStack(item, 1, i));
else else
if (i > 15 && GregTech_API.mMetaTileList[i] != null) if (i > 15 && GregTech_API.mMetaTileList[i] != null)
par3List.add(new ItemStack(par1, 1, i)); par3List.add(new ItemStack(item, 1, i));
} }
@Override @Override
public boolean canCreatureSpawn(EnumCreatureType type, World aWorld, int aX, int aY, int aZ) { public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess aWorld, int aX, int aY, int aZ) {
return false; return false;
} }
@Override @Override
public void onBlockPlacedBy(World aWorld, int aX, int aY, int aZ, EntityLivingBase aPlayer, ItemStack aStack) { public void onBlockPlacedBy(World aWorld, int aX, int aY, int aZ, EntityLivingBase aPlayer, ItemStack aStack) {
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity == null) return; if (tTileEntity == null) return;
@ -905,14 +911,14 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
@Override @Override
public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { public void onBlockAdded(World aWorld, int aX, int aY, int aZ) {
if (GregTech_API.isMachineBlock(blockID, aWorld.getBlockMetadata(aX, aY, aZ))) { if (GregTech_API.isMachineBlock(getIdFromBlock(this), aWorld.getBlockMetadata(aX, aY, aZ))) {
GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
} }
} }
@Override @Override
public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel) { public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel) {
TileEntity tTileEntity = aPlayer.worldObj.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aPlayer.worldObj.getTileEntity(aX, aY, aZ);
if (tTileEntity == null) return null; if (tTileEntity == null) return null;
if (tTileEntity instanceof GT_TileEntityMetaID_Machine) { if (tTileEntity instanceof GT_TileEntityMetaID_Machine) {
@ -929,18 +935,18 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
@Override @Override
public int colorMultiplier(IBlockAccess aWorld, int aX, int aY, int aZ) { public int colorMultiplier(IBlockAccess aWorld, int aX, int aY, int aZ) {
if (aWorld == null) return super.colorMultiplier(aWorld, aX, aY, aZ); if (aWorld == null) return super.colorMultiplier(aWorld, aX, aY, aZ);
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity == null) return super.colorMultiplier(aWorld, aX, aY, aZ); if (tTileEntity == null) return super.colorMultiplier(aWorld, aX, aY, aZ);
if (tTileEntity instanceof IGregTechTileEntity) { if (tTileEntity instanceof IGregTechTileEntity) {
byte tColor = ((IGregTechTileEntity)tTileEntity).getColorization(); byte tColor = ((IGregTechTileEntity)tTileEntity).getColorization();
if (tColor >= 0 && tColor < ItemDye.dyeColors.length) return ItemDye.dyeColors[tColor]; if (tColor >= 0 && tColor < ItemDye.field_150922_c.length) return ItemDye.field_150922_c[tColor];
} }
return 16777215; return 16777215;
} }
@Override @Override
public boolean recolourBlock(World aWorld, int aX, int aY, int aZ, ForgeDirection aSide, int aColor) { public boolean recolourBlock(World aWorld, int aX, int aY, int aZ, ForgeDirection aSide, int aColor) {
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity == null) return false; if (tTileEntity == null) return false;
if (tTileEntity instanceof IGregTechTileEntity) { if (tTileEntity instanceof IGregTechTileEntity) {
if (((IGregTechTileEntity)tTileEntity).getColorization() != ((~aColor)&15)) { if (((IGregTechTileEntity)tTileEntity).getColorization() != ((~aColor)&15)) {
@ -952,22 +958,22 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
} }
@Override @Override
public int getFlammability(IBlockAccess aWorld, int aX, int aY, int aZ, int metadata, ForgeDirection face) { public int getFlammability(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
return 0; return 0;
} }
@Override @Override
public boolean isFlammable(IBlockAccess aWorld, int aX, int aY, int aZ, int metadata, ForgeDirection face) { public boolean isFlammable(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0; return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0;
} }
@Override @Override
public int getFireSpreadSpeed(World aWorld, int aX, int aY, int aZ, int metadata, ForgeDirection face) { public int getFireSpreadSpeed(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0?100:0; return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 100 : 0;
} }
@Override @Override
public boolean isFireSource(World aWorld, int aX, int aY, int aZ, int metadata, ForgeDirection side) { public boolean isFireSource(World aWorld, int aX, int aY, int aZ, ForgeDirection side) {
return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0; return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0;
} }
} }