diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-10-04 19:27:05 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-10-04 19:27:05 +1000 |
commit | d4951adbcc18d93c8c79449ee210564a6b91b6d2 (patch) | |
tree | 765da4cd0ff2adfaa8dc9070d1d65fbb66b8d2e8 /src | |
parent | bdb6fc4a5410d68cf517dbe90fa49cec45bbda5a (diff) | |
download | GT5-Unofficial-d4951adbcc18d93c8c79449ee210564a6b91b6d2.tar.gz GT5-Unofficial-d4951adbcc18d93c8c79449ee210564a6b91b6d2.tar.bz2 GT5-Unofficial-d4951adbcc18d93c8c79449ee210564a6b91b6d2.zip |
+ Added a few missing classes from my last merge.
Diffstat (limited to 'src')
7 files changed, 840 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java b/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java new file mode 100644 index 0000000000..5674082c4a --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java @@ -0,0 +1,30 @@ +package gtPlusPlus.core.util.fluid; + +import gregtech.api.GregTech_API; +import gtPlusPlus.core.lib.CORE; +import net.minecraftforge.fluids.Fluid; + +public class FluidGT6 extends Fluid implements Runnable +{ + private final short[] mRGBa; + public final String mTextureName; + + public FluidGT6(final String aName, final String aTextureName, final short[] aRGBa) { + super(aName); + this.mRGBa = aRGBa; + this.mTextureName = aTextureName; + if (GregTech_API.sGTBlockIconload != null) { + GregTech_API.sGTBlockIconload.add(this); + } + } + + @Override + public int getColor() { + return Math.max(0, Math.min(255, this.mRGBa[0])) << 16 | Math.max(0, Math.min(255, this.mRGBa[1])) << 8 | Math.max(0, Math.min(255, this.mRGBa[2])); + } + + @Override + public void run() { + this.setIcons(GregTech_API.sBlockIcons.registerIcon(CORE.MODID+ ":" + "fluids/fluid." + mTextureName)); + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechBlockMachines.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechBlockMachines.java new file mode 100644 index 0000000000..9c6a780952 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechBlockMachines.java @@ -0,0 +1,561 @@ +package gtPlusPlus.xmod.gregtech.common.blocks; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.IDebugableBlock; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.items.GT_Generic_Block; +import gregtech.api.metatileentity.BaseMetaPipeEntity; +import gregtech.api.metatileentity.BaseMetaTileEntity; +import gregtech.api.metatileentity.BaseTileEntity; +import gregtech.api.util.GT_BaseCrop; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_Utility; +import gregtech.common.blocks.GT_Item_Machines; +import gregtech.common.blocks.GT_Material_Machines; +import gregtech.common.render.GT_Renderer_Block; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.ITileEntityProvider; +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.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.util.StatCollector; +import net.minecraft.world.Explosion; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class GregtechBlockMachines + extends GT_Generic_Block + implements IDebugableBlock, ITileEntityProvider { + public static ThreadLocal<IGregTechTileEntity> mTemporaryTileEntity = new ThreadLocal<IGregTechTileEntity>(); + + public GregtechBlockMachines() { + super(GT_Item_Machines.class, "gt.plusplus.blockmachines", new GT_Material_Machines()); + GregTech_API.registerMachineBlock(this, -1); + setHardness(1.0F); + setResistance(10.0F); + setStepSound(soundTypeMetal); + setCreativeTab(AddToCreativeTab.tabMachines); + this.isBlockContainer = true; + } + + @Override + public String getHarvestTool(int aMeta) { + switch (aMeta / 4) { + case 0: + return "wrench"; + case 1: + return "wrench"; + case 2: + return "cutter"; + case 3: + return "axe"; + default: + break; + } + return "wrench"; + } + + @Override + public int getHarvestLevel(int aMeta) { + return aMeta % 4; + } + + @Override + protected boolean canSilkHarvest() { + return false; + } + + @Override + public void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int aTileX, int aTileY, int aTileZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if ((tTileEntity instanceof BaseTileEntity)) { + ((BaseTileEntity) tTileEntity).onAdjacentBlockChange(aTileX, aTileY, aTileZ); + } + } + + @Override + public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { + super.onBlockAdded(aWorld, aX, aY, aZ); + if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) { + GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); + } + } + + @Override + public String getUnlocalizedName() { + return "gt.blockmachines"; + } + + @Override + public String getLocalizedName() { + return StatCollector.translateToLocal(getUnlocalizedName() + ".name"); + } + + @Override + public int getFlammability(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) { + return 0; + } + + @Override + 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 int getRenderType() { + if (GT_Renderer_Block.INSTANCE == null) { + return super.getRenderType(); + } + return GT_Renderer_Block.INSTANCE.mRenderID; + } + + @Override + public boolean isFireSource(World aWorld, int aX, int aY, int aZ, ForgeDirection side) { + return (GregTech_API.sMachineFlammable) && (aWorld.getBlockMetadata(aX, aY, aZ) == 0); + } + + @Override + 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 boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess aWorld, int aX, int aY, int aZ) { + return false; + } + + @Override + public boolean canConnectRedstone(IBlockAccess var1, int var2, int var3, int var4, int var5) { + return true; + } + + @Override + public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) { + return false; + } + + @Override + public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) { + return false; + } + + @Override + public boolean hasTileEntity(int aMeta) { + return true; + } + + @Override + public boolean hasComparatorInputOverride() { + return true; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public boolean canProvidePower() { + return true; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public TileEntity createNewTileEntity(World aWorld, int aMeta) { + return createTileEntity(aWorld, aMeta); + } + + @Override + public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) { + return Textures.BlockIcons.MACHINE_LV_SIDE.getIcon(); + } + + @Override + public IIcon getIcon(int aSide, int aMeta) { + return Textures.BlockIcons.MACHINE_LV_SIDE.getIcon(); + } + + @Override + public boolean onBlockEventReceived(World aWorld, int aX, int aY, int aZ, int aData1, int aData2) { + super.onBlockEventReceived(aWorld, aX, aY, aZ, aData1, aData2); + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity != null ? tTileEntity.receiveClientEvent(aData1, aData2) : false; + } + + @Override + public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List outputAABB, Entity collider) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) { + ((IGregTechTileEntity) tTileEntity).addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); + return; + } + super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) { + return ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + } + return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + } + + @Override + public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) { + ((IGregTechTileEntity) tTileEntity).onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); + return; + } + super.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister aIconRegister) { + //if (GregTech_API.sPostloadFinished) { + Utils.LOG_INFO("Setting up Icon Register for Blocks"); + GregTech_API.sBlockIcons = aIconRegister; + + Utils.LOG_INFO("Registering MetaTileEntity specific Textures"); + for (IMetaTileEntity tMetaTileEntity : Meta_GT_Proxy.METATILEENTITIES) { + try { + if (tMetaTileEntity != null) { + tMetaTileEntity.registerIcons(aIconRegister); + } + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); + } + } + Utils.LOG_INFO("Registering Crop specific Textures"); + try { + for (GT_BaseCrop tCrop : GT_BaseCrop.sCropList) { + tCrop.registerSprites(aIconRegister); + } + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); + } + Utils.LOG_INFO("Starting Block Icon Load Phase"); + System.out.println("Starting Block Icon Load Phase"); + for (Runnable tRunnable : GregTech_API.sGTBlockIconload) { + try { + tRunnable.run(); + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); + } + } + Utils.LOG_INFO("Finished Block Icon Load Phase"); + System.out.println("Finished Block Icon Load Phase"); + // } + } + + @Override + public float getBlockHardness(World aWorld, int aX, int aY, int aZ) { + return super.getBlockHardness(aWorld, aX, aY, aZ); + } + + @Override + public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (((tTileEntity instanceof BaseMetaTileEntity)) && (((BaseMetaTileEntity) tTileEntity).privateAccess()) && (!((BaseMetaTileEntity) tTileEntity).playerOwnsThis(aPlayer, true))) { + return -1.0F; + } + return super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ); + } + + @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.getTileEntity(aX, aY, aZ); + if (tTileEntity == null) { + return false; + } + if(aPlayer.isSneaking()){ + ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); + if(tCurrentItem!=null){ + if(!GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)){ + return false; + } + }else {return false;} + } + if ((tTileEntity instanceof IGregTechTileEntity)) { + if (((IGregTechTileEntity) tTileEntity).getTimer() < 50L) { + return false; + } + if ((!aWorld.isRemote) && (!((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer))) { + return true; + } + return ((IGregTechTileEntity) tTileEntity).onRightclick(aPlayer, (byte) aSide, par1, par2, par3); + } + return false; + } + + @Override + public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if ((tTileEntity != null) && + ((tTileEntity instanceof IGregTechTileEntity))) { + ((IGregTechTileEntity) tTileEntity).onLeftclick(aPlayer); + } + } + + @Override + public int getDamageValue(World aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if ((tTileEntity instanceof IGregTechTileEntity)) { + return ((IGregTechTileEntity) tTileEntity).getMetaTileID(); + } + return 0; + } + + @Override + public void onBlockExploded(World aWorld, int aX, int aY, int aZ, Explosion aExplosion) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if ((tTileEntity instanceof BaseMetaTileEntity)) { + ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion(); + } + super.onBlockExploded(aWorld, aX, aY, aZ, aExplosion); + } + + @Override + public void breakBlock(World aWorld, int aX, int aY, int aZ, Block par5, int par6) { + GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if ((tTileEntity instanceof IGregTechTileEntity)) { + IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tTileEntity; + Random tRandom = new Random(); + mTemporaryTileEntity.set(tGregTechTileEntity); + for (int i = 0; i < tGregTechTileEntity.getSizeInventory(); i++) { + ItemStack tItem = tGregTechTileEntity.getStackInSlot(i); + if ((tItem != null) && (tItem.stackSize > 0) && (tGregTechTileEntity.isValidSlot(i))) { + EntityItem tItemEntity = new EntityItem(aWorld, aX + tRandom.nextFloat() * 0.8F + 0.1F, aY + tRandom.nextFloat() * 0.8F + 0.1F, aZ + tRandom.nextFloat() * 0.8F + 0.1F, new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage())); + if (tItem.hasTagCompound()) { + tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) tItem.getTagCompound().copy()); + } + tItemEntity.motionX = (tRandom.nextGaussian() * 0.0500000007450581D); + tItemEntity.motionY = (tRandom.nextGaussian() * 0.0500000007450581D + 0.2000000029802322D); + tItemEntity.motionZ = (tRandom.nextGaussian() * 0.0500000007450581D); + aWorld.spawnEntityInWorld(tItemEntity); + tItem.stackSize = 0; + tGregTechTileEntity.setInventorySlotContents(i, null); + } + } + } + super.breakBlock(aWorld, aX, aY, aZ, par5, par6); + aWorld.removeTileEntity(aX, aY, aZ); + } + + @Override + public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if ((tTileEntity instanceof IGregTechTileEntity)) { + return ((IGregTechTileEntity) tTileEntity).getDrops(); + } + return mTemporaryTileEntity.get() == null ? new ArrayList() : ((IGregTechTileEntity) mTemporaryTileEntity.get()).getDrops(); + } + + @Override + public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { + return ((IGregTechTileEntity) tTileEntity).getComparatorValue((byte) aSide); + } + return 0; + } + + @Override + public int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { + if ((aSide < 0) || (aSide > 5)) { + return 0; + } + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { + return ((IGregTechTileEntity) tTileEntity).getOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)); + } + return 0; + } + + @Override + public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { + if ((aSide < 0) || (aSide > 5)) { + return 0; + } + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { + return ((IGregTechTileEntity) tTileEntity).getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)); + } + return 0; + } + + @Override + public void dropBlockAsItemWithChance(World aWorld, int aX, int aY, int aZ, int par5, float chance, int par7) { + if (!aWorld.isRemote) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if ((tTileEntity != null) && (chance < 1.0F)) { + if (((tTileEntity instanceof BaseMetaTileEntity)) && (GregTech_API.sMachineNonWrenchExplosions)) { + ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion(); + } + } else { + super.dropBlockAsItemWithChance(aWorld, aX, aY, aZ, par5, chance, par7); + } + } + } + + @Override + public boolean isSideSolid(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection aSide) { + if (aWorld.getBlockMetadata(aX, aY, aZ) == 0) { + return true; + } + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity != null) { + if ((tTileEntity instanceof BaseMetaTileEntity)) { + return true; + } + if (((tTileEntity instanceof BaseMetaPipeEntity)) && ((((BaseMetaPipeEntity) tTileEntity).mConnections & 0xFFFFFFC0) != 0)) { + return true; + } + if (((tTileEntity instanceof ICoverable)) && (((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide.ordinal()) != 0)) { + return true; + } + } + return false; + } + + @Override + public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity == null) { + return 0; + } + if ((tTileEntity instanceof IGregTechTileEntity)) { + return ((IGregTechTileEntity) tTileEntity).getLightOpacity(); + } + return aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 255 : 0; + } + + @Override + public int getLightValue(IBlockAccess aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if ((tTileEntity instanceof BaseMetaTileEntity)) { + return ((BaseMetaTileEntity) tTileEntity).getLightValue(); + } + return 0; + } + + @Override + public TileEntity createTileEntity(World aWorld, int aMeta) { + if (aMeta < 4) { + return GregTech_API.constructBaseMetaTileEntity(); + } + return new BaseMetaPipeEntity(); + } + + @Override + public float getExplosionResistance(Entity par1Entity, World aWorld, int aX, int aY, int aZ, double explosionX, double explosionY, double explosionZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { + return ((IGregTechTileEntity) tTileEntity).getBlastResistance((byte) 6); + } + return 10.0F; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for (int i = 1; i < Meta_GT_Proxy.METATILEENTITIES.length; i++) { + if (Meta_GT_Proxy.METATILEENTITIES[i] != null) { + par3List.add(new ItemStack(par1, 1, i)); + } + } + } + + @Override + public void onBlockPlacedBy(World aWorld, int aX, int aY, int aZ, EntityLivingBase aPlayer, ItemStack aStack) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity == null) { + return; + } + if ((tTileEntity instanceof IGregTechTileEntity)) { + IGregTechTileEntity var6 = (IGregTechTileEntity) tTileEntity; + if (aPlayer == null) { + var6.setFrontFacing((byte) 1); + } else { + int var7 = MathHelper.floor_double(aPlayer.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3; + int var8 = Math.round(aPlayer.rotationPitch); + if ((var8 >= 65) && (var6.isValidFacing((byte) 1))) { + var6.setFrontFacing((byte) 1); + } else if ((var8 <= -65) && (var6.isValidFacing((byte) 0))) { + var6.setFrontFacing((byte) 0); + } else { + switch (var7) { + case 0: + var6.setFrontFacing((byte) 2); + break; + case 1: + var6.setFrontFacing((byte) 5); + break; + case 2: + var6.setFrontFacing((byte) 3); + break; + case 3: + var6.setFrontFacing((byte) 4); + } + } + } + } + } + + @Override + public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel) { + TileEntity tTileEntity = aPlayer.worldObj.getTileEntity(aX, aY, aZ); + if ((tTileEntity instanceof BaseMetaTileEntity)) { + return ((BaseMetaTileEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel); + } + if ((tTileEntity instanceof BaseMetaPipeEntity)) { + return ((BaseMetaPipeEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel); + } + return null; + } + + @Override + public boolean recolourBlock(World aWorld, int aX, int aY, int aZ, ForgeDirection aSide, int aColor) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if ((tTileEntity instanceof IGregTechTileEntity)) { + if (((IGregTechTileEntity) tTileEntity).getColorization() == (byte) ((aColor ^ 0xFFFFFFFF) & 0xF)) { + return false; + } + ((IGregTechTileEntity) tTileEntity).setColorization((byte) ((aColor ^ 0xFFFFFFFF) & 0xF)); + return true; + } + return false; + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java new file mode 100644 index 0000000000..0d9fadc6df --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java @@ -0,0 +1,129 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; + +import static gregtech.api.enums.GT_Values.V; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_SpawnEventHandler; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class GregtechMetaTileEntityChunkLoader extends GT_MetaTileEntity_TieredMachineBlock { + + public int mRange = 16; + + public GregtechMetaTileEntityChunkLoader(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 0, "Reprells nasty Creatures. Range: " + (4 + (12 * aTier)) + " unpowered / " + (16 + (48 * aTier)) + " powered"); + } + + public GregtechMetaTileEntityChunkLoader(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityChunkLoader(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide != 1) ? null : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER)}; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide()) { + int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; + if ((aTimer % 600 == 0) && !GT_SpawnEventHandler.mobReps.contains(tCoords)) { + GT_SpawnEventHandler.mobReps.add(tCoords); + } + if (aBaseMetaTileEntity.isUniversalEnergyStored(getMinimumStoredEU()) && aBaseMetaTileEntity.decreaseStoredEnergyUnits(1 << (this.mTier * 2), false)) { + mRange = 16 + (48 * mTier); + } else { + mRange = 4 + (12 * mTier); + } + } + } + + @Override + public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { + int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; + GT_SpawnEventHandler.mobReps.add(tCoords); + } + + @Override + public void onRemoval() { + int[] tCoords = new int[]{this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld().provider.dimensionId}; + GT_SpawnEventHandler.mobReps.remove(tCoords); + } + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return true; + } + + @Override + public boolean isEnetInput() { + return true; + } + + @Override + public boolean isInputFacing(byte aSide) { + return true; + } + + @Override + public boolean isTeleporterCompatible() { + return false; + } + + @Override + public long getMinimumStoredEU() { + return 512; + } + + @Override + public long maxEUStore() { + return 512 + V[mTier] * 50; + } + + @Override + public long maxEUInput() { + return V[mTier]; + } + + @Override + public long maxAmperesIn() { + return 2; + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; + } + + @Override + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + return null; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java new file mode 100644 index 0000000000..b953f0d672 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java @@ -0,0 +1,16 @@ +package gtPlusPlus.xmod.gregtech.loaders; + +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.xmod.gregtech.common.blocks.GregtechBlockMachines; +import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks; + +public class Gregtech_Blocks { + + public static void run(){ + + //Casing Blocks + ModBlocks.blockCasingsMisc = new GregtechMetaCasingBlocks(); + ModBlocks.blockMetaTileEntity = new GregtechBlockMachines(); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java new file mode 100644 index 0000000000..35fc715a6f --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java @@ -0,0 +1,99 @@ +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; +import net.minecraft.item.ItemStack; + +public class RecipeGen_Plates { + + public static void generateRecipes(Material material){ + + int tVoltageMultiplier = material.getMeltingPoint_K() >= 2800 ? 64 : 16; + ItemStack ingotStackOne = material.getIngot(1); + ItemStack ingotStackTwo = material.getIngot(2); + ItemStack shape_Mold = ItemList.Shape_Mold_Plate.get(1); + ItemStack shape_Extruder = ItemList.Shape_Extruder_Plate.get(1); + ItemStack plate_Single = material.getPlate(1); + ItemStack plate_SingleTwo = material.getPlate(2); + ItemStack plate_Double = material.getPlateDouble(1); + + //Forge Hammer + GT_Values.RA.addForgeHammerRecipe( + ingotStackTwo, + plate_Single, + (int) Math.max(material.getMass(), 1L), + 16); + //Bender + GT_Values.RA.addBenderRecipe( + ingotStackOne, + plate_Single, + (int) Math.max(material.getMass() * 1L, 1L), + 24); + //Extruder + GT_Values.RA.addExtruderRecipe( + ingotStackOne, + shape_Extruder, + plate_Single, + 10, 4 * tVoltageMultiplier); + //Alloy Smelter + GT_Values.RA.addAlloySmelterRecipe( + ingotStackTwo, + shape_Mold, + plate_Single, + (int) Math.max(material.getMass() * 2L, 1L), + 2 * tVoltageMultiplier); + + + //Making Double Plates + GT_Values.RA.addBenderRecipe( + ingotStackTwo, + plate_Double, + (int) Math.max(material.getMass() * 2L, 1L), + 96); + GT_Values.RA.addBenderRecipe( + plate_SingleTwo, + plate_Double, + (int) Math.max(material.getMass() * 2L, 1L), + 96); + + + Utils.LOG_WARNING("Adding crafting recipes for "+material.getLocalizedName()+" Plates - Single & Double"); + + //Single Plate Shaped/Shapeless + GT_ModHandler.addCraftingRecipe( + plate_Single, + gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, + new Object[]{"h", "B", "I", + Character.valueOf('I'), + ingotStackOne, + Character.valueOf('B'), + ingotStackOne}); + + GT_ModHandler.addShapelessCraftingRecipe( + plate_Single, + new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, + ingotStackOne, + ingotStackOne}); + + //Double Plate Shaped/Shapeless + GT_ModHandler.addCraftingRecipe( + plate_Double, + gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, + new Object[]{"I", "B", "h", + Character.valueOf('I'), + plate_Single, + Character.valueOf('B'), + plate_Single}); + GT_ModHandler.addShapelessCraftingRecipe( + plate_Double, + new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, + plate_Single, + plate_Single}); + } + + + +} diff --git a/src/resources/assets/miscutils/textures/blocks/fluids/fluid.molten.autogenerated.png b/src/resources/assets/miscutils/textures/blocks/fluids/fluid.molten.autogenerated.png Binary files differnew file mode 100644 index 0000000000..9a4148f6b6 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/fluids/fluid.molten.autogenerated.png diff --git a/src/resources/assets/miscutils/textures/blocks/fluids/fluid.molten.autogenerated.png.mcmeta b/src/resources/assets/miscutils/textures/blocks/fluids/fluid.molten.autogenerated.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/fluids/fluid.molten.autogenerated.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file |