diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2017-01-05 16:45:55 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2017-01-05 16:45:55 +1000 |
commit | d5f700a2279ee19386609663c40471daf69d5fbb (patch) | |
tree | cffad2d2cfe557f3a3cea0830ac3b6b2665b58f9 /src | |
parent | e21a733f3a4ab0eba98830d4244dd7ac7b138ff9 (diff) | |
download | GT5-Unofficial-d5f700a2279ee19386609663c40471daf69d5fbb.tar.gz GT5-Unofficial-d5f700a2279ee19386609663c40471daf69d5fbb.tar.bz2 GT5-Unofficial-d5f700a2279ee19386609663c40471daf69d5fbb.zip |
+ Added a casing for the perimeter of the Tree Farmer structure.
$ Improved the structure formation of the Tree Farmer, it now works better when built.
+ Added a new texture for the Farm manager blocks, which surround the Tree Farming structure.
Diffstat (limited to 'src')
8 files changed, 413 insertions, 190 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index 2cf33823e4..1d0c9be34d 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -65,6 +65,7 @@ public class COMPAT_HANDLER { GregtechGeothermalThermalGenerator.run(); Gregtech4Content.run(); GregtechIndustrialFuelRefinery.run(); + GregtechTreeFarmerTE.run(); GregtechIndustrialTreeFarm.run(); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index e04d95493c..c50d4a2b80 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -146,7 +146,7 @@ public enum GregtechItemList implements GregtechItemContainer { Industrial_FuelRefinery, //Tree Farm - Industrial_TreeFarm, + Industrial_TreeFarm, TreeFarmer_Structural, ; public static final GregtechItemList[] diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java new file mode 100644 index 0000000000..8920525da4 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java @@ -0,0 +1,54 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +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.objects.GT_RenderedTexture; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines.GregtechMetaTreeFarmerBase; +import net.minecraft.nbt.NBTTagCompound; + +public class GregtechMetaTreeFarmerStructural + extends GregtechMetaTreeFarmerBase { + + @Override + public String[] getDescription() { + return new String[] {mDescription, CORE.GT_Tooltip}; + } + + public GregtechMetaTreeFarmerStructural(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 0, "Structural Blocks for the Tree Farmer."); + } + + public GregtechMetaTreeFarmerStructural(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) { + super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); + } + + public GregtechMetaTreeFarmerStructural(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTreeFarmerStructural(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); + } + + @Override + public ITexture getOverlayIcon() { + return new GT_RenderedTexture(Textures.BlockIcons.VOID); + } + + @Override + public boolean isValidSlot(int aIndex) { + return false; + } + + @Override + public void saveNBTData(NBTTagCompound paramNBTTagCompound) { + } + + @Override + public void loadNBTData(NBTTagCompound paramNBTTagCompound) { + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaTreeFarmerBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaTreeFarmerBase.java new file mode 100644 index 0000000000..b76ca01bbc --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaTreeFarmerBase.java @@ -0,0 +1,174 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines; + +import gregtech.api.interfaces.ITexture; +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_Utility; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +public abstract class GregtechMetaTreeFarmerBase extends GT_MetaTileEntity_TieredMachineBlock { + public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bUnbreakable = false; + public int mSuccess = 0, mTargetStackSize = 0; + + public GregtechMetaTreeFarmerBase(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) { + super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); + } + + public GregtechMetaTreeFarmerBase(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + @Override + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + ITexture[][][] rTextures = new ITexture[10][17][]; + for (byte i = -1; i < 16; i++) { + rTextures[0][i + 1] = getFront(i); + rTextures[1][i + 1] = getBack(i); + rTextures[2][i + 1] = getBottom(i); + rTextures[3][i + 1] = getTop(i); + rTextures[4][i + 1] = getSides(i); + rTextures[5][i + 1] = getFrontActive(i); + rTextures[6][i + 1] = getBackActive(i); + rTextures[7][i + 1] = getBottomActive(i); + rTextures[8][i + 1] = getTopActive(i); + rTextures[9][i + 1] = getSidesActive(i); + } + return rTextures; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; + } + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public boolean isValidSlot(int aIndex) { + return false; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return true; + } + + @Override + public boolean isEnetInput() { + return false; + } + + @Override + public boolean isEnetOutput() { + return false; + } + + @Override + public boolean isInputFacing(byte aSide) { + return !isOutputFacing(aSide); + } + + @Override + public boolean isOutputFacing(byte aSide) { + return getBaseMetaTileEntity().getBackFacing() == aSide; + } + + @Override + public boolean isTeleporterCompatible() { + return false; + } + + @Override + public long getMinimumStoredEU() { + return 0; + } + + @Override + public long maxEUStore() { + return 0; + } + + @Override + public long maxEUInput() { + return 0; + } + + @Override + public long maxEUOutput() { + return 0; + } + + @Override + public long maxAmperesIn() { + return 0; + } + + @Override + public long maxAmperesOut() { + return 0; + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return false; + } + + public abstract ITexture getOverlayIcon(); + + + @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; + } + + public ITexture[] getFront(byte aColor) { + return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager)}; + } + + public ITexture[] getBack(byte aColor) { + return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager)}; + } + + public ITexture[] getBottom(byte aColor) { + return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager)}; + } + + public ITexture[] getTop(byte aColor) { + return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager)}; + } + + public ITexture[] getSides(byte aColor) { + return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager)}; + } + + public ITexture[] getFrontActive(byte aColor) { + return getFront(aColor); + } + + public ITexture[] getBackActive(byte aColor) { + return getBack(aColor); + } + + public ITexture[] getBottomActive(byte aColor) { + return getBottom(aColor); + } + + public ITexture[] getTopActive(byte aColor) { + return getTop(aColor); + } + + public ITexture[] getSidesActive(byte aColor) { + return getSides(aColor); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java index e9ffb7ad74..689b02474a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java @@ -121,6 +121,11 @@ public class TexturesGtBlock { private static final CustomIcon Internal_Casing_Machine_Redstone_On = new CustomIcon("TileEntities/cover_redstone_emitter"); public static final CustomIcon Casing_Machine_Redstone_On = Internal_Casing_Machine_Redstone_On; + //MACHINE_CASING_FARM_MANAGER_STRUCTURAL + //Farm Manager Casings + private static final CustomIcon Internal_Casing_Machine_Farm_Manager = new CustomIcon("TileEntities/MACHINE_CASING_FARM_MANAGER_STRUCTURAL"); + public static final CustomIcon Casing_Machine_Farm_Manager = Internal_Casing_Machine_Farm_Manager; + //Overlays //Fan Textures private static final CustomIcon Internal_Overlay_Machine_Vent = new CustomIcon("TileEntities/machine_top_vent_rotating"); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java index f26b654df8..8edf2b4c2d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java @@ -3,9 +3,11 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; import gregtech.api.GregTech_API; 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.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; @@ -14,13 +16,13 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.forestry.trees.TreefarmManager; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import java.lang.reflect.Field; import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.world.ChunkPosition; public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlockBase { @@ -30,6 +32,8 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock private static final ITexture[] FACING_ACTIVE = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBLASTFURNACE_ACTIVE)}; + public ArrayList<GT_MetaTileEntity_TieredMachineBlock> mCasings = new ArrayList(); + private boolean running = false; private boolean p1, p2, p3, p4, p5, p6; public int mMaxProgresstime = 0; @@ -120,7 +124,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override public boolean checkRecipe(ItemStack aStack) { Utils.LOG_INFO("Working"); - if (!checkRecursiveBlocks()) { + /*if (!checkRecursiveBlocks()) { this.mEfficiency = 0; this.mEfficiencyIncrease = 0; this.mMaxProgresstime = 0; @@ -134,189 +138,25 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); //GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), mMaxProgresstime*5); return true; - } + }*/ this.mEfficiency = 0; this.mEfficiencyIncrease = 0; this.mMaxProgresstime = 0; return false; } - private boolean checkRecursiveBlocks() { - ArrayList<ChunkPosition> tList1 = new ArrayList<ChunkPosition>(); - ArrayList<ChunkPosition> tList2 = new ArrayList<ChunkPosition>(); - - Block tBlock = this.getBaseMetaTileEntity().getBlockOffset(0, +1, 0); - Utils.LOG_INFO("Looking for air above the controller."); - if (!TreefarmManager.isAirBlock(tBlock)) { - Utils.LOG_INFO("Did not find air above the controller."); - return false; - } else { - Utils.LOG_INFO("Adding spot to a list?"); - tList2.add(new ChunkPosition(0, 0, 0)); - } - while (!tList2.isEmpty()) { - ChunkPosition tPos = (ChunkPosition) tList2.get(0); - tList2.remove(0); - if (!checkAllBlockSides(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ, tList1, tList2)) { - return false; - } - } - if (running) { - for (ChunkPosition tPos : tList1) { - if (TreefarmManager.isWoodLog(this.getBaseMetaTileEntity().getBlockOffset(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ))){ - //This does the block change to brittle charcoal. - //this.getBaseMetaTileEntity().getWorld().setBlock(this.getBaseMetaTileEntity().getXCoord() + tPos.chunkPosX, this.getBaseMetaTileEntity().getYCoord() + tPos.chunkPosY, this.getBaseMetaTileEntity().getZCoord() + tPos.chunkPosZ, GregTech_API.sBlockConcretes, 4, 3); - - } - } - running = false; - return false; - } else { - this.mMaxProgresstime = (int) Math.sqrt(tList1.size() * 240000); - } - running = true; - return true; - } - - private boolean checkAllBlockSides(int aX, int aY, int aZ, ArrayList<ChunkPosition> aList1, ArrayList<ChunkPosition> aList2) { - p1 = false; - p2 = false; - p3 = false; - p4 = false; - p5 = false; - p6 = false; - Utils.LOG_INFO("checkAllBlockSides"); - - Utils.LOG_INFO("Testing Side 1"); - Block tBlock = this.getBaseMetaTileEntity().getBlockOffset(aX + 1, aY, aZ); - if (aX + 1 < 6 && (TreefarmManager.isDirtBlock(tBlock))) { - if (!aList1.contains(new ChunkPosition(aX + 1, aY, aZ)) && (!aList2.contains(new ChunkPosition(aX + 1, aY, aZ)))){ - p1 = true; - Utils.LOG_INFO("set p1 true"); - } - } else if (!(tBlock == Blocks.dirt || tBlock == Blocks.grass)) { - Utils.LOG_INFO("1- Looking for Dirt at X:"+(aX+1)+" Y:"+aY+" Z:"+aZ+" but instead found "+tBlock.getLocalizedName()); - return false; - } - - Utils.LOG_INFO("Testing Side 2"); - tBlock = this.getBaseMetaTileEntity().getBlockOffset(aX - 1, aY, aZ); - if (aX - 1 > -6 && (TreefarmManager.isDirtBlock(tBlock))) { - if (!aList1.contains(new ChunkPosition(aX - 1, aY, aZ)) && (!aList2.contains(new ChunkPosition(aX - 1, aY, aZ)))){ - p2 = true; - Utils.LOG_INFO("set p2 true"); - } - } else if (!(tBlock == Blocks.dirt || tBlock == Blocks.grass)) { - Utils.LOG_INFO("2- Looking for Dirt at X:"+(aX-1)+" Y:"+aY+" Z:"+aZ+" but instead found "+tBlock.getLocalizedName()); - return false; - } - - Utils.LOG_INFO("Testing For Fence X+1"); - tBlock = this.getBaseMetaTileEntity().getBlockOffset(aX+1, aY+1, aZ); - if ((aY+1) == 1 && (TreefarmManager.isFenceBlock(tBlock))) { - if (!aList1.contains(new ChunkPosition(aX+1, aY+1, aZ)) && (!aList2.contains(new ChunkPosition(aX+1, aY+1, aZ)))){ - //p3 = true; - Utils.LOG_INFO("set p3 true"); - } - } else if (!(TreefarmManager.isFenceBlock(tBlock)) || !this.getBaseMetaTileEntity().getAirOffset(aX+1, aY+1, aZ)) { - Utils.LOG_INFO("3- Looking for Fence at X:"+(aX+1)+" Y:"+(aY+1)+" Z:"+aZ+" but instead found "+tBlock.getLocalizedName()); - return false; - } - Utils.LOG_INFO("Testing For Fence X-1"); - tBlock = this.getBaseMetaTileEntity().getBlockOffset(aX-1, aY+1, aZ); - if ((aY+1) == 1 && (TreefarmManager.isFenceBlock(tBlock))) { - if (!aList1.contains(new ChunkPosition(aX-1, aY+1, aZ)) && (!aList2.contains(new ChunkPosition(aX-1, aY+1, aZ)))){ - //p3 = true; - Utils.LOG_INFO("set p3 true"); - } - } else if (!(TreefarmManager.isFenceBlock(tBlock)) || !this.getBaseMetaTileEntity().getAirOffset(aX-1, aY+1, aZ)) { - Utils.LOG_INFO("3- Looking for Fence at X:"+(aX-1)+" Y:"+(aY+1)+" Z:"+aZ+" but instead found "+tBlock.getLocalizedName()); - return false; - } - Utils.LOG_INFO("Testing For Fence Z+1"); - tBlock = this.getBaseMetaTileEntity().getBlockOffset(aX, aY+1, aZ+1); - if ((aY+1) == 1 && (TreefarmManager.isFenceBlock(tBlock))) { - if (!aList1.contains(new ChunkPosition(aX, aY+1, aZ+1)) && (!aList2.contains(new ChunkPosition(aX, aY+1, aZ+1)))){ - //p3 = true; - Utils.LOG_INFO("set p3 true"); - } - } else if (!(TreefarmManager.isFenceBlock(tBlock)) || !this.getBaseMetaTileEntity().getAirOffset(aX, aY+1, aZ+1)) { - Utils.LOG_INFO("3- Looking for Fence at X:"+(aX)+" Y:"+(aY+1)+" Z:"+(aZ+1)+" but instead found "+tBlock.getLocalizedName()); - return false; - } - Utils.LOG_INFO("Testing For Fence Z-1"); - tBlock = this.getBaseMetaTileEntity().getBlockOffset(aX, aY+1, aZ-1); - if ((aY+1) == 1 && (TreefarmManager.isFenceBlock(tBlock))) { - if (!aList1.contains(new ChunkPosition(aX, aY+1, aZ-1)) && (!aList2.contains(new ChunkPosition(aX, aY+1, aZ-1)))){ - //p3 = true; - Utils.LOG_INFO("set p3 true"); - } - } else if (!(TreefarmManager.isFenceBlock(tBlock)) || !this.getBaseMetaTileEntity().getAirOffset(aX, aY+1, aZ-1)) { - Utils.LOG_INFO("3- Looking for Fence at X:"+(aX)+" Y:"+(aY+1)+" Z:"+(aZ-1)+" but instead found "+tBlock.getLocalizedName()); - return false; - } - - /*Utils.LOG_INFO("Testing Side 4"); - tBlock = this.getBaseMetaTileEntity().getBlockOffset(aX, aY - 1, aZ); - if (aY - 1 > -6 && (isDirtBlock(tBlock))) { - if (!aList1.contains(new ChunkPosition(aX, aY - 1, aZ)) && (!aList2.contains(new ChunkPosition(aX, aY - 1, aZ)))){ - p4 = true; - Utils.LOG_INFO("set p4 true"); - } - } else if (tBlock != GregTech_API.sBlockCasings1) { //The Base Layer Check - Utils.LOG_INFO("Bottom Layer is not Machine Casings HV"); - return false; - } - else if (this.getBaseMetaTileEntity().getMetaIDOffset(aX, aY - 1, aZ) != 3) { - Utils.LOG_INFO("Bottom Layer has wrong meta, expecting 3. Got "+this.getBaseMetaTileEntity().getMetaIDOffset(aX, aY - 1, aZ)); - return false; - }*/ - - Utils.LOG_INFO("Testing Side 5"); - tBlock = this.getBaseMetaTileEntity().getBlockOffset(aX, aY, aZ + 1); - if (aZ + 1 < 6 && (TreefarmManager.isDirtBlock(tBlock))) { - if (!aList1.contains(new ChunkPosition(aX, aY, aZ + 1)) && (!aList2.contains(new ChunkPosition(aX, aY, aZ + 1)))){ - p5 = true; - Utils.LOG_INFO("set p5 true"); - } - } else if (!(tBlock == Blocks.dirt || tBlock == Blocks.grass)) { - Utils.LOG_INFO("Looking for Dirt at X:"+(aX)+" Y:"+aY+" Z:"+(aZ+1)+" but instead found "+tBlock.getLocalizedName()); - return false; - } - - Utils.LOG_INFO("Testing Side 6"); - tBlock = this.getBaseMetaTileEntity().getBlockOffset(aX, aY, aZ - 1); - if (aZ - 1 > -6 && (TreefarmManager.isDirtBlock(tBlock))) { - if (!aList1.contains(new ChunkPosition(aX, aY, aZ - 1)) && (!aList2.contains(new ChunkPosition(aX, aY, aZ - 1)))){ - p6 = true; - Utils.LOG_INFO("set p6 true"); - } - } else if (!(tBlock == Blocks.dirt || tBlock == Blocks.grass)) { - Utils.LOG_INFO("Looking for Dirt at X:"+(aX)+" Y:"+aY+" Z:"+(aZ-1)+" but instead found "+tBlock.getLocalizedName()); - return false; - } - aList1.add(new ChunkPosition(aX, aY, aZ)); - if (p1) aList2.add(new ChunkPosition(aX + 1, aY, aZ)); - if (p2) aList2.add(new ChunkPosition(aX - 1, aY, aZ)); - if (p3) aList2.add(new ChunkPosition(aX, aY, aZ)); - if (p4) aList2.add(new ChunkPosition(aX, aY - 1, aZ)); - if (p5) aList2.add(new ChunkPosition(aX, aY, aZ + 1)); - if (p6) aList2.add(new ChunkPosition(aX, aY, aZ - 1)); - return true; - } - - private Block getHumus(){ - if (!LoadedMods.Forestry){ - return null; - } - return TreefarmManager.getHumus(); + if (!LoadedMods.Forestry){ + return null; + } + return TreefarmManager.getHumus(); } @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + this.mCasings.clear(); Utils.LOG_INFO("Step 1"); int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; @@ -327,7 +167,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock Utils.LOG_INFO("Step 3"); for (int h = 0; h <= 1; h++) { Utils.LOG_INFO("Step 4"); - + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); //Farm Floor inner 14x14 @@ -337,15 +177,15 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock if (h == 0) { //Dirt Floor if (!TreefarmManager.isDirtBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))) { - Utils.LOG_INFO("Dirt like block missing from inner 14x14."); - Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); - aBaseMetaTileEntity.getWorld().setBlock( - (aBaseMetaTileEntity.getXCoord()+(xDir+i)), - (aBaseMetaTileEntity.getYCoord()+(h)), - (aBaseMetaTileEntity.getZCoord()+(zDir+j)), - Blocks.melon_block); - return false; - } + Utils.LOG_INFO("Dirt like block missing from inner 14x14."); + Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + aBaseMetaTileEntity.getWorld().setBlock( + (aBaseMetaTileEntity.getXCoord()+(xDir+i)), + (aBaseMetaTileEntity.getYCoord()+(h)), + (aBaseMetaTileEntity.getZCoord()+(zDir+j)), + Blocks.melon_block); + return false; + } } // Inside fenced area, mostly air or trees or saplings else if (h == 1){ @@ -372,18 +212,25 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock } //Deal with Bottom edges (Add Hatches/Busses first, othercheck make sure it's dirt) //TODO change the casings to not dirt~ else if (h == 0) { - if ((!addMaintenanceToMachineList(tTileEntity, 70)) && (!addInputToMachineList(tTileEntity, 70)) && (!addOutputToMachineList(tTileEntity, 70)) && (!addDynamoToMachineList(tTileEntity, 70))) { - if ((xDir + i != 0) || (zDir + j != 0)) {//no controller - if (!TreefarmManager.isDirtBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))) { - Utils.LOG_INFO("Dirt missing from Edge."); + + try { + addCasingToCasingList(tTileEntity); + } catch (Throwable t){} + + if ((!addMaintenanceToMachineList(tTileEntity, 70)) && (!addInputToMachineList(tTileEntity, 70)) && (!addOutputToMachineList(tTileEntity, 70)) && (!addEnergyInputToMachineList(tTileEntity, 70))) { + if ((xDir + i != 0) || (zDir + j != 0)) {//no controller + + if (!(aBaseMetaTileEntity.getMetaTileID() != 752)) { + Utils.LOG_INFO("Fark Keeper Casings Missing from one of the edges on the bottom edge. x:"+(xDir+i)+" y:"+h+" z:"+(zDir+j)+" | "+aBaseMetaTileEntity.getClass()); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; - } + } + Utils.LOG_INFO("Found a farm keeper."); } } } Utils.LOG_INFO("Step a"); - + } Utils.LOG_INFO("Step b"); } @@ -406,7 +253,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock //Must have at least one output hatch. if (this.mOutputHatches != null) { for (int i = 0; i < this.mOutputHatches.size(); i++) { - + if (this.mOutputHatches.get(i).mTier < 2 && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ Utils.LOG_INFO("You require at LEAST MV tier Output Hatches."); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); @@ -427,6 +274,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock } } mSolderingTool = true; + turnCasingActive(true); Utils.LOG_INFO("Multiblock Formed."); return true; } @@ -456,4 +304,115 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock return false; } + public boolean addCasingToCasingList(IGregTechTileEntity aTileEntity) { + if (aTileEntity == null) + return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) + return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock) { + return this.mCasings.add((GT_MetaTileEntity_TieredMachineBlock) aMetaTileEntity); + } + return false; + } + + public boolean turnCasingActive(boolean status) { + if (this.mCasings != null) { + Utils.LOG_INFO("Changing casing Textures."); + for (GT_MetaTileEntity_TieredMachineBlock hatch : this.mCasings) { + hatch = changeTextureswithReflection(hatch, getTextureSet()); + } + } + return true; + } + + private GT_MetaTileEntity_TieredMachineBlock changeTextureswithReflection(GT_MetaTileEntity_TieredMachineBlock casing, ITexture[][][] textureSet){ + GT_MetaTileEntity_TieredMachineBlock cv = casing; + System.out.println("Before: "+cv.mTextures.hashCode()); + //Get declared field from class + Field f; + try { + Field[] x = cv.getClass().getFields(); + for (int i =0; i<x.length;i++){ + //Utils.LOG_INFO(x[i].getName()); + } + try { + //Try get the field variable + f = cv.getClass().getField("mTextures"); + // set the accessiblity of the field to true, this will enable you to change the value + f.setAccessible(true); + //change the field value + f.set(cv, textureSet); + //Verify change in texture set + System.out.println("After: "+cv.mTextures.hashCode()); + return cv; + } catch (NoSuchFieldException e) { + Utils.LOG_INFO("Could not find mTextures."); + return casing; + } + } catch (SecurityException | IllegalArgumentException | IllegalAccessException e) { + // TODO Auto-generated catch block + //e.printStackTrace(); + return casing; + } + } + + + public ITexture[][][] getTextureSet() { + ITexture[][][] rTextures = new ITexture[10][17][]; + for (byte i = -1; i < 16; i++) { + rTextures[0][i + 1] = getFront(i); + rTextures[1][i + 1] = getBack(i); + rTextures[2][i + 1] = getBottom(i); + rTextures[3][i + 1] = getTop(i); + rTextures[4][i + 1] = getSides(i); + rTextures[5][i + 1] = getFrontActive(i); + rTextures[6][i + 1] = getBackActive(i); + rTextures[7][i + 1] = getBottomActive(i); + rTextures[8][i + 1] = getTopActive(i); + rTextures[9][i + 1] = getSidesActive(i); + } + return rTextures; + } + + public ITexture[] getFront(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]}; + } + + public ITexture[] getBack(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]}; + } + + public ITexture[] getBottom(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]}; + } + + public ITexture[] getTop(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]}; + } + + public ITexture[] getSides(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]}; + } + + public ITexture[] getFrontActive(byte aColor) { + return getFront(aColor); + } + + public ITexture[] getBackActive(byte aColor) { + return getBack(aColor); + } + + public ITexture[] getBottomActive(byte aColor) { + return getBottom(aColor); + } + + public ITexture[] getTopActive(byte aColor) { + return getTop(aColor); + } + + public ITexture[] getSidesActive(byte aColor) { + return getSides(aColor); + } + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTreeFarmerTE.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTreeFarmerTE.java new file mode 100644 index 0000000000..87e8a6bb55 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTreeFarmerTE.java @@ -0,0 +1,30 @@ +package gtPlusPlus.xmod.gregtech.registration.gregtech; + +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GregtechMetaTreeFarmerStructural; + +public class GregtechTreeFarmerTE +{ + public static void run() + { + if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ + Utils.LOG_INFO("Gregtech5u Content | Registering Tree Farmer Structural Block."); + if (CORE.configSwitches.enableMachine_Safes) run1(); + } + + } + + private static void run1() + { + + GregtechItemList.TreeFarmer_Structural.set(new GregtechMetaTreeFarmerStructural(752, "treefarmer.structural", "Farm Keeper", 0).getStackForm(1L)); + + + + + + + } +} diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_FARM_MANAGER_STRUCTURAL.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_FARM_MANAGER_STRUCTURAL.png Binary files differnew file mode 100644 index 0000000000..8a0391538b --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_FARM_MANAGER_STRUCTURAL.png |