diff options
9 files changed, 222 insertions, 96 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index 17ff73e059..7708214f0d 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -105,6 +105,7 @@ public class COMPAT_HANDLER { GregtechTieredChunkloaders.run(); GregtechIndustrialExtruder.run(); GregtechIndustrialMultiMachine.run(); + GregtechBedrockPlatforms.run(); //New Horizons Content NewHorizonsAccelerator.run(); diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java index 662f6433aa..4a1bafb251 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -20,6 +20,7 @@ import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; @@ -27,6 +28,8 @@ import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.EntityUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.sys.KeyboardUtils; +import gtPlusPlus.xmod.thaumcraft.aspect.GTPP_Aspects; +import gtPlusPlus.xmod.thaumcraft.util.ThaumcraftUtils; public class BaseItemComponent extends Item{ @@ -52,6 +55,12 @@ public class BaseItemComponent extends Item{ this.componentColour = material.getRgbAsHex(); GameRegistry.registerItem(this, this.unlocalName); GT_OreDictUnificator.registerOre(componentType.getOreDictName()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this)); + if (LoadedMods.Thaumcraft) { + ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), GTPP_Aspects.METALLUM, 1); + if (componentMaterial.isRadioactive) { + ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), GTPP_Aspects.RADIO, 2); + } + } } //For Cell Generation diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java index 6923cb545e..08517776ec 100644 --- a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java @@ -18,11 +18,14 @@ import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.EntityUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.thaumcraft.aspect.GTPP_Aspects; +import gtPlusPlus.xmod.thaumcraft.util.ThaumcraftUtils; public class BaseOreComponent extends Item{ @@ -50,6 +53,13 @@ public class BaseOreComponent extends Item{ this.componentColour = material.getRgbAsHex(); GameRegistry.registerItem(this, this.unlocalName); GT_OreDictUnificator.registerOre(componentType.getComponent()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this)); + if (LoadedMods.Thaumcraft) { + ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), GTPP_Aspects.METALLUM, 2); + if (componentMaterial.isRadioactive) { + ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), GTPP_Aspects.RADIO, 4); + } + } + } public String getCorrectTextures(){ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 2a8583acaf..962e2bca0f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -298,7 +298,10 @@ public enum GregtechItemList implements GregtechItemContainer { Industrial_Extruder, Casing_Extruder, //Multi-Machine - Industrial_MultiMachine, Casing_Multi_Use, + Industrial_MultiMachine, Casing_Multi_Use, + + //Bedrock Mining Platforms + BedrockMiner_MKI, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java index 34163a46fe..fdc957731e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java @@ -4,6 +4,9 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.enums.GT_Values; import net.minecraft.tileentity.TileEntity; import gregtech.common.blocks.GT_TileEntity_Ores; + +import gtPlusPlus.api.objects.Logger; + import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.api.enums.ItemList; import net.minecraft.entity.player.EntityPlayer; @@ -14,7 +17,6 @@ import gregtech.api.util.GT_OreDictUnificator; import net.minecraftforge.fluids.FluidStack; import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; import gregtech.api.util.GT_Recipe; -import java.util.Iterator; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import net.minecraft.init.Blocks; import gregtech.api.util.GT_Utility; @@ -35,23 +37,30 @@ import net.minecraft.item.ItemStack; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends GT_MetaTileEntity_MultiBlockBase { + + // private static final ItemStack miningPipe; private static final ItemStack miningPipeTip; private static final Block miningPipeBlock; private static final Block miningPipeTipBlock; + private final ArrayList<ChunkPosition> oreBlockPositions; + private Block casingBlock; private int casingMeta; private int frameMeta; private int casingTextureIndex; + private ForgeDirection back; + private int xDrill; private int yDrill; private int zDrill; - private int xCenter; - private int zCenter; - private int yHead; - private boolean isPickingPipes; + + private int[] xCenter = new int[5]; + private int[] zCenter = new int[5]; + private int[] yHead = new int[5]; + private boolean[] isPickingPipes = new boolean[5]; public GregtechMetaTileEntity_BedrockMiningPlatformBase(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); @@ -71,9 +80,12 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G final int frameId = 4096 + this.getFrameMaterial().mMetaItemSubID; this.frameMeta = ((GregTech_API.METATILEENTITIES[frameId] != null) ? GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() - : 32767); + : 32767); this.casingTextureIndex = this.getCasingTextureIndex(); - this.isPickingPipes = false; + + for (int g=0;g<5;g++) { + this.isPickingPipes[g] = false; + } } public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, @@ -82,7 +94,7 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[this.casingTextureIndex], new GT_RenderedTexture((IIconContainer) (aActive ? Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_ACTIVE - : Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL))}; + : Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL))}; } return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[this.casingTextureIndex]}; } @@ -95,61 +107,61 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G public void saveNBTData(final NBTTagCompound aNBT) { super.saveNBTData(aNBT); - aNBT.setBoolean("isPickingPipes", this.isPickingPipes); + + for (int g=0;g<5;g++) { + aNBT.setBoolean("isPickingPipes"+g, this.isPickingPipes[g]); + } } public void loadNBTData(final NBTTagCompound aNBT) { super.loadNBTData(aNBT); - this.isPickingPipes = aNBT.getBoolean("isPickingPipes"); + for (int g=0;g<5;g++) { + this.isPickingPipes[g] = aNBT.getBoolean("isPickingPipes"+g); + } } public boolean checkRecipe(final ItemStack aStack) { this.setElectricityStats(); - final int oldYHead = this.yHead; - if (!this.checkPipesAndSetYHead() || !this.isEnergyEnough()) { - this.stopMachine(); - return false; - } - if (this.yHead != oldYHead) { - this.oreBlockPositions.clear(); - } - if (this.isPickingPipes) { - if (this.tryPickPipe()) { - this.mOutputItems = new ItemStack[]{ - GT_Utility.copyAmount(1L, new Object[]{GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipe})}; - return true; - } - this.isPickingPipes = false; - this.stopMachine(); - return false; - } else { - this.putMiningPipesFromInputsInController(); - if (!this.tryConsumeDrillingFluid()) { + + //Do 5 times for Each Stem mining Down + for (int g=0;g<5;g++) { + + final int oldYHead = this.yHead[g]; + if (!this.checkPipesAndSetYHead() || !this.isEnergyEnough()) { + this.stopMachine(); return false; } - this.fillMineListIfEmpty(); - if (this.oreBlockPositions.isEmpty()) { - if (!this.tryLowerPipe()) { - return this.isPickingPipes = true; - } - this.fillMineListIfEmpty(); - } - ChunkPosition oreBlockPos; - Block oreBlock; - for (oreBlockPos = null, oreBlock = null; (oreBlock == null || oreBlock == Blocks.air) - && !this.oreBlockPositions.isEmpty(); oreBlock = this.getBaseMetaTileEntity() - .getBlock(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ)) { - oreBlockPos = this.oreBlockPositions.remove(0); + if (this.yHead[g] != oldYHead) { + this.oreBlockPositions.clear(); } - if (oreBlock != null && oreBlock != Blocks.air) { - final ArrayList<ItemStack> oreBlockDrops = this.getBlockDrops(oreBlock, oreBlockPos.chunkPosX, - oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); - this.getBaseMetaTileEntity().getWorld().setBlockToAir(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, - oreBlockPos.chunkPosZ); - this.mOutputItems = this.getOutputByDrops(oreBlockDrops); + if (this.isPickingPipes[g]) { + if (this.tryPickPipe()) { + this.mOutputItems = new ItemStack[]{ + GT_Utility.copyAmount(1L, new Object[]{GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipe})}; + Logger.INFO("[Bedrock Miner] Success? [0]"); + return true; + } + this.isPickingPipes[g] = false; + this.stopMachine(); + return false; + } else { + this.putMiningPipesFromInputsInController(); + /*if (!this.tryConsumeDrillingFluid()) { + return false; + }*/ + //this.fillMineListIfEmpty(); + if (this.oreBlockPositions.isEmpty()) { + Logger.INFO("[Bedrock Miner] No Stored Ores."); + if (!this.tryLowerPipe()) { + Logger.INFO("[Bedrock Miner] Fail [3]"); + return this.isPickingPipes[g] = true; + } + //this.fillMineListIfEmpty(); + } } - return true; } + //Logger.INFO("[Bedrock Miner] Success? [2]"); + return true; } private boolean isEnergyEnough() { @@ -164,15 +176,17 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G } private boolean tryPickPipe() { - if (this.yHead == this.yDrill) { - return false; - } - if (this.checkBlockAndMeta(this.xCenter, this.yHead + 1, this.zCenter, - GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeBlock, 32767)) { - this.getBaseMetaTileEntity().getWorld().setBlock(this.xCenter, this.yHead + 1, this.zCenter, - GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeTipBlock); + for (int g=0;g<5;g++) { + if (this.yHead[g] == this.yDrill) { + return false; + } + if (this.checkBlockAndMeta(this.xCenter[g], this.yHead[g] + 1, this.zCenter[g], + GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeBlock, 32767)) { + this.getBaseMetaTileEntity().getWorld().setBlock(this.xCenter[g], this.yHead[g] + 1, this.zCenter[g], + GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeTipBlock); + } + this.getBaseMetaTileEntity().getWorld().setBlockToAir(this.xCenter[g], this.yHead[g], this.zCenter[g]); } - this.getBaseMetaTileEntity().getWorld().setBlockToAir(this.xCenter, this.yHead, this.zCenter); return true; } @@ -181,7 +195,11 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G this.mEfficiencyIncrease = 10000; final int overclock = 1 << GT_Utility.getTier(this.getMaxInputVoltage()) - 1; this.mEUt = -12 * overclock * overclock; - this.mMaxProgresstime = (this.isPickingPipes ? 80 : this.getBaseProgressTime()) / overclock; + int mCombinedAvgTime = 0; + for (int g=0;g<5;g++) { + mCombinedAvgTime += (this.isPickingPipes[g] ? 80 : this.getBaseProgressTime()) / overclock; + } + this.mMaxProgresstime = mCombinedAvgTime; } private ItemStack[] getOutputByDrops(final ArrayList<ItemStack> oreBlockDrops) { @@ -216,7 +234,7 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G final ItemData itemData = GT_OreDictUnificator.getItemData(currentItem); return itemData == null || (itemData.mPrefix != OrePrefixes.crushed && itemData.mPrefix != OrePrefixes.dustImpure - && itemData.mPrefix != OrePrefixes.dust && itemData.mMaterial.mMaterial != Materials.Oilsands); + && itemData.mPrefix != OrePrefixes.dust && itemData.mMaterial.mMaterial != Materials.Oilsands); } private void multiplyStackSize(final ItemStack itemStack) { @@ -270,7 +288,7 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G } private void fillMineListIfEmpty() { - if (!this.oreBlockPositions.isEmpty()) { + /*if (!this.oreBlockPositions.isEmpty()) { return; } this.tryAddOreBlockToMineList(this.xCenter, this.yHead - 1, this.zCenter); @@ -281,7 +299,7 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G for (int zOff = -radius; zOff <= radius; ++zOff) { this.tryAddOreBlockToMineList(this.xDrill + xOff, this.yHead, this.zDrill + zOff); } - } + }*/ } private void tryAddOreBlockToMineList(final int x, final int y, final int z) { @@ -307,21 +325,28 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G private boolean tryLowerPipe() { if (!this.isHasMiningPipes()) { + Logger.INFO("[Bedrock Miner] No Pipes to Lower."); return false; } - if (this.yHead <= 0) { - return false; - } - if (this.checkBlockAndMeta(this.xCenter, this.yHead - 1, this.zCenter, Blocks.bedrock, 32767)) { - return false; - } - this.getBaseMetaTileEntity().getWorld().setBlock(this.xCenter, this.yHead - 1, this.zCenter, - GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeTipBlock); - if (this.yHead != this.yDrill) { - this.getBaseMetaTileEntity().getWorld().setBlock(this.xCenter, this.yHead, this.zCenter, - GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeBlock); + + for (int g=0;g<5;g++) { + if (this.yHead[g] <= 0) { + Logger.INFO("[Bedrock Miner] Y Head <= 0."); + return false; + } + if (this.checkBlockAndMeta(this.xCenter[g], this.yHead[g] - 1, this.zCenter[g], Blocks.bedrock, 32767)) { + Logger.INFO("[Bedrock Miner] Y Head Y+1 to bedrock."); + return false; + } + this.getBaseMetaTileEntity().getWorld().setBlock(this.xCenter[g], this.yHead[g] - 1, this.zCenter[g], + GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeTipBlock); + if (this.yHead[g] != this.yDrill) { + this.getBaseMetaTileEntity().getWorld().setBlock(this.xCenter[g], this.yHead[g], this.zCenter[g], + GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeBlock); + } + this.getBaseMetaTileEntity().decrStackSize(1, 1); + Logger.INFO("[Bedrock Miner] Lowered Pipe."); } - this.getBaseMetaTileEntity().decrStackSize(1, 1); return true; } @@ -347,6 +372,7 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G && !this.addInputToMachineList(tTileEntity, this.casingTextureIndex) && !this.addOutputToMachineList(tTileEntity, this.casingTextureIndex) && !this.addEnergyInputToMachineList(tTileEntity, this.casingTextureIndex)) { + Logger.INFO("[Bedrock Miner] Found bad block in Structure."); return false; } } @@ -354,9 +380,11 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G } if (this.mMaintenanceHatches.isEmpty() || this.mInputHatches.isEmpty() || this.mOutputBusses.isEmpty() || this.mEnergyHatches.isEmpty()) { + Logger.INFO("[Bedrock Miner] Missing Hatches/Busses."); return false; } if (GT_Utility.getTier(this.getMaxInputVoltage()) < this.getMinTier()) { + Logger.INFO("[Bedrock Miner] getMaxInputVoltage() < getMinTier()."); return false; } for (int yOff = 1; yOff < 4; ++yOff) { @@ -366,9 +394,11 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G || !this.checkFrameBlock(this.back.offsetX, yOff, this.back.offsetZ + 1) || !this.checkFrameBlock(this.back.offsetX, yOff, this.back.offsetZ - 1) || !this.checkFrameBlock(this.back.offsetX, yOff + 3, this.back.offsetZ)) { + Logger.INFO("[Bedrock Miner] Missing Frames? yOff = "+yOff); return false; } } + Logger.INFO("[Bedrock Miner] Built."); return true; } @@ -377,22 +407,40 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G this.yDrill = this.getBaseMetaTileEntity().getYCoord(); this.zDrill = this.getBaseMetaTileEntity().getZCoord(); this.back = ForgeDirection.getOrientation((int) this.getBaseMetaTileEntity().getBackFacing()); - this.xCenter = this.xDrill + this.back.offsetX; - this.zCenter = this.zDrill + this.back.offsetZ; + + //Middle + this.xCenter[0] = this.xDrill + this.back.offsetX; + this.zCenter[0] = this.zDrill + this.back.offsetZ; + + this.xCenter[1] = (this.xDrill + this.back.offsetX) + 1; + this.zCenter[1] = this.zDrill + this.back.offsetZ; + + this.xCenter[2] = (this.xDrill + this.back.offsetX) - 1; + this.zCenter[2] = this.zDrill + this.back.offsetZ; + + this.xCenter[3] = this.xDrill + this.back.offsetX; + this.zCenter[3] = (this.zDrill + this.back.offsetZ) + 1; + + this.xCenter[4] = this.xDrill + this.back.offsetX; + this.zCenter[4] = (this.zDrill + this.back.offsetZ) - 1; + } private boolean checkPipesAndSetYHead() { - this.yHead = this.yDrill - 1; - while (this.checkBlockAndMeta(this.xCenter, this.yHead, this.zCenter, - GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeBlock, 32767)) { - --this.yHead; - } - if (this.checkBlockAndMeta(this.xCenter, this.yHead, this.zCenter, - GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeTipBlock, 32767) || ++this.yHead == this.yDrill) { - return true; + for (int g=0;g<5;g++) { + this.yHead[g] = this.yDrill - 1; + while (this.checkBlockAndMeta(this.xCenter[g], this.yHead[g], this.zCenter[g], + GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeBlock, 32767)) { + --this.yHead[g]; + } + if (this.checkBlockAndMeta(this.xCenter[g], this.yHead[g], this.zCenter[g], + GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeTipBlock, 32767) || ++this.yHead[g] == this.yDrill) { + return true; + } + this.getBaseMetaTileEntity().getWorld().setBlock(this.xCenter[g], this.yHead[g], this.zCenter[g], + GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeTipBlock); + } - this.getBaseMetaTileEntity().getWorld().setBlock(this.xCenter, this.yHead, this.zCenter, - GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeTipBlock); return true; } @@ -448,7 +496,7 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G protected String[] getDescriptionInternal(final String tierSuffix) { final String casings = this.getCasingBlockItem().get(0L, new Object[0]).getDisplayName(); - return new String[]{"Controller Block for the Ore Drilling Plant " + ((tierSuffix != null) ? tierSuffix : ""), + return new String[]{"Controller Block for the Experimental Deep Earth Drilling Platform - MK " + ((tierSuffix != null) ? tierSuffix : ""), "Size(WxHxD): 3x7x3, Controller (Front middle bottom)", "3x1x3 Base of " + casings, "1x3x1 " + casings + " pillar (Center of base)", "1x3x1 " + this.getFrameMaterial().mName + " Frame Boxes (Each pillar side and on top)", diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechBedrockPlatforms.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechBedrockPlatforms.java new file mode 100644 index 0000000000..c4f2a058f3 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechBedrockPlatforms.java @@ -0,0 +1,16 @@ +package gtPlusPlus.xmod.gregtech.registration.gregtech; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.bedrock.GregtechMetaTileEntity_BedrockMiningPlatform1; + +public class GregtechBedrockPlatforms { + + //941-945 + + public static void run() { + Logger.INFO("Gregtech5u Content | Registering Bedrock Mining Platform."); + GregtechItemList.BedrockMiner_MKI.set(new GregtechMetaTileEntity_BedrockMiningPlatform1(941, "multimachine.tier.01.bedrockminer", "Experimental Deep Earth Drilling Platform - MK I").getStackForm(1)); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/HANDLER_Thaumcraft.java b/src/Java/gtPlusPlus/xmod/thaumcraft/HANDLER_Thaumcraft.java index c9133902e3..529d9349d9 100644 --- a/src/Java/gtPlusPlus/xmod/thaumcraft/HANDLER_Thaumcraft.java +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/HANDLER_Thaumcraft.java @@ -10,6 +10,7 @@ import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gregtech.api.interfaces.internal.IThaumcraftCompat; import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.core.lib.LoadedMods; @@ -44,7 +45,12 @@ public class HANDLER_Thaumcraft { for (Pair<ItemStack, TC_AspectStack_Ex[]> j : sItemsToGetAspects) { if (j .getKey() != null && (j.getValue() != null && j.getValue().length > 0)) { List<TC_AspectStack_Ex> list = Arrays.asList(j.getValue()); - ThaumcraftUtils.registerThaumcraftAspectsToItem(j.getKey(), list, true); + if (ThaumcraftUtils.registerThaumcraftAspectsToItem(j.getKey(), list, true)) { + Logger.INFO("[Aspect] Successfully added Aspects to "+j.getKey().getDisplayName()+"."); + } + else { + Logger.INFO("[Aspect] Failed adding Aspects to "+j.getKey().getDisplayName()+"."); + } } } } diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/aspect/GTPP_AspectCompat.java b/src/Java/gtPlusPlus/xmod/thaumcraft/aspect/GTPP_AspectCompat.java index 34fa657bd7..e3aeed75bd 100644 --- a/src/Java/gtPlusPlus/xmod/thaumcraft/aspect/GTPP_AspectCompat.java +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/aspect/GTPP_AspectCompat.java @@ -2,6 +2,7 @@ package gtPlusPlus.xmod.thaumcraft.aspect; import gregtech.common.GT_ThaumcraftCompat; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.thaumcraft.aspect.GTPP_Aspects.TC_AspectStack_Ex; import gtPlusPlus.xmod.thaumcraft.util.ThaumcraftUtils; @@ -20,7 +21,7 @@ import net.minecraft.util.ResourceLocation; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; -public class GTPP_AspectCompat implements IThaumcraftCompat { +public class GTPP_AspectCompat implements IThaumcraftCompat { public static volatile Method m = null; @@ -99,7 +100,7 @@ public class GTPP_AspectCompat implements IThaumcraftCompat { GT_LanguageManager.addStringLocalization("tc.aspect.custom5", "Heaven"); } - public static synchronized final AspectList getAspectList_Ex(final List<TC_AspectStack_Ex> aAspects) { + public static synchronized final AspectList getAspectList(final List<TC_AspectStack_Ex> aAspects) { AspectList o = null; try { if (m == null || (m != null && !m.isAccessible())) { @@ -110,9 +111,22 @@ public class GTPP_AspectCompat implements IThaumcraftCompat { o = (AspectList) m.invoke(null, aAspects); } } - catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {} + catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + e.printStackTrace(); + } + if (o == null) { + Logger.REFLECTION("[Aspect] Did not retrieve valid aspect list from reflective invocation."); + } return o; } + + public static synchronized final AspectList getAspectList_Ex(final List<TC_AspectStack_Ex> aAspects) { + final AspectList rAspects = new AspectList(); + for (final TC_AspectStack_Ex tAspect : aAspects) { + rAspects.add((Aspect) tAspect.mAspect.mAspect, (int) tAspect.mAmount); + } + return rAspects; + } @Override public boolean registerPortholeBlacklistedBlock(Block p0) { diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java index baace5257c..9f6af00de0 100644 --- a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java @@ -1,5 +1,6 @@ package gtPlusPlus.xmod.thaumcraft.util; +import static gtPlusPlus.xmod.thaumcraft.HANDLER_Thaumcraft.sItemsToGetAspects; import static gtPlusPlus.xmod.thaumcraft.aspect.GTPP_AspectCompat.getAspectList_Ex; import java.util.*; @@ -14,8 +15,8 @@ import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.xmod.thaumcraft.HANDLER_Thaumcraft; import gtPlusPlus.xmod.thaumcraft.aspect.GTPP_Aspects; import gtPlusPlus.xmod.thaumcraft.aspect.GTPP_Aspects.TC_AspectStack_Ex; import thaumcraft.api.ThaumcraftApi; @@ -48,8 +49,15 @@ public class ThaumcraftUtils { } } Pair<ItemStack, TC_AspectStack_Ex[]> k = new Pair<ItemStack, TC_AspectStack_Ex[]>(item, aspects); - HANDLER_Thaumcraft.sItemsToGetAspects.put(k); - return true; + int mSizeA = sItemsToGetAspects.size(); + sItemsToGetAspects.put(k); + if (sItemsToGetAspects.size() > mSizeA) { + Logger.INFO("[Aspect] Successfully queued an ItemStack for Aspect addition."); + return true; + } + Logger.INFO("[Aspect] Failed to queue an ItemStack for Aspect addition."); + //Logger.INFO("[Aspect] "); + return false; } @@ -181,18 +189,29 @@ public class ThaumcraftUtils { public static boolean registerThaumcraftAspectsToItem(final ItemStack aStack, final List<TC_AspectStack_Ex> aAspects, final boolean aAdditive) { + try { if (aAspects.isEmpty()) { return false; } - if (aAdditive) { + AspectList h = getAspectList_Ex(aAspects); + if (aAdditive && (h != null && h.size() > 0)) { ThaumcraftApi.registerComplexObjectTag(aStack, getAspectList_Ex(aAspects)); return true; } + else { + Logger.INFO("[Aspect] Failed adding aspects to "+aStack.getDisplayName()+"."); + } final AspectList tAlreadyRegisteredAspects = ThaumcraftApiHelper.getObjectAspects(aStack); if (tAlreadyRegisteredAspects == null || tAlreadyRegisteredAspects.size() <= 0) { ThaumcraftApi.registerObjectTag(aStack, getAspectList_Ex(aAspects)); } return true; + } + catch (Throwable t) { + Logger.INFO("[Aspect] Failed adding aspects to "+aStack.getDisplayName()+"."); + t.printStackTrace(); + return false; + } } public static boolean registerPortholeBlacklistedBlock(final Block aBlock) { |