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
*/
@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)
public class GT_Mod implements IGT_Mod, IGT_RecipeAdder {
@Instance
@ -184,10 +184,10 @@ public class GT_Mod implements IGT_Mod, IGT_RecipeAdder {
public GT_Mod() {
// 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.");
// GregTech_API.gregtechmod = this;
// GregTech_API.sRecipeAdder = this;
// GregTech_API.sDummyWorld = new GT_DummyWorld();
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.sRecipeAdder = this;
GregTech_API.sDummyWorld = new GT_DummyWorld();
// GregTech_API.sGTCoverload.add(new GT_CoverLoader());
// GT_OreDictHandler.instance.registerHandler();
// new GT_Cover_None();

View file

@ -22,12 +22,15 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.IIcon;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.World;
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;
/** Icon which represents failed rendering */
public static Icon FAIL_ICON = null;
@SideOnly(Side.CLIENT)
public static IIcon FAIL_ICON = null;
/** My Creative Tab */
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;
/** 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 */
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 (GregTech_API.sBlockList[aIndex] != null) {
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.err.println("GregTech_API ERROR: The Index " + aIndex + " is not part of my Block Range");
} 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.log.error("GregTech_API ERROR: The Index " + aIndex + " is not part of my Block Range");
return null;
}
@ -230,8 +235,8 @@ public class GregTech_API {
if (aIndex < GregTech_API.sItemList.length && aIndex >= 0) {
if (GregTech_API.sItemList[aIndex] != null) {
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.err.println("GregTech_API ERROR: The Index " + aIndex + " is not part of my Item Range");
} 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.log.error("GregTech_API ERROR: The Index " + aIndex + " is not part of my Item Range");
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.
*/
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);
}
@ -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);
}
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
@ -489,8 +494,8 @@ public class GregTech_API {
try {
return (BaseMetaTileEntity)(sBaseMetaTileEntityClass.newInstance());
} catch(Throwable e) {
GT_Log.err.println("GT_Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
e.printStackTrace(GT_Log.err);
GT_Log.log.error("GT_Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
GT_Log.log.catching(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.
*/
public static void registerCover(ItemStack aStack, Icon aCover) {
public static void registerCover(ItemStack aStack, IIcon aCover) {
int tStack = GT_Utility.stackToInt(aStack);
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) {
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;
} catch(Throwable e) {}}
registerCover(aStack, (Icon)null);
registerCover(aStack, (IIcon) null);
}
/**
* 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) {
registerCover(tStack, aCover);
}

View file

@ -2,7 +2,7 @@ package gregtechmod.api.interfaces;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Icon;
import net.minecraft.util.IIcon;
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 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 net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Icon;
import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.IFluidTank;
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 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
@ -283,7 +283,7 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand
* @param aBlockIconRegister The Block Icon Register
*/
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister aBlockIconRegister);
public void registerIcons(IIconRegister aBlockIconRegister);
/**
* Gets the Output for the comparator on the given Side

View file

@ -1,13 +1,15 @@
package gregtechmod.api.util;
import gregtechmod.api.GregTech_API;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.registry.LanguageRegistry;
public class GT_CreativeTab extends CreativeTabs {
@SuppressWarnings("deprecation")
public GT_CreativeTab() {
super("GregTech");
LanguageRegistry.instance().addStringLocalization("itemGroup.GregTech", "GregTech Intergalactical");
@ -16,7 +18,12 @@ public class GT_CreativeTab extends CreativeTabs {
@Override
public ItemStack getIconItemStack() {
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;
}
@Override
public Item getTabIconItem() {
return null;
}
}

View file

@ -1,7 +1,8 @@
package gregtechmod.api.util;
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!!!
@ -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
*/
public class GT_Log {
public static PrintStream out = System.out;
public static PrintStream err = System.err;
public static Logger log = LogManager.getLogger("GregTech");
public static File mLogFile;
}

View file

@ -706,7 +706,7 @@ public class GT_Utility {
public static int stackToInt(ItemStack aStack) {
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) {

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.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.profiler.Profiler;
@ -24,7 +25,7 @@ public class GT_DummyWorld extends World {
public ItemStack mLastSetBlock = null;
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;
}
@ -40,6 +41,7 @@ public class GT_DummyWorld extends World {
@Override public void flush() {}
@Override public void checkSessionLock() throws MinecraftException {}
@Override public String getWorldDirectoryName() {return null;}
@Override public File getWorldDirectory() {return null;}
},
"DUMMY_DIMENSION",
new WorldProvider() {
@ -61,8 +63,8 @@ public class GT_DummyWorld extends World {
}
@Override
public boolean setBlock(int aX, int aY, int aZ, int aID, int aMeta, int aFlags) {
mLastSetBlock = new ItemStack(aID, 1, aMeta);
public boolean setBlock(int aX, int aY, int aZ, Block block, int aMeta, int aFlags) {
mLastSetBlock = new ItemStack(block, 1, aMeta);
return true;
}
@ -78,9 +80,9 @@ public class GT_DummyWorld extends World {
}
@Override
public int getBlockId(int aX, int aY, int aZ) {
if (aX >= 16 && aZ >= 16 && aX < 32 && aZ < 32) return aY == 64?Block.grass.blockID:0;
return 0;
public Block getBlock(int aX, int aY, int aZ) {
if (aX >= 16 && aZ >= 16 && aX < 32 && aZ < 32) return aY == 64 ? Blocks.grass : Blocks.air;
return Blocks.air;
}
@Override
@ -93,5 +95,19 @@ public class GT_DummyWorld extends World {
if (aX >= 16 && aZ >= 16 && aX < 32 && aZ < 32) return aY > 64;
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.metatileentity.BaseMetaPipeEntity;
import gregtechmod.api.metatileentity.BaseMetaTileEntity;
import gregtechmod.api.util.GT_Config;
import gregtechmod.api.util.GT_Log;
import gregtechmod.api.util.GT_Utility;
import gregtechmod.common.GT_FluidRegistry;
@ -24,44 +25,45 @@ import java.util.Random;
import net.minecraft.block.Block;
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.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.item.EntityItem;
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.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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) {
super(aID, new GT_MachineMaterial());
super(new GT_MachineMaterial());
setHardness(10.0F);
setResistance(10.0F);
setUnlocalizedName("BlockMetaID_Machine");
setStepSound(Block.soundMetalFootstep);
setBlockName("BlockMetaID_Machine");
setStepSound(Block.soundTypeMetal);
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
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister aIconRegister) {
GregTech_API.FAIL_ICON = aIconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + (GregTech_API.sConfiguration.system?"troll":getUnlocalizedName() + "/failed"));
public void registerBlockIcons(IIconRegister aIconRegister) {
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[ 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[ 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[ 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[ 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
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);
TileEntity tTileEntity = aIBlockAccess.getBlockTileEntity(aX, aY, aZ);
TileEntity tTileEntity = aIBlockAccess.getTileEntity(aX, aY, aZ);
Icon rIcon = null;
IIcon rIcon = null;
int tIndex = -1;
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;
}
@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;
Icon rIcon = null;
IIcon rIcon = null;
int tIndex = -1;
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 (GregTech_API.sConfiguration.system || rIcon == null) rIcon = GregTech_API.FAIL_ICON;
if (GT_Config.system || rIcon == null) rIcon = GregTech_API.FAIL_ICON;
return rIcon;
}
@Override
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 (((BaseMetaTileEntity)tTileEntity).privateAccess()) return -1;
if (((BaseMetaTileEntity)tTileEntity).unbreakable()) return -1;
@ -593,7 +595,7 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
@Override
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 (((BaseMetaTileEntity)tTileEntity).privateAccess()) return -1;
if (((BaseMetaTileEntity)tTileEntity).unbreakable()) return -1;
@ -606,7 +608,7 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
@Override
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;
@ -633,7 +635,7 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
@Override
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 instanceof IGregTechTileEntity) {
((IGregTechTileEntity)tTileEntity).onLeftclick(aPlayer);
@ -643,7 +645,7 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
@Override
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) {
return ((IGregTechTileEntity)tTileEntity).getMetaTileID();
@ -653,11 +655,11 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
}
@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>();
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;
@ -665,7 +667,7 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
}
@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);
GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
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){
Random rand = new Random();
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ);
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity == null) return;
@ -713,7 +715,7 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
@Override
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);
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) {
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));
@ -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) {
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));
@ -741,8 +743,8 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
}
@Override
public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z) {
TileEntity tTileEntity = world.getBlockTileEntity(x, y, z);
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
TileEntity tTileEntity = world.getTileEntity(x, y, z);
if (GregTech_API.sMachineNonWrenchExplosions && tTileEntity != null && (player == null || !player.capabilities.isCreativeMode))
if (tTileEntity instanceof GT_TileEntityMetaID_Machine)
@ -751,13 +753,13 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
if (tTileEntity instanceof BaseMetaTileEntity)
((BaseMetaTileEntity)tTileEntity).doEnergyExplosion();
return world.setBlock(x, y, z, 0, 0, 3);
return world.setBlock(x, y, z, Blocks.air, 0, 3);
}
@Override
public void dropBlockAsItemWithChance(World aWorld, int aX, int aY, int aZ, int par5, float chance, int par7) {
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 instanceof GT_TileEntityMetaID_Machine)
@ -786,34 +788,36 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
return false;
}
@SideOnly(Side.CLIENT)
@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;
}
@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;
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;
return false;
}
@Override
public boolean isBlockNormalCube(World aWorld, int aX, int aY, int aZ) {
public boolean isBlockNormalCube() {
return false;
}
@Override
public int getLightOpacity(World aWorld, int aX, int aY, int aZ) {
TileEntity tTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ);
public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity != null && tTileEntity instanceof BaseMetaTileEntity) return ((BaseMetaTileEntity)tTileEntity).getLightValue() == 0 ? 255 : 0;
return aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 255 : 0;
}
@Override
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();
return 0;
}
@ -830,12 +834,12 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
}
@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;
}
@Override
public TileEntity createNewTileEntity(World aWorld) {
public TileEntity createNewTileEntity(World aWorld, int meta) { // TODO: there wasnt meta before
return GregTech_API.constructBaseMetaTileEntity();
}
@ -859,24 +863,26 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
return 30.0F;
}
@Override @SideOnly(Side.CLIENT)
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) {
@SideOnly(Side.CLIENT)
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List par3List) {
for (int i = 4; i < GregTech_API.mMetaTileList.length; ++i)
if (i < 16 && createTileEntity(null, i) != null)
par3List.add(new ItemStack(par1, 1, i));
par3List.add(new ItemStack(item, 1, i));
else
if (i > 15 && GregTech_API.mMetaTileList[i] != null)
par3List.add(new ItemStack(par1, 1, i));
par3List.add(new ItemStack(item, 1, i));
}
@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;
}
@Override
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;
@ -905,14 +911,14 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
@Override
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);
}
}
@Override
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 instanceof GT_TileEntityMetaID_Machine) {
@ -929,18 +935,18 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
@Override
public int colorMultiplier(IBlockAccess aWorld, int aX, int aY, int 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 instanceof IGregTechTileEntity) {
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;
}
@Override
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 instanceof IGregTechTileEntity) {
if (((IGregTechTileEntity)tTileEntity).getColorization() != ((~aColor)&15)) {
@ -952,22 +958,22 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
}
@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;
}
@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;
}
@Override
public int getFireSpreadSpeed(World aWorld, int aX, int aY, int aZ, int metadata, ForgeDirection face) {
return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0?100:0;
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;
}
@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;
}
}