diff options
author | Blood-Asp <bloodasphendrik@gmail.com> | 2017-09-03 17:57:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-03 17:57:34 +0200 |
commit | 6df7f36bd91815c71881aed11dc8b37975823736 (patch) | |
tree | 19fdb02e6c7f3435c8c39136ce73337ef5e14b7e /src/main/java/gregtech/api | |
parent | 5e87d49f2954f22fd830383420cc5d27e7378160 (diff) | |
parent | a6a74841389345b08e68d678e454dd76a46cc2a4 (diff) | |
download | GT5-Unofficial-6df7f36bd91815c71881aed11dc8b37975823736.tar.gz GT5-Unofficial-6df7f36bd91815c71881aed11dc8b37975823736.tar.bz2 GT5-Unofficial-6df7f36bd91815c71881aed11dc8b37975823736.zip |
Merge branch 'unstable' into CircuitChemistryUpdateFollowup
Diffstat (limited to 'src/main/java/gregtech/api')
11 files changed, 201 insertions, 38 deletions
diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java index b8e24196c6..92afee5cec 100644 --- a/src/main/java/gregtech/api/enums/ItemList.java +++ b/src/main/java/gregtech/api/enums/ItemList.java @@ -628,6 +628,7 @@ public enum ItemList implements IItemContainer { MagicEnergyAbsorber_LV, MagicEnergyAbsorber_MV, MagicEnergyAbsorber_HV, MagicEnergyAbsorber_EV, Depleted_Thorium_1, Depleted_Thorium_2, Depleted_Thorium_4, Processing_Array, Distillation_Tower, Energy_LapotronicOrb2, + Energy_Module, Energy_Cluster, ZPM2, Quantum_Tank_LV, Quantum_Tank_MV, Quantum_Tank_HV, Quantum_Tank_EV, Quantum_Tank_IV, Quantum_Chest_LV, Quantum_Chest_MV, Quantum_Chest_HV, Quantum_Chest_EV, Quantum_Chest_IV, NULL, Cover_RedstoneTransmitterExternal, Cover_RedstoneTransmitterInternal, Cover_RedstoneReceiverExternal, Cover_RedstoneReceiverInternal, diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index 1300613bb1..599cc60fec 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -542,6 +542,13 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static Materials GrowthMediumSterilized = new MaterialBuilder(609, TextureSet.SET_FLUID, "Sterilized Growth Medium").setName("GrowthMediumSterilized").addCell().addFluid().setRGB(222, 170, 135).setColor(Dyes.dyeOrange).constructMaterial(); public static Materials FerriteMixture = new MaterialBuilder(612, TextureSet.SET_METALLIC, "Ferrite Mixture").addDustItems().setRGB(180, 180, 180).setColor(Dyes.dyeGray).setMaterialList(new MaterialStack(Nickel, 1), new MaterialStack(Zinc, 1), new MaterialStack(Iron, 4)).constructMaterial(); public static Materials NickelZincFerrite = new MaterialBuilder(613, TextureSet.SET_ROUGH, "Nickel-Zinc Ferrite").addDustItems().addMetalItems().addToolHeadItems().addGearItems().setToolSpeed(3.0f).setDurability(32).setRGB(60, 60, 60).setColor(Dyes.dyeBlack).setBlastFurnaceRequired(true).setBlastFurnaceTemp(1500).setMaterialList(new MaterialStack(Nickel, 1), new MaterialStack(Zinc, 1), new MaterialStack(Iron, 4), new MaterialStack(Oxygen, 8)).constructMaterial(); + public static Materials Massicot = new MaterialBuilder(614, TextureSet.SET_DULL, "Massicot").addDustItems().setRGB(255, 221, 85).setColor(Dyes.dyeYellow).setMaterialList(new MaterialStack(Lead, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); + public static Materials ArsenicTrioxide = new MaterialBuilder(615, TextureSet.SET_SHINY, "Arsenic Trioxide").addDustItems().setRGB(255, 255, 255).setColor(Dyes.dyeGreen).setMaterialList(new MaterialStack(Arsenic, 2), new MaterialStack(Oxygen, 3)).addElectrolyzerRecipe().constructMaterial(); + public static Materials CobaltOxide = new MaterialBuilder(616, TextureSet.SET_DULL, "Cobalt Oxide").addDustItems().setRGB(102, 128, 0).setColor(Dyes.dyeGreen).setMaterialList(new MaterialStack(Cobalt, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); + public static Materials Zincite = new MaterialBuilder(617, TextureSet.SET_DULL, "Zincite").addDustItems().setRGB(255, 255, 245).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Zinc, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); + public static Materials AntimonyTrioxide = new MaterialBuilder(618, TextureSet.SET_DULL, "Antimony Trioxide").addDustItems().setRGB(230, 230, 240).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Antimony, 2), new MaterialStack(Oxygen, 3)).addElectrolyzerRecipe().constructMaterial(); + public static Materials CupricOxide = new MaterialBuilder(619, TextureSet.SET_DULL, "Cupric Oxide").addDustItems().setRGB(15, 15, 15).setColor(Dyes.dyeBlack).setMaterialList(new MaterialStack(Copper, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); + public static Materials Ferrosilite = new MaterialBuilder(620, TextureSet.SET_DULL, "Ferrosilite").addDustItems().setRGB(151, 99, 42).setColor(Dyes.dyeBrown).setMaterialList(new MaterialStack(Iron, 1), new MaterialStack(Silicon, 1), new MaterialStack(Oxygen, 3)).addElectrolyzerRecipe().constructMaterial(); public static Materials Magnesia = new MaterialBuilder(621, TextureSet.SET_DULL, "Magnesia").addDustItems().setRGB(255, 225, 225).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Magnesium, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); public static Materials Quicklime = new MaterialBuilder(622, TextureSet.SET_DULL, "Quicklime").addDustItems().setRGB(240, 240, 240).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Calcium, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); public static Materials Potash = new MaterialBuilder(623, TextureSet.SET_DULL, "Potash").addDustItems().setRGB(120, 66, 55).setColor(Dyes.dyeBrown).setMaterialList(new MaterialStack(Potassium, 2), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); @@ -872,8 +879,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { Mercury .add(SubTag.SMELTING_TO_GEM); Cinnabar .setDirectSmelting(Mercury ).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT).add(SubTag.SMELTING_TO_GEM); - Tetrahedrite .setDirectSmelting(Copper ).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); - Chalcopyrite .setDirectSmelting(Copper ).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); + Tetrahedrite .setDirectSmelting(Copper ).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT).add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); + Chalcopyrite .setDirectSmelting(Copper ).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT).add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); Malachite .setDirectSmelting(Copper ).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); Pentlandite .setDirectSmelting(Nickel ).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); Sphalerite .setDirectSmelting(Zinc ).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); @@ -883,17 +890,19 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { YellowLimonite .setDirectSmelting(Iron ).add(SubTag.INDUCTIONSMELTING_LOW_OUTPUT); BrownLimonite .setDirectSmelting(Iron ); BandedIron .setDirectSmelting(Iron ); + Magnetite .setDirectSmelting(Iron ); Cassiterite .setDirectSmelting(Tin ); CassiteriteSand .setDirectSmelting(Tin ); Chromite .setDirectSmelting(Chrome ); Garnierite .setDirectSmelting(Nickel ); Cobaltite .setDirectSmelting(Cobalt ); Stibnite .setDirectSmelting(Antimony ); - Cooperite .setDirectSmelting(Platinum ); - Pyrolusite .setDirectSmelting(Manganese ); - Magnesite .setDirectSmelting(Magnesium ); - Molybdenite .setDirectSmelting(Molybdenum ); - + Cooperite .setDirectSmelting(Platinum ).add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); + Pyrolusite .setDirectSmelting(Manganese ).add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); + Magnesite .setDirectSmelting(Magnesium ).add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); + Molybdenite .setDirectSmelting(Molybdenum ).add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); + Galena .setDirectSmelting(Lead ).add(SubTag.DONT_ADD_DEFAULT_BBF_RECIPE); + Amber .setOreMultiplier( 2).setSmeltingMultiplier( 2); InfusedAir .setOreMultiplier( 2).setSmeltingMultiplier( 2); InfusedFire .setOreMultiplier( 2).setSmeltingMultiplier( 2); @@ -1193,8 +1202,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { SubTag.ELECTROMAGNETIC_SEPERATION_NEODYMIUM.addTo(Bastnasite, Monazite, Forcicium, Forcillium); SubTag.ELECTROMAGNETIC_SEPERATION_GOLD.addTo(Magnetite, VanadiumMagnetite, BasalticMineralSand, GraniticMineralSand); SubTag.ELECTROMAGNETIC_SEPERATION_IRON.addTo(YellowLimonite, BrownLimonite, Pyrite, BandedIron, Nickel, Vermiculite, Glauconite, GlauconiteSand, Pentlandite, Tin, Antimony, Ilmenite, Manganese, Chrome, Chromite, Andradite); - SubTag.BLASTFURNACE_CALCITE_DOUBLE.addTo(Pyrite, YellowLimonite, BasalticMineralSand, GraniticMineralSand); - SubTag.BLASTFURNACE_CALCITE_TRIPLE.addTo(Iron, PigIron, DeepIron, ShadowIron, WroughtIron, MeteoricIron, BrownLimonite); + SubTag.BLASTFURNACE_CALCITE_DOUBLE.addTo(Pyrite, BrownLimonite, YellowLimonite, BasalticMineralSand, GraniticMineralSand, Magnetite); + SubTag.BLASTFURNACE_CALCITE_TRIPLE.addTo(Iron, PigIron, DeepIron, ShadowIron, WroughtIron, MeteoricIron); SubTag.WASHING_MERCURY.addTo(Gold, Silver, Osmium, Mithril, Platinum, Midasium, Cooperite, AstralSilver); SubTag.WASHING_SODIUMPERSULFATE.addTo(Zinc, Nickel, Copper, Cobalt, Cobaltite, Tetrahedrite); SubTag.METAL.addTo(AnyIron, AnyCopper, AnyBronze, Metal, Aluminium, Americium, Antimony, Beryllium, Bismuth, Caesium, Cerium, Chrome, Cobalt, Copper, Dysprosium, Erbium, Europium, Gadolinium, Gallium, Gold, @@ -2112,6 +2121,10 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { return GT_OreDictUnificator.get(OrePrefixes.ingot, this, amount); } + public ItemStack getNuggets(int amount){ + return GT_OreDictUnificator.get(OrePrefixes.nugget, this, amount); + } + public ItemStack getBlocks(int amount){ return GT_OreDictUnificator.get(OrePrefixes.block, this, amount); } diff --git a/src/main/java/gregtech/api/enums/SubTag.java b/src/main/java/gregtech/api/enums/SubTag.java index 7de2176e3e..e202aeaf77 100644 --- a/src/main/java/gregtech/api/enums/SubTag.java +++ b/src/main/java/gregtech/api/enums/SubTag.java @@ -31,6 +31,11 @@ public final class SubTag implements ICondition<ISubTagContainer> { */ public static final SubTag BLASTFURNACE_CALCITE_DOUBLE = getNewSubTag("BLASTFURNACE_CALCITE_DOUBLE"), BLASTFURNACE_CALCITE_TRIPLE = getNewSubTag("BLASTFURNACE_CALCITE_TRIPLE"); /** + * Add this to a material with Direct Smelting to prevent the automatic generation of a Bricked/Bronze Blast Furnace recipe. Already listed are: + * Chalcopyrite, Tetrahedrite + */ + public static final SubTag DONT_ADD_DEFAULT_BBF_RECIPE = getNewSubTag("DONT_ADD_DEFAULT_BBF_RECIPE"); + /** * Materials which are outputting less in an Induction Smelter. Already listed are: * Pyrite, Tetrahedrite, Sphalerite, Cinnabar */ diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java index 3154c4dc76..f60fa257be 100644 --- a/src/main/java/gregtech/api/enums/Textures.java +++ b/src/main/java/gregtech/api/enums/Textures.java @@ -612,13 +612,16 @@ public class Textures { new GT_RenderedTexture(OVERLAY_LOCKER_012), new GT_RenderedTexture(OVERLAY_LOCKER_013), }, - CASING_BLOCKS = new ITexture[128], + CASING_BLOCKS = new ITexture[128],//original variable still limited to 128 MACHINE_CASINGS[] = new ITexture[10][17]; + public static ITexture[][] casingTexturePages = new ITexture[128][];//page holder so we don't make an short long array + static { for (byte i = 0; i < MACHINE_CASINGS.length; i++) for (byte j = 0; j < MACHINE_CASINGS[i].length; j++) MACHINE_CASINGS[i][j] = new GT_SidedTexture(MACHINECASINGS_BOTTOM[i], MACHINECASINGS_TOP[i], MACHINECASINGS_SIDE[i], Dyes.getModulation(j - 1, Dyes.MACHINE_METAL.mRGBa)); + casingTexturePages[0]=CASING_BLOCKS; } protected IIcon mIcon; diff --git a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java index 7796691540..237b15fae9 100644 --- a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java @@ -189,8 +189,10 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci @Override public final void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - String tKey = getUnlocalizedName(aStack) + ".tooltip", tString = GT_LanguageManager.getTranslation(tKey); - if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) aList.add(tString); + String tKey = getUnlocalizedName(aStack) + ".tooltip"; + String[] tStrings = GT_LanguageManager.getTranslation(tKey).split("/n "); + for (String tString : tStrings) + if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) aList.add(tString); Long[] tStats = getElectricStats(aStack); @@ -607,4 +609,4 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci public boolean getIsRepairable(ItemStack aStack, ItemStack aMaterial) { return false; } -}
\ No newline at end of file +} diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 758743b122..ded8d26843 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -9,6 +9,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IEnergyConnected; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.net.GT_Packet_TileEntity; import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.*; @@ -58,7 +59,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE private byte[] mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15}; private int[] mCoverSides = new int[]{0, 0, 0, 0, 0, 0}, mCoverData = new int[]{0, 0, 0, 0, 0, 0}, mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING]; private boolean mHasEnoughEnergy = true, mRunningThroughTick = false, mInputDisabled = false, mOutputDisabled = false, mMuffler = false, mLockUpgrade = false, mActive = false, mRedstone = false, mWorkUpdate = false, mSteamConverter = false, mInventoryChanged = false, mWorks = true, mNeedsUpdate = true, mNeedsBlockUpdate = true, mSendClientData = false, oRedstone = false; - private byte mColor = 0, oColor = 0, mStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, oLightValueClient = -1, oLightValue = -1, mLightValue = 0, mOtherUpgrades = 0, mFacing = 0, oFacing = 0, mWorkData = 0; + private byte mColor = 0, oColor = 0, mStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, oTexturePage=0, oLightValueClient = -1, oLightValue = -1, mLightValue = 0, mOtherUpgrades = 0, mFacing = 0, oFacing = 0, mWorkData = 0; private int mDisplayErrorCode = 0, oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0, mLagWarningCount = 0; private short mID = 0; private long mTickTimer = 0, oOutput = 0, mAcceptedAmperes = Long.MAX_VALUE; @@ -513,7 +514,15 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE if (aSideServer) { if (mTickTimer % 10 == 0) { if (mSendClientData) { - NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)), oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord); + NW.sendPacketToAllPlayersInRange(worldObj, + new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, + mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], + oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)), + oTexturePage = (hasValidMetaTileEntity() && mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) ? ((GT_MetaTileEntity_Hatch) mMetaTileEntity).getTexturePage() : 0, + oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, + oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), + oColor = mColor), + xCoord, zCoord); mSendClientData = false; } } @@ -521,8 +530,13 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE if (mTickTimer > 10) { byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)); if (tData != oTextureData) sendBlockEvent((byte) 0, oTextureData = tData); + tData = mMetaTileEntity.getUpdateData(); if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData); + if(mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) { + tData = ((GT_MetaTileEntity_Hatch) mMetaTileEntity).getTexturePage(); + if (tData != oTexturePage) sendBlockEvent((byte) 1, (byte)((oTexturePage = tData)|0x80));//set last bit as a flag for page + } if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor); tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)); if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData); @@ -571,6 +585,30 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE return null; } + public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, int aCover5, byte aTextureData, byte aTexturePage, byte aUpdateData, byte aRedstoneData, byte aColorData) { + issueTextureUpdate(); + if (mID != aID && aID > 0) { + mID = aID; + createNewMetatileEntity(mID); + } + + mCoverSides[0] = aCover0; + mCoverSides[1] = aCover1; + mCoverSides[2] = aCover2; + mCoverSides[3] = aCover3; + mCoverSides[4] = aCover4; + mCoverSides[5] = aCover5; + + for (byte i = 0; i < 6; i++) mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]); + + receiveClientEvent(0, aTextureData); + receiveClientEvent(1, aUpdateData & 0x7F); + receiveClientEvent(1, aTexturePage | 0x80); + receiveClientEvent(2, aColorData); + receiveClientEvent(3, aRedstoneData); + } + + @Deprecated public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) { issueTextureUpdate(); if (mID != aID && aID > 0) { @@ -588,7 +626,8 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE for (byte i = 0; i < 6; i++) mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]); receiveClientEvent(0, aTextureData); - receiveClientEvent(1, aUpdateData); + receiveClientEvent(1, aUpdateData & 0x7F); + receiveClientEvent(1, 0x80); receiveClientEvent(2, aColorData); receiveClientEvent(3, aRedstoneData); } @@ -616,7 +655,12 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE //mLockUpgrade = ((aValue&32) != 0); break; case 1: - if (hasValidMetaTileEntity()) mMetaTileEntity.onValueUpdate((byte) aValue); + if (hasValidMetaTileEntity()) { + if ((aValue & 0x80) == 0) //Is texture index + mMetaTileEntity.onValueUpdate((byte) (aValue & 0x7F)); + else if (mMetaTileEntity instanceof GT_MetaTileEntity_Hatch)//is texture page and hatch + ((GT_MetaTileEntity_Hatch) mMetaTileEntity).onTexturePageUpdate((byte) (aValue & 0x7F)); + } break; case 2: if (aValue > 16 || aValue < 0) aValue = 0; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java index d33b71bc73..fe21e8a3c2 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java @@ -1,13 +1,17 @@ package gregtech.api.metatileentity.implementations; +import gregtech.GT_Mod; +import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.nbt.NBTTagCompound; public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTank { - + @Deprecated //Use texture changing method public byte mMachineBlock = 0; + private byte mTexturePage = 0; + private byte actualTexture = 0; public GT_MetaTileEntity_Hatch(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); @@ -40,29 +44,72 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return aSide != aFacing ? mMachineBlock > 0 ? new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]} : mMachineBlock > 0 ? aActive ? getTexturesActive(Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]) : getTexturesInactive(Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]) : aActive ? getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]) : getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]); + int textureIndex=actualTexture|(mTexturePage<<7);//Shift seven since one page is 128 textures! + int texturePointer=(byte)(actualTexture&0x7F);//just to be sure, from my testing the 8th bit cannot be set clientside + return aSide != aFacing ? + textureIndex > 0 ? + new ITexture[]{Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]} : + new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]} : + textureIndex > 0 ? + aActive ? + getTexturesActive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]) : + getTexturesInactive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]) : + aActive ? + getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]) : + getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]); } @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - aNBT.setByte("mMachineBlock", mMachineBlock); + aNBT.setByte("mMachineBlock", actualTexture); + aNBT.setByte("mTexturePage", mTexturePage); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - mMachineBlock = aNBT.getByte("mMachineBlock"); + actualTexture=aNBT.getByte("mMachineBlock"); + mTexturePage=aNBT.getByte("mTexturePage"); + + if(mTexturePage!=0 && GT_Values.GT.isServerSide()) + actualTexture|=0x80;//<- lets just hope no one needs the correct value for that on server + mMachineBlock=actualTexture; + } + + public final void updateTexture(int textureIndex){ + onValueUpdate((byte) textureIndex); + onTexturePageUpdate((byte) (textureIndex>>7)); + } + + public final void updateTexture(byte texturePage, byte machineBlock){ + onValueUpdate(machineBlock); + onTexturePageUpdate(texturePage); } @Override public final void onValueUpdate(byte aValue) { - mMachineBlock = (byte) (aValue & 127); + actualTexture=(byte)(aValue & 0x7F); + mMachineBlock=actualTexture; + mTexturePage=0; } @Override public final byte getUpdateData() { - return (byte) (mMachineBlock & 127); + return (byte)(actualTexture & 0x7F); + } + + public final void onTexturePageUpdate(byte aValue) { + mTexturePage = (byte)(aValue & 0x7F); + if(mTexturePage!=0 && getBaseMetaTileEntity().isServerSide()) {//just to be sure + mMachineBlock|=0x80;//<- lets just hope no one needs the correct value for that on server + actualTexture=mMachineBlock; + } + //set last bit to allow working of the page reset-er to 0 in rare case when texture id is the same but page changes to 0 + } + + public final byte getTexturePage() { + return (byte)(mTexturePage & 0x7F); } @Override @@ -94,4 +141,16 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan public boolean displaysStackSize() { return false; } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {//in that method since it is usually not overriden, especially for hatches. + if(actualTexture!=mMachineBlock){//revert to page 0 on edition of the field - old code way + actualTexture=(byte)(mMachineBlock & 0x7F); + mMachineBlock=actualTexture;//clear last bit in mMachineBlock since now we are at page 0 after the direct field change + mTexturePage=0;//assuming old code only supports page 0 + } + super.onPreTick(aBaseMetaTileEntity, aTick); + } + + //To change to other page -> use the setter method -> updateTexture } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index 86547d1736..e6f4f3d766 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -28,10 +28,12 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { @Override public String[] getDescription() { - String[] desc = new String[mDescriptionArray.length + 2]; + String[] desc = new String[mDescriptionArray.length + 3]; System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); desc[mDescriptionArray.length] = "DO NOT OBSTRUCT THE OUTPUT!"; desc[mDescriptionArray.length + 1] = "Reduces Pollution to " + calculatePollutionReduction(100) + "%"; + //Pollution Recovery scales from 5% at LV to 100% at MAX Voltage + desc[mDescriptionArray.length + 2] = "Recovers " + (105 - calculatePollutionReduction(100)) + "% of CO2/CO/SO2"; return desc; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index f0fb16f6d7..fd6b144d84 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -724,8 +724,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { if (aTileEntity == null) return false; IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) @@ -750,7 +751,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) return false; if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); } return false; @@ -763,7 +764,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) return false; if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); } return false; @@ -774,7 +775,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) return false; if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); } return false; @@ -785,7 +786,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) return false; if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); } return false; @@ -796,12 +797,12 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) return false; if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap(); return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); } @@ -813,11 +814,11 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) return false; if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); } return false; diff --git a/src/main/java/gregtech/api/net/GT_Packet_TileEntity.java b/src/main/java/gregtech/api/net/GT_Packet_TileEntity.java index b916da27b9..457bd7f21d 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_TileEntity.java +++ b/src/main/java/gregtech/api/net/GT_Packet_TileEntity.java @@ -11,12 +11,33 @@ import net.minecraft.world.IBlockAccess; public class GT_Packet_TileEntity extends GT_Packet { private int mX, mZ, mC0, mC1, mC2, mC3, mC4, mC5; private short mY, mID; - private byte mTexture, mUpdate, mRedstone, mColor; + private byte mTexture, mTexturePage, mUpdate, mRedstone, mColor; public GT_Packet_TileEntity() { super(true); } + //For tiles + public GT_Packet_TileEntity(int aX, short aY, int aZ, short aID, int aC0, int aC1, int aC2, int aC3, int aC4, int aC5, byte aTexture, byte aTexturePage, byte aUpdate, byte aRedstone, byte aColor) { + super(false); + mX = aX; + mY = aY; + mZ = aZ; + mC0 = aC0; + mC1 = aC1; + mC2 = aC2; + mC3 = aC3; + mC4 = aC4; + mC5 = aC5; + mID = aID; + mTexture = aTexture; + mTexturePage=aTexturePage; + mUpdate = aUpdate; + mRedstone = aRedstone; + mColor = aColor; + } + + //For pipes public GT_Packet_TileEntity(int aX, short aY, int aZ, short aID, int aC0, int aC1, int aC2, int aC3, int aC4, int aC5, byte aTexture, byte aUpdate, byte aRedstone, byte aColor) { super(false); mX = aX; @@ -30,6 +51,7 @@ public class GT_Packet_TileEntity extends GT_Packet { mC5 = aC5; mID = aID; mTexture = aTexture; + mTexturePage=0; mUpdate = aUpdate; mRedstone = aRedstone; mColor = aColor; @@ -37,7 +59,7 @@ public class GT_Packet_TileEntity extends GT_Packet { @Override public byte[] encode() { - ByteArrayDataOutput tOut = ByteStreams.newDataOutput(40); + ByteArrayDataOutput tOut = ByteStreams.newDataOutput(41); tOut.writeInt(mX); tOut.writeShort(mY); @@ -52,6 +74,7 @@ public class GT_Packet_TileEntity extends GT_Packet { tOut.writeInt(mC5); tOut.writeByte(mTexture); + tOut.writeByte(mTexturePage); tOut.writeByte(mUpdate); tOut.writeByte(mRedstone); tOut.writeByte(mColor); @@ -61,7 +84,7 @@ public class GT_Packet_TileEntity extends GT_Packet { @Override public GT_Packet decode(ByteArrayDataInput aData) { - return new GT_Packet_TileEntity(aData.readInt(), aData.readShort(), aData.readInt(), aData.readShort(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readByte(), aData.readByte(), aData.readByte(), aData.readByte()); + return new GT_Packet_TileEntity(aData.readInt(), aData.readShort(), aData.readInt(), aData.readShort(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readByte(), aData.readByte(), aData.readByte(), aData.readByte(), aData.readByte()); } @Override @@ -70,7 +93,7 @@ public class GT_Packet_TileEntity extends GT_Packet { TileEntity tTileEntity = aWorld.getTileEntity(mX, mY, mZ); if (tTileEntity != null) { if (tTileEntity instanceof BaseMetaTileEntity) - ((BaseMetaTileEntity) tTileEntity).receiveMetaTileEntityData(mID, mC0, mC1, mC2, mC3, mC4, mC5, mTexture, mUpdate, mRedstone, mColor); + ((BaseMetaTileEntity) tTileEntity).receiveMetaTileEntityData(mID, mC0, mC1, mC2, mC3, mC4, mC5, mTexture, mTexturePage, mUpdate, mRedstone, mColor); else if (tTileEntity instanceof BaseMetaPipeEntity) ((BaseMetaPipeEntity) tTileEntity).receiveMetaTileEntityData(mID, mC0, mC1, mC2, mC3, mC4, mC5, mTexture, mUpdate, mRedstone, mColor); } diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 7a6ac36c95..d31a2529c2 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -14,6 +14,7 @@ import gregtech.api.interfaces.IProjectileItem; import gregtech.api.interfaces.tileentity.*; import gregtech.api.items.GT_EnergyArmor_Item; import gregtech.api.items.GT_Generic_Item; +import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable; import gregtech.api.net.GT_Packet_Sound; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.ItemData; @@ -1733,6 +1734,15 @@ public class GT_Utility { if (D1) e.printStackTrace(GT_Log.err); } try { + if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable) { + GT_MetaPipeEntity_Cable c = (GT_MetaPipeEntity_Cable) ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); + tList.add("Max voltage last second " + c.mTransferredVoltageLast20); + tList.add("Max amperage last second " + c.mTransferredAmperageLast20); + } + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + try { if (tTileEntity instanceof IBasicEnergyContainer && ((IBasicEnergyContainer) tTileEntity).getEUCapacity() > 0) { tList.add(trans("179","Max IN: ") + ((IBasicEnergyContainer) tTileEntity).getInputVoltage() + trans("180"," EU")); tList.add(trans("181","Max OUT: ") + ((IBasicEnergyContainer) tTileEntity).getOutputVoltage() + trans("182"," EU at ") + ((IBasicEnergyContainer) tTileEntity).getOutputAmperage() + trans("183"," Amperes")); |