diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod')
13 files changed, 900 insertions, 202 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java index 8c0c47bea2..2832941bdd 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java @@ -23,7 +23,7 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch super.onConfigLoad(aConfig); if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK || CORE.GTNH) { try { - Integer a1 = (int) StaticFields59.getFieldFromGregtechProxy(false, "mPollutionSmogLimit"); + Integer a1 = (int) StaticFields59.getFieldFromGregtechProxy("mPollutionSmogLimit"); if (a1 != null && a1 > 0) { mPollutionSmogLimit = a1; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java index 929dee22e4..8a29dc5db2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java @@ -1,10 +1,6 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.fluids.FluidStack; -import gregtech.GT_Mod; import gregtech.api.enums.Dyes; -import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.SubTag; import gregtech.api.interfaces.ITexture; @@ -12,10 +8,9 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid; import gregtech.api.objects.GT_RenderedTexture; - -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.common.StaticFields59; +import net.minecraft.util.EnumChatFormatting; public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid { @@ -23,7 +18,7 @@ public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid { public static final boolean mGt6Pipe; static { - Boolean aGt6 = (Boolean) StaticFields59.getFieldFromGregtechProxy(false, "gt6Pipe"); + Boolean aGt6 = (Boolean) StaticFields59.getFieldFromGregtechProxy("gt6Pipe"); if (aGt6 != null) { mGt6Pipe = aGt6; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java index 7505c2a808..77f3a31020 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -32,6 +32,7 @@ import gtPlusPlus.api.objects.minecraft.FormattedTooltipString; import gtPlusPlus.core.handler.AchievementHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity; @@ -91,8 +92,10 @@ public class Meta_GT_Proxy { throw new RuntimeException(""); } - //Gotta set it here so that we don't try call gregtech too early. - StaticFields59.mGT6StylePipes = (boolean) StaticFields59.getFieldFromGregtechProxy(true, "gt6Pipe"); + //Gotta set it here so that we don't try call gregtech too early. + //Must set on the correct side + StaticFields59.mGT6StylePipes = (boolean) StaticFields59.getFieldFromGregtechProxy("gt6Pipe"); + GT_Log.out.println("GT++ Mod: Registering the BaseMetaTileEntity."); GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntity_GTPP"); @@ -376,7 +379,7 @@ public class Meta_GT_Proxy { * @deprecated Use {@link StaticFields59#getFieldFromGregtechProxy(boolean,String)} instead */ public static Object getFieldFromGregtechProxy(boolean client, String fieldName) { - return StaticFields59.getFieldFromGregtechProxy(client, fieldName); + return StaticFields59.getFieldFromGregtechProxy(fieldName); } public void setCustomGregtechTooltip(String aNbtTagName, FormattedTooltipString aData) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java index 2a3fd5e77c..99563b60ef 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java @@ -22,6 +22,7 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.common.GT_Proxy; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.reflect.ProxyFinder; import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.block.Block; @@ -183,6 +184,11 @@ public class StaticFields59 { return null; } + + public static Object getFieldFromGregtechProxy(String fieldName) { + return getFieldFromGregtechProxy(Utils.isServer() ? false : true, fieldName); + } + public static Object getFieldFromGregtechProxy(boolean client, String fieldName) { Object proxyGT; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java index 3c60ae664e..624058f356 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java @@ -320,7 +320,7 @@ public class TreeFarmHelper { if(blockHumus != null){ return blockHumus; } - else if (ReflectionUtils.doesClassExist("forestry.core.blocks.BlockSoil")){ + else if (isHumusLoaded){ final Class<?> humusClass = ReflectionUtils.getClass("forestry.core.blocks.BlockSoil"); final ItemStack humusStack = ItemUtils.getCorrectStacktype("Forestry:soil", 1); if (humusClass != null){ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java new file mode 100644 index 0000000000..7437bf19da --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java @@ -0,0 +1,295 @@ +package gtPlusPlus.xmod.gregtech.common.helpers.treefarm; + +import java.util.Random; + +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.block.Block; +import net.minecraft.block.BlockSapling; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Direction; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraftforge.common.util.ForgeDirection; + +public class TreeGenerator { + + public static AutoMap<ItemStack> generateOutput(int aTreeSize){ + AutoMap<ItemStack> aOutputMap = new AutoMap<ItemStack>(); + + + return aOutputMap; + } + + public class FakeWorldGenerator extends WorldGenAbstractTree + { + /** The minimum height of a generated tree. */ + private final int minTreeHeight; + /** True if this tree should grow Vines. */ + private final boolean vinesGrow; + /** The metadata value of the wood to use in tree generation. */ + private final int metaWood; + /** The metadata value of the leaves to use in tree generation. */ + private final int metaLeaves; + + private boolean hasGenerated = false; + private AutoMap<ItemStack> aOutputsFromGenerator = new AutoMap<ItemStack>(); + + public FakeWorldGenerator() + { + this(4, 0, 0, false); + } + + public FakeWorldGenerator(int aMinHeight, int aWoodMeta, int aLeafMeta, boolean aVines) + { + super(false); + this.minTreeHeight = aMinHeight; + this.metaWood = aWoodMeta; + this.metaLeaves = aLeafMeta; + this.vinesGrow = aVines; + } + + + public AutoMap<ItemStack> getOutputFromTree(){ + if (!hasGenerated) { + generate(null, CORE.RANDOM, 0, 0, 0); + } + return aOutputsFromGenerator; + } + + + @Override + public boolean generate(World aWorld, Random aRand, int aWorldX, int aWorldRealY, int aWorldZ){ + + //Only Generate Once - This object is Cached + if (hasGenerated) { + return hasGenerated; + } + + //Set some static values + + //Dummy Value + int aWorldY = 10; + + int l = CORE.RANDOM.nextInt(3) + this.minTreeHeight; + boolean flag = true; + + if (aWorldY >= 1 && aWorldY + l + 1 <= 256) + { + byte b0; + int k1; + Block block; + + for (int i1 = aWorldY; i1 <= aWorldY + 1 + l; ++i1) + { + b0 = 1; + + if (i1 == aWorldY) + { + b0 = 0; + } + + if (i1 >= aWorldY + 1 + l - 2) + { + b0 = 2; + } + + for (int j1 = aWorldX - b0; j1 <= aWorldX + b0 && flag; ++j1) + { + for (k1 = aWorldZ - b0; k1 <= aWorldZ + b0 && flag; ++k1) + { + if (i1 >= 0 && i1 < 256) + { + block = aWorld.getBlock(j1, i1, k1); + + if (!this.isReplaceable(aWorld, j1, i1, k1)) + { + flag = false; + } + } + else + { + flag = false; + } + } + } + } + + if (!flag) + { + return false; + } + else + { + Block block2 = aWorld.getBlock(aWorldX, aWorldY - 1, aWorldZ); + + boolean isSoil = block2.canSustainPlant(aWorld, aWorldX, aWorldY - 1, aWorldZ, ForgeDirection.UP, (BlockSapling)Blocks.sapling); + if (isSoil && aWorldY < 256 - l - 1) + { + block2.onPlantGrow(aWorld, aWorldX, aWorldY - 1, aWorldZ, aWorldX, aWorldY, aWorldZ); + b0 = 3; + byte b1 = 0; + int l1; + int i2; + int j2; + int i3; + + for (k1 = aWorldY - b0 + l; k1 <= aWorldY + l; ++k1) + { + i3 = k1 - (aWorldY + l); + l1 = b1 + 1 - i3 / 2; + + for (i2 = aWorldX - l1; i2 <= aWorldX + l1; ++i2) + { + j2 = i2 - aWorldX; + + for (int k2 = aWorldZ - l1; k2 <= aWorldZ + l1; ++k2) + { + int l2 = k2 - aWorldZ; + + if (Math.abs(j2) != l1 || Math.abs(l2) != l1 || CORE.RANDOM.nextInt(2) != 0 && i3 != 0) + { + Block block1 = aWorld.getBlock(i2, k1, k2); + + if (block1.isAir(aWorld, i2, k1, k2) || block1.isLeaves(aWorld, i2, k1, k2)) + { + this.setBlockAndNotifyAdequately(aWorld, i2, k1, k2, Blocks.leaves, this.metaLeaves); + } + } + } + } + } + + for (k1 = 0; k1 < l; ++k1) + { + block = aWorld.getBlock(aWorldX, aWorldY + k1, aWorldZ); + + if (block.isAir(aWorld, aWorldX, aWorldY + k1, aWorldZ) || block.isLeaves(aWorld, aWorldX, aWorldY + k1, aWorldZ)) + { + this.setBlockAndNotifyAdequately(aWorld, aWorldX, aWorldY + k1, aWorldZ, Blocks.log, this.metaWood); + + if (this.vinesGrow && k1 > 0) + { + if (CORE.RANDOM.nextInt(3) > 0 && aWorld.isAirBlock(aWorldX - 1, aWorldY + k1, aWorldZ)) + { + this.setBlockAndNotifyAdequately(aWorld, aWorldX - 1, aWorldY + k1, aWorldZ, Blocks.vine, 8); + } + + if (CORE.RANDOM.nextInt(3) > 0 && aWorld.isAirBlock(aWorldX + 1, aWorldY + k1, aWorldZ)) + { + this.setBlockAndNotifyAdequately(aWorld, aWorldX + 1, aWorldY + k1, aWorldZ, Blocks.vine, 2); + } + + if (CORE.RANDOM.nextInt(3) > 0 && aWorld.isAirBlock(aWorldX, aWorldY + k1, aWorldZ - 1)) + { + this.setBlockAndNotifyAdequately(aWorld, aWorldX, aWorldY + k1, aWorldZ - 1, Blocks.vine, 1); + } + + if (CORE.RANDOM.nextInt(3) > 0 && aWorld.isAirBlock(aWorldX, aWorldY + k1, aWorldZ + 1)) + { + this.setBlockAndNotifyAdequately(aWorld, aWorldX, aWorldY + k1, aWorldZ + 1, Blocks.vine, 4); + } + } + } + } + + if (this.vinesGrow) + { + for (k1 = aWorldY - 3 + l; k1 <= aWorldY + l; ++k1) + { + i3 = k1 - (aWorldY + l); + l1 = 2 - i3 / 2; + + for (i2 = aWorldX - l1; i2 <= aWorldX + l1; ++i2) + { + for (j2 = aWorldZ - l1; j2 <= aWorldZ + l1; ++j2) + { + if (aWorld.getBlock(i2, k1, j2).isLeaves(aWorld, i2, k1, j2)) + { + if (CORE.RANDOM.nextInt(4) == 0 && aWorld.getBlock(i2 - 1, k1, j2).isAir(aWorld, i2 - 1, k1, j2)) + { + this.growVines(aWorld, i2 - 1, k1, j2, 8); + } + + if (CORE.RANDOM.nextInt(4) == 0 && aWorld.getBlock(i2 + 1, k1, j2).isAir(aWorld, i2 + 1, k1, j2)) + { + this.growVines(aWorld, i2 + 1, k1, j2, 2); + } + + if (CORE.RANDOM.nextInt(4) == 0 && aWorld.getBlock(i2, k1, j2 - 1).isAir(aWorld, i2, k1, j2 - 1)) + { + this.growVines(aWorld, i2, k1, j2 - 1, 1); + } + + if (CORE.RANDOM.nextInt(4) == 0 && aWorld.getBlock(i2, k1, j2 + 1).isAir(aWorld, i2, k1, j2 + 1)) + { + this.growVines(aWorld, i2, k1, j2 + 1, 4); + } + } + } + } + } + + if (CORE.RANDOM.nextInt(5) == 0 && l > 5) + { + for (k1 = 0; k1 < 2; ++k1) + { + for (i3 = 0; i3 < 4; ++i3) + { + if (CORE.RANDOM.nextInt(4 - k1) == 0) + { + l1 = CORE.RANDOM.nextInt(3); + this.setBlockAndNotifyAdequately(aWorld, aWorldX + Direction.offsetX[Direction.rotateOpposite[i3]], aWorldY + l - 5 + k1, aWorldZ + Direction.offsetZ[Direction.rotateOpposite[i3]], Blocks.cocoa, l1 << 2 | i3); + } + } + } + } + } + + hasGenerated = true; + return true; + } + else + { + return false; + } + } + } + else + { + return false; + } + } + + /** + * Grows vines downward from the given block for a given length. Args: World, x, starty, z, vine-length + */ + private void growVines(World aWorld, int aX, int aY, int aZ, int aMeta) + { + this.setBlockAndNotifyAdequately(aWorld, aX, aY, aZ, Blocks.vine, aMeta); + int i1 = 4; + + while (true) + { + --aY; + + if (!aWorld.getBlock(aX, aY, aZ).isAir(aWorld, aX, aY, aZ) || i1 <= 0) + { + return; + } + + this.setBlockAndNotifyAdequately(aWorld, aX, aY, aZ, Blocks.vine, aMeta); + --i1; + } + } + + @Override + protected void setBlockAndNotifyAdequately(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMeta) { + + super.setBlockAndNotifyAdequately(aWorld, aX, aY, aZ, aBlock, aMeta); + } + } + + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java index c74a31055d..f82e0e5cb0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java @@ -10,6 +10,9 @@ import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.util.GT_LanguageManager; import gregtech.common.items.behaviors.Behaviour_None; import gregtech.common.items.behaviors.Behaviour_Wrench; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.NBTUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; public class Behaviour_Choocher extends Behaviour_None { @@ -30,30 +33,47 @@ extends Behaviour_None { if (aWorld.isRemote) { return false; } + + boolean inWrenchMode; + if (NBTUtils.hasKey(aStack, "aMode")) { + inWrenchMode = NBTUtils.getBoolean(aStack, "aMode"); + } + else { + aStack.getTagCompound().setBoolean("aMode", true); + inWrenchMode = true; + } + if (aPlayer.isSneaking()){ - if (this.isWrench){ - this.isWrench = false; - return false; - } - this.isWrench = true; - return false; + boolean aModeNew = Utils.invertBoolean(inWrenchMode); + aStack.getTagCompound().setBoolean("aMode", aModeNew); + PlayerUtils.messagePlayer(aPlayer, "Mode: "+(aModeNew ? "Wrench" : "Hammer")); + return true; } - else if (!aPlayer.isSneaking()){ - if (this.isWrench){ - this.wrench.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aSide, aSide, aSide, aSide, hitZ, hitZ, hitZ); - return false; + else { + if (inWrenchMode){ + return this.wrench.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aSide, aSide, aSide, aSide, hitZ, hitZ, hitZ); + } + else { + return this.prospecting.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ); } - this.prospecting.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ); - return false; } - return false; } @Override public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList, final ItemStack aStack) { + boolean inWrenchMode; + if (NBTUtils.hasKey(aStack, "aMode")) { + inWrenchMode = NBTUtils.getBoolean(aStack, "aMode"); + } + else { + NBTUtils.setBoolean(aStack, "aMode", true); + aStack.getTagCompound().setBoolean("aMode", true); + inWrenchMode = true; + } + - if (this.isWrench){ + if (inWrenchMode){ aList.add(this.mTooltip1+"Wrench"); aList.add(this.mTooltipW); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java index 278b556733..64676fa907 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java @@ -7,9 +7,15 @@ import gregtech.api.GregTech_API; import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Utility; -import gregtech.api.util.GT_Utility.ItemNBT; import gregtech.common.items.behaviors.Behaviour_None; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.entity.projectile.EntityLightningAttack; +import gtPlusPlus.core.entity.projectile.EntityThrowableBomb; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.NBTUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import ic2.api.item.IElectricItemManager; @@ -19,15 +25,12 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class Behaviour_Electric_Lighter extends Behaviour_None { - private final ItemStack mLighter; - - private final long mFuelAmount; - private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.lighter.tooltip", "Can light things on Fire"); private final String mTooltipUses = GT_LanguageManager.addStringLocalization("gt.behaviour.lighter.uses", @@ -35,9 +38,8 @@ public class Behaviour_Electric_Lighter extends Behaviour_None { private final String mTooltipUnstackable = GT_LanguageManager.addStringLocalization("gt.behaviour.unstackable", "Not usable when stacked!"); - public Behaviour_Electric_Lighter(ItemStack aFullLighter, long aFuelAmount) { - this.mLighter = aFullLighter; - this.mFuelAmount = aFuelAmount; + public Behaviour_Electric_Lighter() { + } public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) { @@ -60,30 +62,97 @@ public class Behaviour_Electric_Lighter extends Behaviour_None { public boolean onItemUse(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + if (!aWorld.isRemote && aStack.stackSize == 1) { + if (aPlayer.isSneaking()) { + Logger.INFO("Changing Mode"); + boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); + Logger.INFO("Is currently in Fireball mode? "+aCurrentMode); + boolean aNewMode = Utils.invertBoolean(aCurrentMode); + Logger.INFO("Is now set to Fireball mode? "+aNewMode); + aStack.getTagCompound().setBoolean("aFireballMod", aNewMode); + //NBTUtils.setBoolean(aStack, "aFireballMode", aNewMode); + PlayerUtils.messagePlayer(aPlayer, "Current Mode: "+EnumChatFormatting.RED+(aNewMode ? "Projectile" : "Fire Starter")); + } + else { + boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); + if (aCurrentMode) { + //Shoot Lightning Attack + aWorld.playSoundAtEntity(aPlayer, "random.bow", 0.5F, 0.4F / (CORE.RANDOM.nextFloat() * 0.4F + 0.8F)); + if (!aWorld.isRemote) { + aWorld.spawnEntityInWorld(new EntityLightningAttack(aWorld, aPlayer, hitX, hitY, hitZ)); + } + } + else { + //Lights Fires Mode + Logger.WARNING("Preparing Lighter a"); + boolean rOutput = false; + ForgeDirection tDirection = ForgeDirection.getOrientation(aSide); + aX += tDirection.offsetX; + aY += tDirection.offsetY; + aZ += tDirection.offsetZ; + if (GT_Utility.isBlockAir(aWorld, aX, aY, aZ) && aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack)) { + Logger.WARNING("Preparing Lighter b"); + if (this.prepare(aStack) || aPlayer.capabilities.isCreativeMode) { + Logger.WARNING("Preparing Lighter c"); + GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(6), 1.0F, 1.0F, aX, aY, + aZ); + aWorld.setBlock(aX, aY, aZ, Blocks.fire); + rOutput = true; + // ItemNBT.setLighterFuel(aStack, tFuelAmount); + return rOutput; + } + } + } + } + } + Logger.WARNING("Preparing Lighter z"); return false; } public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - if (!aWorld.isRemote && aStack.stackSize == 1) { - Logger.WARNING("Preparing Lighter a"); - boolean rOutput = false; - ForgeDirection tDirection = ForgeDirection.getOrientation(aSide); - aX += tDirection.offsetX; - aY += tDirection.offsetY; - aZ += tDirection.offsetZ; - if (GT_Utility.isBlockAir(aWorld, aX, aY, aZ) && aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack)) { - Logger.WARNING("Preparing Lighter b"); - if (this.prepare(aStack) || aPlayer.capabilities.isCreativeMode) { - Logger.WARNING("Preparing Lighter c"); - GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(6), 1.0F, 1.0F, aX, aY, - aZ); - aWorld.setBlock(aX, aY, aZ, Blocks.fire); - rOutput = true; - // ItemNBT.setLighterFuel(aStack, tFuelAmount); - return rOutput; - } + if (!aWorld.isRemote && aStack.stackSize == 1) { + if (aPlayer.isSneaking()) { + Logger.INFO("Changing Mode"); + boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); + Logger.INFO("Is currently in Fireball mode? "+aCurrentMode); + boolean aNewMode = Utils.invertBoolean(aCurrentMode); + Logger.INFO("Is now set to Fireball mode? "+aNewMode); + aStack.getTagCompound().setBoolean("aFireballMod", aNewMode); + //NBTUtils.setBoolean(aStack, "aFireballMode", aNewMode); + PlayerUtils.messagePlayer(aPlayer, "Current Mode: "+EnumChatFormatting.RED+(aNewMode ? "Projectile" : "Fire Starter")); } + else { + boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); + if (aCurrentMode) { + //Shoot Lightning Attack + aWorld.playSoundAtEntity(aPlayer, "random.bow", 0.5F, 0.4F / (CORE.RANDOM.nextFloat() * 0.4F + 0.8F)); + if (!aWorld.isRemote) { + aWorld.spawnEntityInWorld(new EntityLightningAttack(aWorld, aPlayer, hitX, hitY, hitZ)); + } + } + else { + //Lights Fires Mode + Logger.WARNING("Preparing Lighter a"); + boolean rOutput = false; + ForgeDirection tDirection = ForgeDirection.getOrientation(aSide); + aX += tDirection.offsetX; + aY += tDirection.offsetY; + aZ += tDirection.offsetZ; + if (GT_Utility.isBlockAir(aWorld, aX, aY, aZ) && aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack)) { + Logger.WARNING("Preparing Lighter b"); + if (this.prepare(aStack) || aPlayer.capabilities.isCreativeMode) { + Logger.WARNING("Preparing Lighter c"); + GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(6), 1.0F, 1.0F, aX, aY, + aZ); + aWorld.setBlock(aX, aY, aZ, Blocks.fire); + rOutput = true; + // ItemNBT.setLighterFuel(aStack, tFuelAmount); + return rOutput; + } + } + } + } } Logger.WARNING("Preparing Lighter z"); return false; @@ -138,6 +207,17 @@ public class Behaviour_Electric_Lighter extends Behaviour_None { NBTTagCompound tNBT = aStack.getTagCompound(); aList.add(this.mTooltipUses + " " + aUses); aList.add(this.mTooltipUnstackable); + + + boolean aCurrentMode; + if (NBTUtils.hasKey(aStack, "aFireballMode")) { + aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); + } + else { + aStack.getTagCompound().setBoolean("aFireballMod", false); + aCurrentMode = false; + } + aList.add("Current Mode: "+EnumChatFormatting.RED+(aCurrentMode ? "Projectile" : "Fire Starter")); return aList; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java index 9ac67cf874..fb4884e278 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java @@ -3,14 +3,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.b import java.util.ArrayList; import java.util.HashMap; -import net.minecraft.block.Block; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.ChunkPosition; - +import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -22,16 +15,28 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockB import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; - +import gregtech.common.GT_Worldgen_GT_Ore_Layer; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.api.objects.minecraft.BlockPos; import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.ORES; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.MiningUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.ChunkPosition; import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.oredict.OreDictionary; public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends GT_MetaTileEntity_MultiBlockBase { @@ -41,7 +46,7 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G private static final Block miningPipeTipBlock; private final ArrayList<ChunkPosition> oreBlockPositions; - protected double mProductionModifier = 100; + protected double mProductionModifier = 0; private Block casingBlock; private int casingMeta; @@ -113,70 +118,46 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G public void saveNBTData(final NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setDouble("mProductionModifier", mProductionModifier); - for (int g = 0; g < 5; g++) { - aNBT.setBoolean("isPickingPipes" + g, this.isPickingPipes[g]); - } } public void loadNBTData(final NBTTagCompound aNBT) { super.loadNBTData(aNBT); this.mProductionModifier = aNBT.getDouble("mProductionModifier"); - for (int g = 0; g < 5; g++) { - this.isPickingPipes[g] = aNBT.getBoolean("isPickingPipes" + g); - } } public boolean checkRecipe(final ItemStack aStack) { - this.setElectricityStats(); + //this.setElectricityStats(); boolean[] didWork = new boolean[5]; - - final int oldYHead = this.yHead[0]; - if (!this.checkPipesAndSetYHead() || !this.isEnergyEnough()) { - this.stopMachine(); + + if (!this.tryConsumeDrillingFluid()) { + Logger.INFO("No drilling Fluid."); return false; } - if (this.yHead[0] != oldYHead) { - this.oreBlockPositions.clear(); + + if (MathUtils.isNumberEven((int) this.mProductionModifier)) { + if (!this.tryConsumePyrotheum()) { + Logger.INFO("No tryConsumePyrotheum Fluid."); + return false; + } + else { + mProductionModifier++; + } } - - for (int g = 0; g < 5; g++) { - if (this.isPickingPipes[g]) { - if (this.tryPickPipe(g)) { - this.mOutputItems = new ItemStack[] { GT_Utility.copyAmount(1L, - new Object[] { GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipe }) }; - didWork[g] = true; - continue; - } - this.isPickingPipes[g] = false; - this.stopMachine(); - didWork[g] = false; + else { + if (!this.tryConsumeCryotheum()) { + Logger.INFO("No tryConsumeCryotheum Fluid."); + return false; } else { - this.putMiningPipesFromInputsInController(); - - if (!this.tryConsumeDrillingFluid()) { - return false; - } - - if (this.oreBlockPositions.isEmpty()) { - // Hit bedrock Either retract pipe or Dig! - if (!this.tryLowerPipe(g)) { - // Mining Head is too high, we best retract. - if (!mMiningHeads.isEmpty() && mMiningHeads.containsKey(g) && mMiningHeads.get(g).yPos >= 6) { - for (int r = 0; r < 5; r++) { - this.isPickingPipes[r] = true; - } - didWork[g] = this.isPickingPipes[g]; - } - // Full Power! - else { - didWork[g] = true; - } - } - } + mProductionModifier++; } } + + for (int i = 0; i < 5; i++) { + process(); + didWork[i] = true; + } // Fail recipe handling if one pipe didn't handle properly, to try again // next run. @@ -186,7 +167,11 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G return false; } } - // Logger.INFO("[Bedrock Miner] Success? [x]"); + + this.mEUt = 8000; + this.mMaxProgresstime = 1; + this.mEfficiencyIncrease = 10000; + return true; } @@ -228,13 +213,15 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G private void setElectricityStats() { //this.mEfficiency = this.getCurrentEfficiency((ItemStack) null); this.mEfficiencyIncrease = 10000; - final int overclock = 1 << GT_Utility.getTier(this.getMaxInputVoltage()) - 1; - this.mEUt = -12 * overclock * overclock; + final int overclock = 8 << GT_Utility.getTier(this.getMaxInputVoltage()); + //this.mEUt = -12 * overclock * overclock; + Logger.INFO("Trying to set EU to "+(12 * overclock * overclock)); int mCombinedAvgTime = 0; for (int g = 0; g < 5; g++) { mCombinedAvgTime += (this.isPickingPipes[g] ? 80 : this.getBaseProgressTime()) / overclock; } - this.mMaxProgresstime = (mCombinedAvgTime / 5); + Logger.INFO("Trying to set Max Time to "+(mCombinedAvgTime)); + //this.mMaxProgresstime = (mCombinedAvgTime / 5); } /* @@ -282,16 +269,16 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G boolean g = (this.getBaseMetaTileEntity().getWorld().getTotalWorldTime() % 2 == 0); consumed = (g ? tryConsumePyrotheum() : tryConsumeCryotheum()); if (consumed) { - increaseProduction(g ? 2 : 1); + //increaseProduction(g ? 2 : 1); } else { - lowerProduction(g ? 5 : 3); + //lowerProduction(g ? 5 : 3); } return consumed; } private boolean tryConsumePyrotheum() { - return this.depleteInput(FluidUtils.getFluidStack("pyrotheum", 2)); + return this.depleteInput(FluidUtils.getFluidStack("pyrotheum", 4)); } private boolean tryConsumeCryotheum() { @@ -382,11 +369,11 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G } boolean didWork[] = new boolean[3]; - if (this.checkBlockAndMeta(this.xCenter[pipe], this.yHead[pipe] - 1, this.zCenter[pipe], Blocks.bedrock, + /*if (this.checkBlockAndMeta(this.xCenter[pipe], this.yHead[pipe] - 1, this.zCenter[pipe], Blocks.bedrock, 32767)) { // Logger.INFO("[Bedrock Miner] Pipe "+pipe+" is at Bedrock."); return false; - } + }*/ didWork[0] = this.getBaseMetaTileEntity().getWorld().setBlock(this.xCenter[pipe], this.yHead[pipe] - 1, this.zCenter[pipe], GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeTipBlock); if (didWork[0]) { @@ -425,7 +412,72 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { this.updateCoordinates(); - for (int xOff = -1 + this.back.offsetX; xOff <= 1 + this.back.offsetX; ++xOff) { + + + + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int tAmount = 0; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { + return false; + } else { + + Block aCasing = Block.getBlockFromItem(getCasingBlockItem().getItem()); + + for (int i = -1; i < 2; ++i) { + for (int j = -1; j < 2; ++j) { + for (int h = -1; h < 2; ++h) { + if (h != 0 || (xDir + i != 0 || zDir + j != 0) && (i != 0 || j != 0)) { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, + h, zDir + j); + Block aBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + int aMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); + + if (!this.addToMachineList(tTileEntity, 48)) { + if (aBlock != aCasing) { + Logger.INFO("Found Bad Casing"); + return false; + } + if (aMeta != 3) { + Logger.INFO("Found Bad Meta"); + return false; + } + } + ++tAmount; + + + + /*if (!isValidBlockForStructure(tTileEntity, 48, true, aBlock, aMeta, sBlockCasings4, 0)) { + Logger.INFO("Bad centrifuge casing"); + return false; + }*/ + + } + } + } + } + return tAmount >= 10; + } + + + + + + + + + + + + + + + + + + + + /*for (int xOff = -1 + this.back.offsetX; xOff <= 1 + this.back.offsetX; ++xOff) { for (int zOff = -1 + this.back.offsetZ; zOff <= 1 + this.back.offsetZ; ++zOff) { if (xOff != 0 || zOff != 0) { final Block tBlock = aBaseMetaTileEntity.getBlockOffset(xOff, 0, zOff); @@ -436,7 +488,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 blosck in Structure."); + Logger.INFO("[Bedrock Miner] Found bad block in Structure."); if (tBlock != null) { //Logger.INFO("[Bedrock Miner] Found "+(new ItemStack(tBlock, tBlock.getDamageValue(aBaseMetaTileEntity.getWorld(), xOff, 0, zOff))).getDisplayName()+", expected "+this.getCasingBlockItem().get(0L, new Object[0]).getDisplayName()); } @@ -466,12 +518,12 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G } } Logger.INFO("[Bedrock Miner] Built."); - return true; + return true;*/ } private void updateCoordinates() { this.xDrill = this.getBaseMetaTileEntity().getXCoord(); - this.yDrill = this.getBaseMetaTileEntity().getYCoord(); + this.yDrill = this.getBaseMetaTileEntity().getYCoord()-1; this.zDrill = this.getBaseMetaTileEntity().getZCoord(); this.back = ForgeDirection.getOrientation((int) this.getBaseMetaTileEntity().getBackFacing()); @@ -495,7 +547,7 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G private boolean checkPipesAndSetYHead() { for (int g = 0; g < 5; g++) { - this.yHead[g] = this.yDrill - 1; + this.yHead[g] = this.yDrill -5; // Logger.INFO("[Bedrock Miner] Set yHead["+g+"] to // "+this.yHead[g]+"."); while (this.checkBlockAndMeta(this.xCenter[g], this.yHead[g], this.zCenter[g], @@ -504,7 +556,7 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G } if (this.checkBlockAndMeta(this.xCenter[g], this.yHead[g], this.zCenter[g], GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeTipBlock, 32767) - || ++this.yHead[g] == this.yDrill) { + || ++this.yHead[g] == this.yDrill || GT_Utility.isBlockAir(this.getBaseMetaTileEntity().getWorld(), this.xCenter[g], this.yHead[g], this.zCenter[g])) { continue; } this.getBaseMetaTileEntity().getWorld().setBlock(this.xCenter[g], this.yHead[g], this.zCenter[g], @@ -595,4 +647,288 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G miningPipeBlock = ModBlocks.blockFakeMiningPipe; miningPipeTipBlock = ModBlocks.blockFakeMiningHead; } + + + + + + + + + + + + + + + + + + + + + + + + + + private AutoMap<ItemStack> mOutputs; + + public void process() { + ItemStack aOutput = generateOutputWithchance(); + if (aOutput != null) { + this.addOutput(aOutput); + Logger.INFO("Mined some "+aOutput.getDisplayName()); + } + this.updateSlots(); + } + + public ItemStack generateOutputWithchance() { + int aChance = MathUtils.randInt(0, 7500); + if (aChance < 100) { + return generateOutput(); + } + else { + return null; + } + } + + public ItemStack generateOutput() { + AutoMap<ItemStack> aData = generateOreForOutput(); + int aMax = aData.size()-1; + return aData.get(MathUtils.randInt(0, aMax)); + } + + /** + * Here we generate valid ores and also a basic loot set + */ + + public AutoMap<ItemStack> generateOreForOutput() { + + if (mOutputs != null) { + return mOutputs; + } + + AutoMap<GT_Worldgen_GT_Ore_Layer> aOverWorldOres = MiningUtils.getOresForDim(0); + AutoMap<GT_Worldgen_GT_Ore_Layer> aNetherOres = MiningUtils.getOresForDim(-1); + AutoMap<GT_Worldgen_GT_Ore_Layer> aEndOres = MiningUtils.getOresForDim(1); + + AutoMap<ItemStack> aTempMap = new AutoMap<ItemStack>(); + Block tOreBlock = GregTech_API.sBlockOres1; + Logger.INFO("Ore Map contains "+aTempMap.size()+" values. [Initial]"); + + for (GT_Worldgen_GT_Ore_Layer layer : aOverWorldOres) { + if (layer.mEnabled) { + ItemStack aTempOreStack1 = ItemUtils.simpleMetaStack(tOreBlock, layer.mPrimaryMeta, 1); + ItemStack aTempOreStack2 = ItemUtils.simpleMetaStack(tOreBlock, layer.mSecondaryMeta, 1); + ItemStack aTempOreStack3 = ItemUtils.simpleMetaStack(tOreBlock, layer.mBetweenMeta, 1); + ItemStack aTempOreStack4 = ItemUtils.simpleMetaStack(tOreBlock, layer.mSporadicMeta, 1); + aTempMap.put(aTempOreStack1); + aTempMap.put(aTempOreStack2); + aTempMap.put(aTempOreStack3); + aTempMap.put(aTempOreStack4); + aTempMap.put(aTempOreStack1); + aTempMap.put(aTempOreStack2); + aTempMap.put(aTempOreStack3); + aTempMap.put(aTempOreStack4); + aTempMap.put(aTempOreStack1); + aTempMap.put(aTempOreStack2); + aTempMap.put(aTempOreStack3); + aTempMap.put(aTempOreStack4); + } + } + Logger.INFO("Ore Map contains "+aTempMap.size()+" values. [Overworld]"); + for (GT_Worldgen_GT_Ore_Layer layer : aNetherOres) { + if (layer.mEnabled) { + ItemStack aTempOreStack1 = ItemUtils.simpleMetaStack(tOreBlock, layer.mPrimaryMeta, 1); + ItemStack aTempOreStack2 = ItemUtils.simpleMetaStack(tOreBlock, layer.mSecondaryMeta, 1); + ItemStack aTempOreStack3 = ItemUtils.simpleMetaStack(tOreBlock, layer.mBetweenMeta, 1); + ItemStack aTempOreStack4 = ItemUtils.simpleMetaStack(tOreBlock, layer.mSporadicMeta, 1); + aTempMap.put(aTempOreStack1); + aTempMap.put(aTempOreStack2); + aTempMap.put(aTempOreStack3); + aTempMap.put(aTempOreStack4); + aTempMap.put(aTempOreStack1); + aTempMap.put(aTempOreStack2); + aTempMap.put(aTempOreStack3); + aTempMap.put(aTempOreStack4); + } + } + Logger.INFO("Ore Map contains "+aTempMap.size()+" values. [Nether]"); + for (GT_Worldgen_GT_Ore_Layer layer : aEndOres) { + if (layer.mEnabled) { + ItemStack aTempOreStack1 = ItemUtils.simpleMetaStack(tOreBlock, layer.mPrimaryMeta, 1); + ItemStack aTempOreStack2 = ItemUtils.simpleMetaStack(tOreBlock, layer.mSecondaryMeta, 1); + ItemStack aTempOreStack3 = ItemUtils.simpleMetaStack(tOreBlock, layer.mBetweenMeta, 1); + ItemStack aTempOreStack4 = ItemUtils.simpleMetaStack(tOreBlock, layer.mSporadicMeta, 1); + aTempMap.put(aTempOreStack1); + aTempMap.put(aTempOreStack2); + aTempMap.put(aTempOreStack3); + aTempMap.put(aTempOreStack4); + } + } + Logger.INFO("Ore Map contains "+aTempMap.size()+" values. [End]"); + + addOreTypeToMap(ELEMENT.getInstance().IRON, 200, aTempMap); + addOreTypeToMap(ELEMENT.getInstance().COPPER, 175, aTempMap); + addOreTypeToMap(ELEMENT.getInstance().TIN, 150, aTempMap); + addOreTypeToMap(ELEMENT.getInstance().GOLD, 150, aTempMap); + addOreTypeToMap(ELEMENT.getInstance().SILVER, 110, aTempMap); + addOreTypeToMap(ELEMENT.getInstance().NICKEL, 40, aTempMap); + addOreTypeToMap(ELEMENT.getInstance().ZINC, 40, aTempMap); + addOreTypeToMap(ELEMENT.getInstance().LEAD, 40, aTempMap); + addOreTypeToMap(ELEMENT.getInstance().ALUMINIUM, 30, aTempMap); + addOreTypeToMap(ELEMENT.getInstance().THORIUM, 20, aTempMap); + Logger.INFO("Ore Map contains "+aTempMap.size()+" values. [Extra Common Ores]"); + + AutoMap<Pair<String, Integer>> mMixedOreData = new AutoMap<Pair<String, Integer>>(); + mMixedOreData.put(new Pair<String, Integer>("oreRuby", 30)); + mMixedOreData.put(new Pair<String, Integer>("oreSapphire", 25)); + mMixedOreData.put(new Pair<String, Integer>("oreEmerald", 25)); + mMixedOreData.put(new Pair<String, Integer>("oreLapis", 40)); + mMixedOreData.put(new Pair<String, Integer>("oreRedstone", 40)); + + if (LoadedMods.Thaumcraft || (OreDictionary.doesOreNameExist("oreAmber") && OreDictionary.doesOreNameExist("oreCinnabar"))) { + mMixedOreData.put(new Pair<String, Integer>("oreAmber", 20)); + mMixedOreData.put(new Pair<String, Integer>("oreCinnabar", 20)); + } + if (LoadedMods.Railcraft || OreDictionary.doesOreNameExist("oreSaltpeter")) { + mMixedOreData.put(new Pair<String, Integer>("oreSaltpeter", 10)); + } + if (LoadedMods.IndustrialCraft2 || OreDictionary.doesOreNameExist("oreUranium")) { + mMixedOreData.put(new Pair<String, Integer>("oreUranium", 10)); + } + if (OreDictionary.doesOreNameExist("oreSulfur")) { + mMixedOreData.put(new Pair<String, Integer>("oreSulfur", 15)); + } + if (OreDictionary.doesOreNameExist("oreSilicon")) { + mMixedOreData.put(new Pair<String, Integer>("oreSilicon", 15)); + } + if (OreDictionary.doesOreNameExist("oreApatite")) { + mMixedOreData.put(new Pair<String, Integer>("oreApatite", 25)); + } + + mMixedOreData.put(new Pair<String, Integer>("oreFirestone", 2)); + mMixedOreData.put(new Pair<String, Integer>("oreBismuth", 20)); + mMixedOreData.put(new Pair<String, Integer>("oreLithium", 20)); + mMixedOreData.put(new Pair<String, Integer>("oreManganese", 20)); + mMixedOreData.put(new Pair<String, Integer>("oreBeryllium", 20)); + mMixedOreData.put(new Pair<String, Integer>("oreCoal", 75)); + mMixedOreData.put(new Pair<String, Integer>("oreLignite", 75)); + mMixedOreData.put(new Pair<String, Integer>("oreSalt", 15)); + mMixedOreData.put(new Pair<String, Integer>("oreCalcite", 15)); + mMixedOreData.put(new Pair<String, Integer>("oreBauxite", 20)); + mMixedOreData.put(new Pair<String, Integer>("oreAlmandine", 15)); + mMixedOreData.put(new Pair<String, Integer>("oreGraphite", 25)); + mMixedOreData.put(new Pair<String, Integer>("oreGlauconite", 15)); + mMixedOreData.put(new Pair<String, Integer>("orePyrolusite", 15)); + mMixedOreData.put(new Pair<String, Integer>("oreGrossular", 15)); + mMixedOreData.put(new Pair<String, Integer>("oreTantalite", 15)); + + for (Pair<String, Integer> g : mMixedOreData) { + for (int i=0; i<g.getValue();i++) { + aTempMap.put(ItemUtils.getItemStackOfAmountFromOreDict(g.getKey(), 1)); + } + } + Logger.INFO("Ore Map contains "+aTempMap.size()+" values. [Extra Mixed Ores]"); + + + addOreTypeToMap(ELEMENT.STANDALONE.RUNITE, 2, aTempMap); + addOreTypeToMap(ELEMENT.STANDALONE.GRANITE, 8, aTempMap); + Logger.INFO("Ore Map contains "+aTempMap.size()+" values. [OSRS Ores]"); + + + AutoMap<Material> aMyOreMaterials = new AutoMap<Material>(); + aMyOreMaterials.add(ORES.CROCROITE); + aMyOreMaterials.add(ORES.GEIKIELITE); + aMyOreMaterials.add(ORES.NICHROMITE); + aMyOreMaterials.add(ORES.TITANITE); + aMyOreMaterials.add(ORES.ZIMBABWEITE); + aMyOreMaterials.add(ORES.ZIRCONILITE); + aMyOreMaterials.add(ORES.GADOLINITE_CE); + aMyOreMaterials.add(ORES.GADOLINITE_Y); + aMyOreMaterials.add(ORES.LEPERSONNITE); + aMyOreMaterials.add(ORES.SAMARSKITE_Y); + aMyOreMaterials.add(ORES.SAMARSKITE_YB); + aMyOreMaterials.add(ORES.XENOTIME); + aMyOreMaterials.add(ORES.YTTRIAITE); + aMyOreMaterials.add(ORES.YTTRIALITE); + aMyOreMaterials.add(ORES.YTTROCERITE); + aMyOreMaterials.add(ORES.ZIRCON); + aMyOreMaterials.add(ORES.POLYCRASE); + aMyOreMaterials.add(ORES.ZIRCOPHYLLITE); + aMyOreMaterials.add(ORES.ZIRKELITE); + aMyOreMaterials.add(ORES.LANTHANITE_LA); + aMyOreMaterials.add(ORES.LANTHANITE_CE); + aMyOreMaterials.add(ORES.LANTHANITE_ND); + aMyOreMaterials.add(ORES.AGARDITE_Y); + aMyOreMaterials.add(ORES.AGARDITE_CD); + aMyOreMaterials.add(ORES.AGARDITE_LA); + aMyOreMaterials.add(ORES.AGARDITE_ND); + aMyOreMaterials.add(ORES.HIBONITE); + aMyOreMaterials.add(ORES.CERITE); + aMyOreMaterials.add(ORES.FLUORCAPHITE); + aMyOreMaterials.add(ORES.FLORENCITE); + aMyOreMaterials.add(ORES.CRYOLITE); + aMyOreMaterials.add(ORES.LAUTARITE); + aMyOreMaterials.add(ORES.LAFOSSAITE); + aMyOreMaterials.add(ORES.DEMICHELEITE_BR); + aMyOreMaterials.add(ORES.COMANCHEITE); + aMyOreMaterials.add(ORES.PERROUDITE); + aMyOreMaterials.add(ORES.HONEAITE); + aMyOreMaterials.add(ORES.ALBURNITE); + aMyOreMaterials.add(ORES.MIESSIITE); + aMyOreMaterials.add(ORES.KASHINITE); + aMyOreMaterials.add(ORES.IRARSITE); + aMyOreMaterials.add(ORES.RADIOBARITE); + aMyOreMaterials.add(ORES.DEEP_EARTH_REACTOR_FUEL_DEPOSIT); + + for (Material aOreType : aMyOreMaterials) { + if (aOreType == ORES.DEEP_EARTH_REACTOR_FUEL_DEPOSIT || aOreType == ORES.RADIOBARITE) { + addOreTypeToMap(aOreType, 4, aTempMap); + } + else { + addOreTypeToMap(aOreType, 7, aTempMap); + } + } + + //Cleanup Map + Logger.INFO("Ore Map contains "+aTempMap.size()+" values. [GT++]"); + AutoMap<ItemStack> aCleanUp = new AutoMap<ItemStack>(); + for (ItemStack verify : aTempMap) { + if (!ItemUtils.checkForInvalidItems(verify)) { + aCleanUp.put(verify); + } + } + Logger.INFO("Cleanup Map contains "+aCleanUp.size()+" values."); + for (ItemStack remove : aCleanUp) { + aTempMap.remove(remove); + } + + //Generate Massive Map + AutoMap<ItemStack> aFinalMap = new AutoMap<ItemStack>(); + for (ItemStack aTempItem : aTempMap) { + int aTempMulti = MathUtils.randInt(20, 50); + for (int i=0;i<aTempMulti;i++) { + aFinalMap.put(aTempItem.copy()); + } + } + Logger.INFO("Final Ore Map contains "+aFinalMap.size()+" values."); + mOutputs = aFinalMap; + return mOutputs; + } + + + private static void addOreTypeToMap(Material aMaterial, int aAmount, AutoMap<ItemStack> aMap) { + for (int i=0; i<aAmount;i++) { + aMap.add(aMaterial.getOre(1)); + } + } + + + + + + + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java index ff4be9dd93..7aa7529817 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java @@ -13,6 +13,7 @@ import gregtech.common.items.behaviors.Behaviour_None; import gregtech.common.tools.GT_Tool; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; import net.minecraft.block.Block; +import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityIronGolem; @@ -39,7 +40,7 @@ extends GT_Tool { @Override public int getToolDamagePerBlockBreak() { - return 50; + return 100; } @Override @@ -49,12 +50,12 @@ extends GT_Tool { @Override public int getToolDamagePerContainerCraft() { - return 400; + return 100; } @Override public int getToolDamagePerEntityAttack() { - return 100; + return 200; } @Override @@ -112,40 +113,9 @@ extends GT_Tool { } @Override - public boolean isWeapon() { - return true; - } - - @Override public boolean isMinableBlock(final Block aBlock, final byte aMetaData) { final String tTool = aBlock.getHarvestTool(aMetaData); - return (tTool != null) && (tTool.equals("sword") || tTool.equals("file")); - } - - - @Override - public int convertBlockDrops(final List<ItemStack> aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { - int rConversions = 0; - /*GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{new ItemStack(aBlock, 1, aMetaData)}); - if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) { - for (final ItemStack tDrop : aDrops) { - tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{GT_Utility.copyAmount(1L, new Object[]{tDrop})}); - if (tRecipe != null) { - final ItemStack tHammeringOutput = tRecipe.getOutput(0); - if (tHammeringOutput != null) { - rConversions += tDrop.stackSize; - tDrop.stackSize *= tHammeringOutput.stackSize; - tHammeringOutput.stackSize = tDrop.stackSize; - GT_Utility.setStack(tDrop, tHammeringOutput); - } - } - } - } else { - aDrops.clear(); - aDrops.add(tRecipe.getOutput(0)); - rConversions++; - }*/ - return rConversions; + return (tTool != null) && (tTool.equals("sword") || tTool.equals("knife")); } @Override @@ -193,5 +163,30 @@ extends GT_Tool { public boolean isGrafter() { return false; } + + @Override + public int getHurtResistanceTime(int aOriginalHurtResistance, Entity aEntity) { + return aOriginalHurtResistance * 2; + } + + @Override + public boolean isWeapon() { + return true; + } + + @Override + public boolean isMiningTool() { + return false; + } + + @Override + public Enchantment[] getEnchantments(ItemStack aStack) { + return LOOTING_ENCHANTMENT; + } + + @Override + public int[] getEnchantmentLevels(ItemStack aStack) { + return new int[]{(4 + GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolQuality) / 2}; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java index cf6f33cc36..36e1161e83 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java @@ -9,7 +9,6 @@ import gregtech.api.enums.Materials; import gregtech.api.enums.Textures.ItemIcons; import gregtech.api.interfaces.IIconContainer; import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.common.items.behaviors.Behaviour_None; import gregtech.common.tools.GT_Tool; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; import gtPlusPlus.xmod.gregtech.common.items.behaviours.Behaviour_Electric_Lighter; @@ -23,7 +22,6 @@ import net.minecraft.stats.AchievementList; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; -import net.minecraftforge.event.world.BlockEvent; public class TOOL_Gregtech_ElectricLighter extends GT_Tool { @@ -119,36 +117,9 @@ extends GT_Tool { @Override public boolean isMinableBlock(final Block aBlock, final byte aMetaData) { - final String tTool = aBlock.getHarvestTool(aMetaData); - return (tTool != null) && (tTool.equals("sword") || tTool.equals("file")); + return false; } - - @Override - public int convertBlockDrops(final List<ItemStack> aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { - int rConversions = 0; - /*GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{new ItemStack(aBlock, 1, aMetaData)}); - if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) { - for (final ItemStack tDrop : aDrops) { - tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{GT_Utility.copyAmount(1L, new Object[]{tDrop})}); - if (tRecipe != null) { - final ItemStack tHammeringOutput = tRecipe.getOutput(0); - if (tHammeringOutput != null) { - rConversions += tDrop.stackSize; - tDrop.stackSize *= tHammeringOutput.stackSize; - tHammeringOutput.stackSize = tDrop.stackSize; - GT_Utility.setStack(tDrop, tHammeringOutput); - } - } - } - } else { - aDrops.clear(); - aDrops.add(tRecipe.getOutput(0)); - rConversions++; - }*/ - return rConversions; - } - @Override public ItemStack getBrokenItem(final ItemStack aStack) { return null; @@ -164,10 +135,7 @@ extends GT_Tool { return !aIsToolHead ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa : Materials.Silver.mRGBa; - } - - - + } @Override public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) { @@ -182,12 +150,12 @@ extends GT_Tool { @Override public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) { - return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been Ground out of existence by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE); + return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been prodded out of existence by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE); } @Override public void onStatsAddedToTool(final GT_MetaGenerated_Tool aItem, final int aID) { - aItem.addItemBehavior(aID, new Behaviour_Electric_Lighter(null, 32000)); + aItem.addItemBehavior(aID, new Behaviour_Electric_Lighter()); } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java index 15627a827f..1cb999241a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java @@ -107,7 +107,7 @@ public class RecipeGen_Ore extends RecipeGen_Base { //If Fourth Output has no solid output, try the Fifth (If it exists) if (!bonusB.hasSolidForm() && material.getComposites().size() >= 5 && material.getComposites().get(4) != null) { bonusB = material.getComposites().get(4).getStackMaterial(); - //If Fifth Output has no solid output, default out to Chrome. + //If Fifth Output has no solid output, default out to Stone dust. if (!bonusB.hasSolidForm()) { allFailed = true; bonusB = mStone; @@ -127,11 +127,11 @@ public class RecipeGen_Ore extends RecipeGen_Base { //Default out if it's made of fluids or some shit. if (bonusA == null) { - bonusA = tVoltageMultiplier <= 100 ? material : mStone; + bonusA = tVoltageMultiplier > 100 ? material : mStone; } //Default out if it's made of fluids or some shit. if (allFailed || bonusB == null) { - bonusB = tVoltageMultiplier <= 100 ? material : mStone; + bonusB = tVoltageMultiplier > 100 ? material : mStone; } AutoMap<Pair<Integer, Material>> componentMap = new AutoMap<Pair<Integer, Material>>(); diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/HANDLER_Thaumcraft.java b/src/Java/gtPlusPlus/xmod/thaumcraft/HANDLER_Thaumcraft.java index 35e608b0ca..8cdfb2afb6 100644 --- a/src/Java/gtPlusPlus/xmod/thaumcraft/HANDLER_Thaumcraft.java +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/HANDLER_Thaumcraft.java @@ -43,9 +43,9 @@ public class HANDLER_Thaumcraft { //sThaumcraftCompat = (IThaumcraftCompat) GT_Utility.callConstructor("gtPlusPlus.xmod.thaumcraft.aspect.GTPP_AspectCompat", 0, null, GT_Values.D1, new Object[0]); - sThaumcraftCompat = new GTPP_AspectCompat(); + //sThaumcraftCompat = new GTPP_AspectCompat(); - if (!sItemsToGetAspects.isEmpty() && false) { + /*if (!sItemsToGetAspects.isEmpty() && false) { for (Pair<ItemStack, GTPP_AspectStack[]> j : sItemsToGetAspects) { if (j .getKey() != null && (j.getValue() != null && j.getValue().length > 0)) { List<GTPP_AspectStack> list = Arrays.asList(j.getValue()); @@ -57,7 +57,7 @@ public class HANDLER_Thaumcraft { } } } - } + }*/ } } |