aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common/helpers')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java152
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/CraftingHelper.java5
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java8
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/GT_MethodHelper.java37
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java6
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java230
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/VolumetricFlaskHelper.java24
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Container.java7
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Utils.java8
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java54
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java107
11 files changed, 363 insertions, 275 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java
index a55cae39ea..ac30942a5f 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java
@@ -2,6 +2,15 @@ package gtPlusPlus.xmod.gregtech.common.helpers;
import static gregtech.api.GregTech_API.mEUtoRF;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
+
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -21,20 +30,11 @@ import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaWirelessCharger;
import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
public class ChargingHelper {
- private static Map<String, Pair<GregtechMetaWirelessCharger, Byte>> mValidPlayers =
- new HashMap<String, Pair<GregtechMetaWirelessCharger, Byte>>();
- protected static Map<BlockPos, GregtechMetaWirelessCharger> mChargerMap =
- new HashMap<BlockPos, GregtechMetaWirelessCharger>();
+ private static Map<String, Pair<GregtechMetaWirelessCharger, Byte>> mValidPlayers = new HashMap<String, Pair<GregtechMetaWirelessCharger, Byte>>();
+ protected static Map<BlockPos, GregtechMetaWirelessCharger> mChargerMap = new HashMap<BlockPos, GregtechMetaWirelessCharger>();
private int mTickTimer = 0;
private final int mTickMultiplier = 20;
@@ -66,9 +66,8 @@ public class ChargingHelper {
for (GregtechMetaWirelessCharger mEntityTemp : mChargerMap.values()) {
if (mEntityTemp != null) {
if (mEntityTemp.getBaseMetaTileEntity() == null
- || !mEntityTemp
- .getBaseMetaTileEntity()
- .isAllowedToWork()) continue;
+ || !mEntityTemp.getBaseMetaTileEntity().isAllowedToWork())
+ continue;
if (mPlayerMan.getEntityWorld().provider.dimensionId
== mEntityTemp.getDimensionID()) {
mVoltage = mEntityTemp.maxEUInput();
@@ -85,32 +84,48 @@ public class ChargingHelper {
if (!LR.isEmpty()
&& LR.containsKey(mPlayerMan.getDisplayName())) {
mCurrentEu = chargeItems(
- mEntityTemp, mArmourContents, mPlayerMan);
+ mEntityTemp,
+ mArmourContents,
+ mPlayerMan);
mCurrentEu = chargeItems(
- mEntityTemp, mInventoryContents, mPlayerMan);
+ mEntityTemp,
+ mInventoryContents,
+ mPlayerMan);
}
} else if (mEntityTemp.getMode() == 1) {
if (!LO.isEmpty()
&& LO.containsKey(mPlayerMan.getDisplayName())) {
mCurrentEu = chargeItems(
- mEntityTemp, mArmourContents, mPlayerMan);
+ mEntityTemp,
+ mArmourContents,
+ mPlayerMan);
mCurrentEu = chargeItems(
- mEntityTemp, mInventoryContents, mPlayerMan);
+ mEntityTemp,
+ mInventoryContents,
+ mPlayerMan);
}
} else {
if (!LR.isEmpty()
&& LR.containsKey(mPlayerMan.getDisplayName())) {
mCurrentEu = chargeItems(
- mEntityTemp, mArmourContents, mPlayerMan);
+ mEntityTemp,
+ mArmourContents,
+ mPlayerMan);
mCurrentEu = chargeItems(
- mEntityTemp, mInventoryContents, mPlayerMan);
+ mEntityTemp,
+ mInventoryContents,
+ mPlayerMan);
}
if (!LO.isEmpty()
&& LO.containsKey(mPlayerMan.getDisplayName())) {
mCurrentEu = chargeItems(
- mEntityTemp, mArmourContents, mPlayerMan);
+ mEntityTemp,
+ mArmourContents,
+ mPlayerMan);
mCurrentEu = chargeItems(
- mEntityTemp, mInventoryContents, mPlayerMan);
+ mEntityTemp,
+ mInventoryContents,
+ mPlayerMan);
}
}
@@ -125,13 +140,14 @@ public class ChargingHelper {
mMaxDistance = (4 * GT_Values.V[mEntityTemp.getTier()] / 2);
}
double mDistance = calculateDistance(mEntityTemp, mPlayerMan);
- long mVoltageCost = MathUtils.findPercentageOfInt(
- mMaxDistance, (float) mDistance);
+ long mVoltageCost = MathUtils
+ .findPercentageOfInt(mMaxDistance, (float) mDistance);
if (mVoltageCost > 0) {
if (mVoltageCost > mEntityTemp.maxEUInput()) {
- mEntityTemp.setEUVar((mEntityTemp.getEUVar()
- - mEntityTemp.maxEUInput()));
+ mEntityTemp.setEUVar(
+ (mEntityTemp.getEUVar()
+ - mEntityTemp.maxEUInput()));
} else {
mEntityTemp.setEUVar(
(mEntityTemp.getEUVar() - mVoltageCost));
@@ -202,8 +218,9 @@ public class ChargingHelper {
return false;
} else {
Logger.WARNING("key not found, adding");
- Pair<GregtechMetaWirelessCharger, Byte> mEntry =
- new Pair<GregtechMetaWirelessCharger, Byte>(mEntity, (byte) mEntity.getMode());
+ Pair<GregtechMetaWirelessCharger, Byte> mEntry = new Pair<GregtechMetaWirelessCharger, Byte>(
+ mEntity,
+ (byte) mEntity.getMode());
if (mValidPlayers.put(mPlayer.getDisplayName(), mEntry) == null) {
Logger.WARNING("Added a Player to the Tick Map.");
return true;
@@ -221,8 +238,9 @@ public class ChargingHelper {
Logger.WARNING("trying to remove player from map");
if (mValidPlayers.containsKey(mPlayer.getDisplayName())) {
Logger.WARNING("key found, removing");
- Pair<GregtechMetaWirelessCharger, Byte> mEntry =
- new Pair<GregtechMetaWirelessCharger, Byte>(mEntity, (byte) mEntity.getMode());
+ Pair<GregtechMetaWirelessCharger, Byte> mEntry = new Pair<GregtechMetaWirelessCharger, Byte>(
+ mEntity,
+ (byte) mEntity.getMode());
if (mValidPlayers.remove(mPlayer, mEntry)) {
Logger.WARNING("Removed a Player to the Tick Map.");
return true;
@@ -241,7 +259,8 @@ public class ChargingHelper {
return 0;
}
return mEntityTemp.getDistanceBetweenTwoPositions(
- mEntityTemp.getTileEntityPosition(), mEntityTemp.getPositionOfEntity(mPlayerMan));
+ mEntityTemp.getTileEntityPosition(),
+ mEntityTemp.getPositionOfEntity(mPlayerMan));
}
public long chargeItems(GregtechMetaWirelessCharger mEntity, ItemStack[] mItems, EntityPlayer mPlayer) {
@@ -305,10 +324,7 @@ public class ChargingHelper {
|| mTemp.getItem() instanceof GT_MetaGenerated_Item_02
|| ReflectionUtils.getClass("gregtech.common.items.GT_MetaGenerated_Item_03")
.isInstance(mTemp.getItem())
- || mTemp.getItem()
- .getClass()
- .getName()
- .toLowerCase()
+ || mTemp.getItem().getClass().getName().toLowerCase()
.equals(("gregtech.common.items.GT_MetaGenerated_Tool_01").toLowerCase())) {
if (!NBTUtils.hasKey(mTemp, "GT.ItemCharge")) {
if (!mTemp.getDisplayName().toLowerCase().contains("battery")) {
@@ -341,13 +357,14 @@ public class ChargingHelper {
mMulti = 20;
} else if ((mitemCurrentCharge + (mVoltageIncrease * 10))
<= (mItemMaxCharge - (mVoltageIncrease * 10))) {
- mMulti = 10;
- } else if ((mitemCurrentCharge + (mVoltageIncrease * 5))
- <= (mItemMaxCharge - (mVoltageIncrease * 5))) {
- mMulti = 5;
- } else {
- mMulti = 1;
- }
+ mMulti = 10;
+ } else
+ if ((mitemCurrentCharge + (mVoltageIncrease * 5))
+ <= (mItemMaxCharge - (mVoltageIncrease * 5))) {
+ mMulti = 5;
+ } else {
+ mMulti = 1;
+ }
Logger.WARNING("5");
int mMultiVoltage = (int) (mMulti * mVoltageIncrease);
@@ -359,9 +376,8 @@ public class ChargingHelper {
> 0) {
Logger.WARNING("6.5 - " + g + " - " + mMulti);
for (int i = 0; i < mMulti; i++) {
- if (ElectricItem.manager.charge(
- mTemp, mVoltageIncrease, Integer.MAX_VALUE, false, false)
- > 0) {
+ if (ElectricItem.manager
+ .charge(mTemp, mVoltageIncrease, Integer.MAX_VALUE, false, false) > 0) {
continue;
}
}
@@ -370,11 +386,22 @@ public class ChargingHelper {
Logger.WARNING("7");
mEntity.setEUVar(mEuStored - (mVoltage * mMulti));
mEuStored = mEntity.getEUVar();
- Logger.WARNING("Charged " + mTemp.getDisplayName() + " | Slot: " + mItemSlot
- + " | EU Multiplier: " + mMulti + " | EU/t input: " + mVoltageIncrease
- + " | EU/t consumed by Tile: " + mVoltage + " | Item Max Charge: " + mItemMaxCharge
- + " | Item Start Charge: " + mitemCurrentCharge + " | Item New Charge"
- + ElectricItem.manager.getCharge(mTemp));
+ Logger.WARNING(
+ "Charged " + mTemp.getDisplayName()
+ + " | Slot: "
+ + mItemSlot
+ + " | EU Multiplier: "
+ + mMulti
+ + " | EU/t input: "
+ + mVoltageIncrease
+ + " | EU/t consumed by Tile: "
+ + mVoltage
+ + " | Item Max Charge: "
+ + mItemMaxCharge
+ + " | Item Start Charge: "
+ + mitemCurrentCharge
+ + " | Item New Charge"
+ + ElectricItem.manager.getCharge(mTemp));
mChargedItems++;
}
}
@@ -391,11 +418,22 @@ public class ChargingHelper {
Logger.WARNING("9");
mEntity.setEUVar(mEntity.getEUVar() - (xDif));
mEuStored = mEntity.getEUVar();
- Logger.WARNING("Charged " + mTemp.getDisplayName() + " | Slot: " + mItemSlot
- + " | EU Multiplier: " + mMulti + " | EU/t input: " + mVoltageIncrease
- + " | EU/t consumed by Tile: " + mVoltage + " | Item Max Charge: "
- + mItemMaxCharge + " | Item Start Charge: " + mitemCurrentCharge
- + " | Item New Charge" + ElectricItem.manager.getCharge(mTemp));
+ Logger.WARNING(
+ "Charged " + mTemp.getDisplayName()
+ + " | Slot: "
+ + mItemSlot
+ + " | EU Multiplier: "
+ + mMulti
+ + " | EU/t input: "
+ + mVoltageIncrease
+ + " | EU/t consumed by Tile: "
+ + mVoltage
+ + " | Item Max Charge: "
+ + mItemMaxCharge
+ + " | Item Start Charge: "
+ + mitemCurrentCharge
+ + " | Item New Charge"
+ + ElectricItem.manager.getCharge(mTemp));
mChargedItems++;
}
}
@@ -408,7 +446,9 @@ public class ChargingHelper {
rfItem.getMaxEnergyStored(mTemp) - rfItem.getEnergyStored(mTemp),
mEntity.getEUVar() * mEUtoRF / 100L);
chargedPower = rfItem.receiveEnergy(
- mTemp, chargedPower > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) chargedPower, false);
+ mTemp,
+ chargedPower > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) chargedPower,
+ false);
chargedPower = chargedPower * 100L / mEUtoRF;
mEntity.setEUVar(Math.max(mEntity.getEUVar() - chargedPower, 0));
mChargedItems++;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/CraftingHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/CraftingHelper.java
index bb81c349a0..0d85d6299f 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/CraftingHelper.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/CraftingHelper.java
@@ -1,12 +1,13 @@
package gtPlusPlus.xmod.gregtech.common.helpers;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.world.World;
+
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.xmod.gregtech.common.helpers.autocrafter.AC_Helper_Container;
import gtPlusPlus.xmod.gregtech.common.helpers.autocrafter.AC_Helper_Utils;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GT4Entity_AutoCrafter;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.world.World;
public class CraftingHelper {
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java
index bb8dac49d7..58a4aba71c 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java
@@ -1,13 +1,15 @@
package gtPlusPlus.xmod.gregtech.common.helpers;
+import java.util.HashMap;
+
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.oredict.OreDictionary;
+
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.sys.Log;
import gtPlusPlus.xmod.gregtech.api.enums.CustomOrePrefix;
-import java.util.HashMap;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.oredict.OreDictionary;
public class FlotationRecipeHandler {
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/GT_MethodHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/GT_MethodHelper.java
index 0b60e057f4..0c0baf4723 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/GT_MethodHelper.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/GT_MethodHelper.java
@@ -1,16 +1,18 @@
package gtPlusPlus.xmod.gregtech.common.helpers;
-import gregtech.api.enums.Textures.BlockIcons;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.metatileentity.BaseMetaTileEntity;
-import gregtech.api.metatileentity.MetaTileEntity;
-import gtPlusPlus.core.util.reflect.ReflectionUtils;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
+import gregtech.api.enums.Textures.BlockIcons;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.metatileentity.BaseMetaTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+
public class GT_MethodHelper {
private static final Method mGetTexture;
@@ -46,28 +48,25 @@ public class GT_MethodHelper {
Field aColor = ReflectionUtils.getField(BaseMetaTileEntity.class, "mColor");
Field aActive = ReflectionUtils.getField(BaseMetaTileEntity.class, "mActive");
Field aMetaTile = ReflectionUtils.getField(BaseMetaTileEntity.class, "mMetaTileEntity");
- Method aHasValidTile = ReflectionUtils.getMethod(
- BaseMetaTileEntity.class, "hasValidMetaTileEntity", new Class[] {});
+ Method aHasValidTile = ReflectionUtils
+ .getMethod(BaseMetaTileEntity.class, "hasValidMetaTileEntity", new Class[] {});
boolean hasValidTileObj = (boolean) aHasValidTile.invoke(aTile, new Object[] {});
boolean aActiveObj = aActive.getBoolean(aTile);
byte aFacingObj = aFacing.getByte(aTile);
- byte aColorObj = aColor.getByte(aTile);
- ;
+ byte aColorObj = aColor.getByte(aTile);;
MetaTileEntity aMetaTileObj = (MetaTileEntity) aMetaTile.get(aTile);
if (rIcon != null) {
- return new ITexture[] {rIcon};
+ return new ITexture[] { rIcon };
} else {
- return hasValidTileObj
- ? aMetaTileObj.getTexture(
- aTile,
- aSide,
- aFacingObj,
- (byte) (aColorObj - 1),
- aActiveObj,
- aTile.getOutputRedstoneSignal(aSide) > 0)
- : BlockIcons.ERROR_RENDERING;
+ return hasValidTileObj ? aMetaTileObj.getTexture(
+ aTile,
+ aSide,
+ aFacingObj,
+ (byte) (aColorObj - 1),
+ aActiveObj,
+ aTile.getOutputRedstoneSignal(aSide) > 0) : BlockIcons.ERROR_RENDERING;
}
} catch (Throwable t) {
t.printStackTrace();
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java
index 8263243474..2710f5dc78 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java
@@ -1,11 +1,13 @@
package gtPlusPlus.xmod.gregtech.common.helpers;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import gregtech.api.GregTech_API;
import java.util.HashMap;
+
import net.minecraft.block.Block;
import net.minecraftforge.event.world.BlockEvent;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import gregtech.api.GregTech_API;
+
public class MachineUpdateHandler {
private static final HashMap<String, Block> mBlockCache = new HashMap<String, Block>();
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java
index d054e5da3b..7ce06c7974 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java
@@ -2,7 +2,37 @@ package gtPlusPlus.xmod.gregtech.common.helpers;
import static gtPlusPlus.core.lib.CORE.ConfigSwitches.enableTreeFarmerParticles;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Queue;
+import java.util.Set;
+import java.util.Stack;
+import java.util.concurrent.ConcurrentHashMap;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockAir;
+import net.minecraft.block.IGrowable;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.network.play.server.S23PacketBlockChange;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.world.ChunkPosition;
+import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.player.BonemealEvent;
+import net.minecraftforge.event.world.BlockEvent;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.oredict.OreDictionary;
+
import com.google.common.collect.Lists;
+
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.eventhandler.Event.Result;
@@ -30,33 +60,6 @@ import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.particles.BlockBreakParticles;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechItems;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Queue;
-import java.util.Set;
-import java.util.Stack;
-import java.util.concurrent.ConcurrentHashMap;
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockAir;
-import net.minecraft.block.IGrowable;
-import net.minecraft.block.material.Material;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
-import net.minecraft.network.play.server.S23PacketBlockChange;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.world.ChunkPosition;
-import net.minecraft.world.World;
-import net.minecraftforge.common.ForgeHooks;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.event.entity.player.BonemealEvent;
-import net.minecraftforge.event.world.BlockEvent;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.oredict.OreDictionary;
public class TreeFarmHelper {
@@ -83,23 +86,23 @@ public class TreeFarmHelper {
}
public static ITexture[] getFront(final byte aColor) {
- return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]};
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1] };
}
public static ITexture[] getBack(final byte aColor) {
- return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]};
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1] };
}
public static ITexture[] getBottom(final byte aColor) {
- return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]};
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1] };
}
public static ITexture[] getTop(final byte aColor) {
- return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]};
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1] };
}
public static ITexture[] getSides(final byte aColor) {
- return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]};
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1] };
}
public static ITexture[] getFrontActive(final byte aColor) {
@@ -122,13 +125,8 @@ public class TreeFarmHelper {
return getSides(aColor);
}
- public static boolean applyBonemeal(
- final EntityPlayer player,
- final World world,
- final int intX,
- final int intY,
- final int intZ,
- final short multiplier) {
+ public static boolean applyBonemeal(final EntityPlayer player, final World world, final int intX, final int intY,
+ final int intZ, final short multiplier) {
final Block block = world.getBlock(intX, intY, intZ);
int roll;
@@ -183,14 +181,10 @@ public class TreeFarmHelper {
public static boolean cleanUp(final IGregTechTileEntity aBaseMetaTileEntity) {
Logger.MACHINE_INFO("called cleanUp()");
int cleanedUp = 0;
- final int xDir =
- net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing())
- .offsetX
- * 11;
- final int zDir =
- net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing())
- .offsetZ
- * 11;
+ final int xDir = net.minecraftforge.common.util.ForgeDirection
+ .getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 11;
+ final int zDir = net.minecraftforge.common.util.ForgeDirection
+ .getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 11;
for (int h = 1; h < 175; h++) {
for (int i = -11; i <= 11; i++) {
@@ -198,12 +192,10 @@ public class TreeFarmHelper {
final Block testBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
- if ((((i == -8) || (i == 8))
- || ((i == -9) || (i == 9))
- || ((i == -10) || (i == 10))
- || ((i == -11) || (i == 11)))
- && (((j == -8) || (j == 8))
- || ((j == -9) || (j == 9))
+ if ((((i == -8) || (i == 8)) || ((i == -9) || (i == 9))
+ || ((i == -10) || (i == 10))
+ || ((i == -11) || (i == 11)))
+ && (((j == -8) || (j == 8)) || ((j == -9) || (j == 9))
|| ((j == -10) || (j == 10))
|| ((j == -11) || (j == 11)))) {
@@ -211,34 +203,54 @@ public class TreeFarmHelper {
|| !testBlock.getUnlocalizedName().toLowerCase().contains("pumpkin")) {
// Logger.WARNING("5:"+testBlock.getUnlocalizedName());
} else {
- aBaseMetaTileEntity
- .getWorld()
- .setBlock(
- aBaseMetaTileEntity.getXCoord() + xDir + i,
- aBaseMetaTileEntity.getYCoord() + h,
- aBaseMetaTileEntity.getZCoord() + zDir + j,
- Blocks.bookshelf);
+ aBaseMetaTileEntity.getWorld().setBlock(
+ aBaseMetaTileEntity.getXCoord() + xDir + i,
+ aBaseMetaTileEntity.getYCoord() + h,
+ aBaseMetaTileEntity.getZCoord() + zDir + j,
+ Blocks.bookshelf);
}
}
// If not in the middle - don't know how else to check this one without lots of !=
- if ((i != 7) && (i != -7) && (j != 7) && (j != -7) && (i != 6) && (i != -6) && (j != 6) && (j != -6)
- && (i != 5) && (i != -5) && (j != 5) && (j != -5) && (i != 4) && (i != -4) && (j != 4)
- && (j != -4) && (i != 3) && (i != -3) && (j != 3) && (j != -3) && (i != 2) && (i != -2)
- && (j != 2) && (j != -2) && (i != 1) && (i != -1) && (j != 1) && (j != -1) && (i != 0)
+ if ((i != 7) && (i != -7)
+ && (j != 7)
+ && (j != -7)
+ && (i != 6)
+ && (i != -6)
+ && (j != 6)
+ && (j != -6)
+ && (i != 5)
+ && (i != -5)
+ && (j != 5)
+ && (j != -5)
+ && (i != 4)
+ && (i != -4)
+ && (j != 4)
+ && (j != -4)
+ && (i != 3)
+ && (i != -3)
+ && (j != 3)
+ && (j != -3)
+ && (i != 2)
+ && (i != -2)
+ && (j != 2)
+ && (j != -2)
+ && (i != 1)
+ && (i != -1)
+ && (j != 1)
+ && (j != -1)
+ && (i != 0)
&& (j != 0)) {
if (!testBlock.getUnlocalizedName().toLowerCase().contains("air")
|| !testBlock.getUnlocalizedName().toLowerCase().contains("pumpkin")) {
// Logger.WARNING("0:"+testBlock.getUnlocalizedName());
} else {
- aBaseMetaTileEntity
- .getWorld()
- .setBlock(
- aBaseMetaTileEntity.getXCoord() + xDir + i,
- aBaseMetaTileEntity.getYCoord() + h,
- aBaseMetaTileEntity.getZCoord() + zDir + j,
- Blocks.melon_block);
+ aBaseMetaTileEntity.getWorld().setBlock(
+ aBaseMetaTileEntity.getXCoord() + xDir + i,
+ aBaseMetaTileEntity.getYCoord() + h,
+ aBaseMetaTileEntity.getZCoord() + zDir + j,
+ Blocks.melon_block);
}
if (isLeaves(testBlock) || isWoodLog(testBlock)) {
@@ -295,8 +307,7 @@ public class TreeFarmHelper {
if (aDmg >= 32120 && aDmg <= 32128) {
return ToolType.Unbreakable;
}
- Logger.INFO(
- "bad Tool in Slot 2 | " + aStack.getUnlocalizedName().toLowerCase() + " | " + aDmg);
+ Logger.INFO("bad Tool in Slot 2 | " + aStack.getUnlocalizedName().toLowerCase() + " | " + aDmg);
return null;
}
@@ -372,9 +383,8 @@ public class TreeFarmHelper {
}
return (OrePrefixes.log.contains(new ItemStack(log, 1)) && ((tTool != null) && (tTool.equals("axe"))))
- || (log.getMaterial() != Material.wood)
- ? false
- : (OrePrefixes.fence.contains(new ItemStack(log, 1)) ? false : true);
+ || (log.getMaterial() != Material.wood) ? false
+ : (OrePrefixes.fence.contains(new ItemStack(log, 1)) ? false : true);
}
public static boolean isLeaves(final Block log) {
@@ -390,8 +400,7 @@ public class TreeFarmHelper {
if (log.getLocalizedName().toLowerCase().contains("leaves")) {
return true;
}
- return OrePrefixes.leaves.contains(new ItemStack(log, 1))
- || log.getMaterial() == Material.leaves
+ return OrePrefixes.leaves.contains(new ItemStack(log, 1)) || log.getMaterial() == Material.leaves
|| OrePrefixes.treeLeaves.contains(new ItemStack(log, 1))
|| log.getMaterial() == Material.vine
|| OrePrefixes.mushroom.contains(new ItemStack(log, 1))
@@ -412,18 +421,14 @@ public class TreeFarmHelper {
}
public static boolean isDirtBlock(final Block dirt) {
- return (dirt == Blocks.dirt
- ? true
+ return (dirt == Blocks.dirt ? true
: (dirt == Blocks.grass ? true : (getHumus() == null ? false : (dirt == blockHumus ? true : false))));
}
public static boolean isFenceBlock(final Block fence) {
- return (fence == Blocks.fence
- ? true
- : (fence == Blocks.fence_gate
- ? true
- : (fence == Blocks.nether_brick_fence
- ? true
+ return (fence == Blocks.fence ? true
+ : (fence == Blocks.fence_gate ? true
+ : (fence == Blocks.nether_brick_fence ? true
: (OrePrefixes.fence.contains(new ItemStack(fence, 1)) ? true : false))));
}
@@ -438,19 +443,16 @@ public class TreeFarmHelper {
return (air == Blocks.air ? true : (air instanceof BlockAir ? true : false));
}
- /*public static boolean isSaplingBlock(Block sapling){
- return (sapling == Blocks.sapling ? true : (sapling == Blocks.))
- }*/
+ /*
+ * public static boolean isSaplingBlock(Block sapling){ return (sapling == Blocks.sapling ? true : (sapling ==
+ * Blocks.)) }
+ */
public static BlockPos checkForLogsInGrowArea(final IGregTechTileEntity aBaseMetaTileEntity) {
- final int xDir =
- net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing())
- .offsetX
- * 7;
- final int zDir =
- net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing())
- .offsetZ
- * 7;
+ final int xDir = net.minecraftforge.common.util.ForgeDirection
+ .getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7;
+ final int zDir = net.minecraftforge.common.util.ForgeDirection
+ .getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7;
for (int i = -7; i <= 7; i++) {
for (int j = -7; j <= 7; j++) {
for (int h = 0; h <= 1; h++) {
@@ -731,8 +733,8 @@ public class TreeFarmHelper {
final Block block = mWorld.getBlock(h.xPos, h.yPos, h.zPos);
if (block != null) {
final int dropMeta = mWorld.getBlockMetadata(h.xPos, h.yPos, h.zPos);
- final ArrayList<ItemStack> blockDrops =
- block.getDrops(mWorld, h.xPos, h.yPos, h.zPos, dropMeta, 0);
+ final ArrayList<ItemStack> blockDrops = block
+ .getDrops(mWorld, h.xPos, h.yPos, h.zPos, dropMeta, 0);
final ItemStack[] drops = ItemUtils.getBlockDrops(blockDrops);
mDrops.put(drops);
// Remove drop that was added to the bus.
@@ -804,13 +806,12 @@ public class TreeFarmHelper {
if (wood == null) {
return false;
}
- if (wood.isWood(world, x, y, z) || wood.getMaterial() == Material.sponge)
- if (detectTree(world, x, y, z)) {
- TreeChopTask chopper = new TreeChopTask(new ChunkPosition(x, y, z), checkFakePlayer(world), 128);
- FMLCommonHandler.instance().bus().register(chopper);
- // custom block breaking code, don't call vanilla code
- return true;
- }
+ if (wood.isWood(world, x, y, z) || wood.getMaterial() == Material.sponge) if (detectTree(world, x, y, z)) {
+ TreeChopTask chopper = new TreeChopTask(new ChunkPosition(x, y, z), checkFakePlayer(world), 128);
+ FMLCommonHandler.instance().bus().register(chopper);
+ // custom block breaking code, don't call vanilla code
+ return true;
+ }
// return onBlockStartBreak(stack, x, y, z, player);
return false;
}
@@ -852,8 +853,7 @@ public class TreeFarmHelper {
for (int offX = 0; offX < d; offX++) {
for (int offY = 0; offY < d; offY++) {
for (int offZ = 0; offZ < d; offZ++) {
- int xPos = pos.chunkPosX - 1 + offX,
- yPos = pos.chunkPosY - 1 + offY,
+ int xPos = pos.chunkPosX - 1 + offX, yPos = pos.chunkPosY - 1 + offY,
zPos = pos.chunkPosZ - 1 + offZ;
Block leaf = world.getBlock(xPos, yPos, zPos);
if (leaf != null && leaf.isLeaves(world, xPos, yPos, zPos)) {
@@ -912,7 +912,7 @@ public class TreeFarmHelper {
ChunkPosition pos;
while (left > 0) {
// completely done or can't do our job anymore?!
- if (blocks.isEmpty() /* || tags.getBoolean("Broken")*/) {
+ if (blocks.isEmpty() /* || tags.getBoolean("Broken") */) {
finish();
return;
}
@@ -956,8 +956,8 @@ public class TreeFarmHelper {
}
}
- public static void breakExtraBlock(
- World world, int x, int y, int z, int sidehit, EntityPlayer playerEntity, int refX, int refY, int refZ) {
+ public static void breakExtraBlock(World world, int x, int y, int z, int sidehit, EntityPlayer playerEntity,
+ int refX, int refY, int refZ) {
// prevent calling that stuff for air blocks, could lead to unexpected behaviour since it fires events
if (world.isAirBlock(x, y, z)) return;
@@ -981,8 +981,8 @@ public class TreeFarmHelper {
if (!ForgeHooks.canHarvestBlock(block, player, meta) || refStrength / strength > 10f) return;
// send the blockbreak event
- BlockEvent.BreakEvent event =
- ForgeHooks.onBlockBreakEvent(world, player.theItemInWorldManager.getGameType(), player, x, y, z);
+ BlockEvent.BreakEvent event = ForgeHooks
+ .onBlockBreakEvent(world, player.theItemInWorldManager.getGameType(), player, x, y, z);
if (event.isCanceled()) return;
if (player.capabilities.isCreativeMode) {
@@ -1007,8 +1007,8 @@ public class TreeFarmHelper {
// ItemInWorldManager.removeBlock
block.onBlockHarvested(world, x, y, z, meta, player);
- if (block.removedByPlayer(
- world, player, x, y, z, true)) // boolean is if block can be harvested, checked above
+ if (block.removedByPlayer(world, player, x, y, z, true)) // boolean is if block can be harvested, checked
+ // above
{
block.onBlockDestroyedByPlayer(world, x, y, z, meta);
block.harvestBlock(world, player, x, y, z, meta);
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/VolumetricFlaskHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/VolumetricFlaskHelper.java
index 72d6111b8a..52aeb864dd 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/VolumetricFlaskHelper.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/VolumetricFlaskHelper.java
@@ -1,17 +1,19 @@
package gtPlusPlus.xmod.gregtech.common.helpers;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.reflect.ReflectionUtils;
-import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
-import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
+
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
+
public class VolumetricFlaskHelper {
private static final Class sClassVolumetricFlask;
@@ -89,8 +91,8 @@ public class VolumetricFlaskHelper {
if (aStack != null && sMethodGetFlaskMaxCapacity != null) {
Item aItem = aStack.getItem();
if (sClassVolumetricFlask.isInstance(aItem)) {
- int aMaxCapacity =
- (int) ReflectionUtils.invokeNonBool(aItem, sMethodGetFlaskMaxCapacity, new Object[] {});
+ int aMaxCapacity = (int) ReflectionUtils
+ .invokeNonBool(aItem, sMethodGetFlaskMaxCapacity, new Object[] {});
return aMaxCapacity;
}
}
@@ -168,11 +170,11 @@ public class VolumetricFlaskHelper {
}
public static Item generateNewFlask(String unlocalized, String english, int maxCapacity) {
- Constructor aFlask = ReflectionUtils.getConstructor(
- sClassVolumetricFlask, new Class[] {String.class, String.class, int.class});
+ Constructor aFlask = ReflectionUtils
+ .getConstructor(sClassVolumetricFlask, new Class[] { String.class, String.class, int.class });
if (aFlask != null) {
- Object aInstance = ReflectionUtils.createNewInstanceFromConstructor(
- aFlask, new Object[] {unlocalized, english, maxCapacity});
+ Object aInstance = ReflectionUtils
+ .createNewInstanceFromConstructor(aFlask, new Object[] { unlocalized, english, maxCapacity });
if (aInstance != null && aInstance instanceof Item) {
Item aNewFlaskItem = (Item) aInstance;
return aNewFlaskItem;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Container.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Container.java
index 165941b1d2..f31337228b 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Container.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Container.java
@@ -1,6 +1,5 @@
package gtPlusPlus.xmod.gregtech.common.helpers.autocrafter;
-import gtPlusPlus.api.objects.Logger;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.*;
@@ -8,7 +7,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.world.World;
+import gtPlusPlus.api.objects.Logger;
+
public class AC_Helper_Container extends Container {
+
/** The crafting matrix inventory (3x3). */
public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
@@ -62,7 +64,8 @@ public class AC_Helper_Container extends Container {
@Override
public void onCraftMatrixChanged(IInventory p_75130_1_) {
this.craftResult.setInventorySlotContents(
- 0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
+ 0,
+ CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
Logger.INFO("Crafted " + this.craftResult.getStackInSlot(0));
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Utils.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Utils.java
index 6b8452eeed..6a2175f151 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Utils.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Utils.java
@@ -1,15 +1,15 @@
package gtPlusPlus.xmod.gregtech.common.helpers.autocrafter;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GT4Entity_AutoCrafter;
import java.util.*;
import java.util.Map.Entry;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GT4Entity_AutoCrafter;
+
public class AC_Helper_Utils {
// AC maps
- public static final Map<Integer, GT4Entity_AutoCrafter> sAutocrafterMap =
- new HashMap<Integer, GT4Entity_AutoCrafter>();
+ public static final Map<Integer, GT4Entity_AutoCrafter> sAutocrafterMap = new HashMap<Integer, GT4Entity_AutoCrafter>();
// Add Crafter
public static final int addCrafter(GT4Entity_AutoCrafter AC) {
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java
index f4eb274179..e490c3dd81 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java
@@ -2,13 +2,15 @@ package gtPlusPlus.xmod.gregtech.common.helpers.tesseract;
import static gtPlusPlus.core.lib.CORE.*;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractGenerator;
-import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractTerminal;
import java.util.*;
import java.util.Map.Entry;
+
import net.minecraft.entity.player.EntityPlayer;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractGenerator;
+import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractTerminal;
+
public class TesseractHelper {
/**
@@ -19,8 +21,8 @@ public class TesseractHelper {
*/
// Checks if a Generator is owned by a player.
- public static final boolean isGeneratorOwnedByPlayer(
- EntityPlayer player, GT_MetaTileEntity_TesseractGenerator generator) {
+ public static final boolean isGeneratorOwnedByPlayer(EntityPlayer player,
+ GT_MetaTileEntity_TesseractGenerator generator) {
if (player == null) {
Logger.WARNING("Failed. [isGeneratorOwnedByPlayer]");
return false;
@@ -46,26 +48,25 @@ public class TesseractHelper {
}
// Saves A Generator to the Players UUID map along with the Freq.
- public static final boolean setGeneratorOwnershipByPlayer(
- EntityPlayer player, int freq, GT_MetaTileEntity_TesseractGenerator generator) {
+ public static final boolean setGeneratorOwnershipByPlayer(EntityPlayer player, int freq,
+ GT_MetaTileEntity_TesseractGenerator generator) {
if (player == null) {
return false;
}
UUID playerIdentifier = player.getUniqueID();
Logger.WARNING("Setting Generator on " + freq + " for " + player.getDisplayName() + ".");
if (playerIdentifier != null) {
- Map<Integer, GT_MetaTileEntity_TesseractGenerator> playerOwned =
- sTesseractGeneratorOwnershipMap.get(playerIdentifier);
+ Map<Integer, GT_MetaTileEntity_TesseractGenerator> playerOwned = sTesseractGeneratorOwnershipMap
+ .get(playerIdentifier);
if (playerOwned == null || playerOwned.isEmpty()) {
- Map<Integer, GT_MetaTileEntity_TesseractGenerator> newOwnershipMap =
- new HashMap<Integer, GT_MetaTileEntity_TesseractGenerator>();
+ Map<Integer, GT_MetaTileEntity_TesseractGenerator> newOwnershipMap = new HashMap<Integer, GT_MetaTileEntity_TesseractGenerator>();
newOwnershipMap.put(freq, generator);
sTesseractGeneratorOwnershipMap.put(playerIdentifier, newOwnershipMap);
Logger.WARNING("Success! [Empty Map]");
return true;
} else if (sTesseractGeneratorOwnershipMap.containsKey(playerIdentifier)) {
- Map<Integer, GT_MetaTileEntity_TesseractGenerator> ownershipMap =
- sTesseractGeneratorOwnershipMap.get(playerIdentifier);
+ Map<Integer, GT_MetaTileEntity_TesseractGenerator> ownershipMap = sTesseractGeneratorOwnershipMap
+ .get(playerIdentifier);
if (!ownershipMap.containsKey(freq)) {
ownershipMap.put(freq, generator);
}
@@ -127,8 +128,8 @@ public class TesseractHelper {
*/
// Checks if a Terminal is owned by a player.
- public static final boolean isTerminalOwnedByPlayer(
- EntityPlayer player, GT_MetaTileEntity_TesseractTerminal generator) {
+ public static final boolean isTerminalOwnedByPlayer(EntityPlayer player,
+ GT_MetaTileEntity_TesseractTerminal generator) {
if (player == null) {
return false;
}
@@ -148,26 +149,25 @@ public class TesseractHelper {
}
// Saves A Terminal to the Players UUID map along with the Freq.
- public static final boolean setTerminalOwnershipByPlayer(
- EntityPlayer player, int freq, GT_MetaTileEntity_TesseractTerminal generator) {
+ public static final boolean setTerminalOwnershipByPlayer(EntityPlayer player, int freq,
+ GT_MetaTileEntity_TesseractTerminal generator) {
if (player == null) {
return false;
}
UUID playerIdentifier = player.getUniqueID();
if (playerIdentifier != null) {
Logger.WARNING("Setting Terminal on " + freq + " for " + player.getDisplayName() + ".");
- Map<Integer, GT_MetaTileEntity_TesseractTerminal> playerOwned =
- sTesseractTerminalOwnershipMap.get(playerIdentifier);
+ Map<Integer, GT_MetaTileEntity_TesseractTerminal> playerOwned = sTesseractTerminalOwnershipMap
+ .get(playerIdentifier);
if (playerOwned == null || playerOwned.isEmpty()) {
- Map<Integer, GT_MetaTileEntity_TesseractTerminal> newOwnershipMap =
- new HashMap<Integer, GT_MetaTileEntity_TesseractTerminal>();
+ Map<Integer, GT_MetaTileEntity_TesseractTerminal> newOwnershipMap = new HashMap<Integer, GT_MetaTileEntity_TesseractTerminal>();
newOwnershipMap.put(freq, generator);
sTesseractTerminalOwnershipMap.put(playerIdentifier, newOwnershipMap);
Logger.WARNING("Success! [Empty Map]");
return true;
} else if (sTesseractTerminalOwnershipMap.containsKey(playerIdentifier)) {
- Map<Integer, GT_MetaTileEntity_TesseractTerminal> ownershipMap =
- sTesseractTerminalOwnershipMap.get(playerIdentifier);
+ Map<Integer, GT_MetaTileEntity_TesseractTerminal> ownershipMap = sTesseractTerminalOwnershipMap
+ .get(playerIdentifier);
if (!ownershipMap.containsKey(freq)) {
ownershipMap.put(freq, generator);
}
@@ -225,8 +225,8 @@ public class TesseractHelper {
EntityPlayer player) {
UUID playerIdentifier = player.getUniqueID();
if (!sTesseractGeneratorOwnershipMap.isEmpty() && playerIdentifier != null) {
- Set<Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractGenerator>>> players =
- sTesseractGeneratorOwnershipMap.entrySet();
+ Set<Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractGenerator>>> players = sTesseractGeneratorOwnershipMap
+ .entrySet();
Iterator<Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractGenerator>>> i = players.iterator();
while (i.hasNext()) {
Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractGenerator>> current = i.next();
@@ -242,8 +242,8 @@ public class TesseractHelper {
EntityPlayer player) {
UUID playerIdentifier = player.getUniqueID();
if (!sTesseractTerminalOwnershipMap.isEmpty() && playerIdentifier != null) {
- Set<Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractTerminal>>> players =
- sTesseractTerminalOwnershipMap.entrySet();
+ Set<Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractTerminal>>> players = sTesseractTerminalOwnershipMap
+ .entrySet();
Iterator<Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractTerminal>>> i = players.iterator();
while (i.hasNext()) {
Entry<UUID, Map<Integer, GT_MetaTileEntity_TesseractTerminal>> current = i.next();
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java
index 1e45b7c60b..b9ba13fa3f 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java
@@ -1,12 +1,7 @@
package gtPlusPlus.xmod.gregtech.common.helpers.treefarm;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.api.objects.data.AutoMap;
-import gtPlusPlus.api.objects.minecraft.FakeBlockPos;
-import gtPlusPlus.api.objects.minecraft.FakeWorld;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.math.MathUtils;
import java.util.Random;
+
import net.minecraft.block.Block;
import net.minecraft.block.BlockSapling;
import net.minecraft.block.material.Material;
@@ -17,6 +12,13 @@ import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
import net.minecraftforge.common.util.ForgeDirection;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.FakeBlockPos;
+import gtPlusPlus.api.objects.minecraft.FakeWorld;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+
public class TreeGenerator {
private static final FakeTreeInFakeWorldGenerator mTreeData;
@@ -43,6 +45,7 @@ public class TreeGenerator {
}
public static class FakeTreeInFakeWorldGenerator extends WorldGenAbstractTree {
+
/** The minimum height of a generated tree. */
private final int minTreeHeight;
/** True if this tree should grow Vines. */
@@ -64,8 +67,8 @@ public class TreeGenerator {
this(4, 0, 0, false, 5000);
}
- public FakeTreeInFakeWorldGenerator(
- int aMinHeight, int aWoodMeta, int aLeafMeta, boolean aVines, int aTreeCount) {
+ public FakeTreeInFakeWorldGenerator(int aMinHeight, int aWoodMeta, int aLeafMeta, boolean aVines,
+ int aTreeCount) {
super(false);
this.minTreeHeight = aMinHeight;
this.metaWood = aWoodMeta;
@@ -93,8 +96,7 @@ public class TreeGenerator {
@Override
protected boolean func_150523_a(Block p_150523_1_) {
- return p_150523_1_.getMaterial() == Material.air
- || p_150523_1_.getMaterial() == Material.leaves
+ return p_150523_1_.getMaterial() == Material.air || p_150523_1_.getMaterial() == Material.leaves
|| p_150523_1_ == Blocks.grass
|| p_150523_1_ == Blocks.dirt
|| p_150523_1_ == Blocks.log
@@ -107,8 +109,7 @@ public class TreeGenerator {
protected boolean isReplaceable(World world, int x, int y, int z) {
FakeWorld aWorld = getWorld();
Block block = aWorld.getBlock(x, y, z);
- return block.isAir(null, x, y, z)
- || block.isLeaves(null, x, y, z)
+ return block.isAir(null, x, y, z) || block.isLeaves(null, x, y, z)
|| block.isWood(null, x, y, z)
|| func_150523_a(block);
}
@@ -201,12 +202,17 @@ public class TreeGenerator {
FakeBlockPos aBlockToGrowPlantOn = aWorld.getBlockAtCoords(aWorldX, aWorldY - 1, aWorldZ);
boolean isSoil = block2.canSustainPlant(
- aWorld, aWorldX, aWorldY - 1, aWorldZ, ForgeDirection.UP, (BlockSapling) Blocks.sapling);
+ aWorld,
+ aWorldX,
+ aWorldY - 1,
+ aWorldZ,
+ ForgeDirection.UP,
+ (BlockSapling) Blocks.sapling);
if (
- /*isSoil &&*/ aWorldY < 256 - l - 1) {
+ /* isSoil && */ aWorldY < 256 - l - 1) {
Logger.WARNING("Stepping through generateTree [4]");
- aBlockToGrowPlantOn.onPlantGrow(
- aWorld, aWorldX, aWorldY - 1, aWorldZ, aWorldX, aWorldY, aWorldZ);
+ aBlockToGrowPlantOn
+ .onPlantGrow(aWorld, aWorldX, aWorldY - 1, aWorldZ, aWorldX, aWorldY, aWorldZ);
b0 = 3;
byte b1 = 0;
int l1;
@@ -224,14 +230,18 @@ public class TreeGenerator {
for (int k2 = aWorldZ - l1; k2 <= aWorldZ + l1; ++k2) {
int l2 = k2 - aWorldZ;
- if (Math.abs(j2) != l1
- || Math.abs(l2) != l1
+ 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(null, i2, k1, k2) || block1.isLeaves(null, i2, k1, k2)) {
this.setBlockAndNotifyAdequately(
- aWorld, i2, k1, k2, Blocks.leaves, this.metaLeaves);
+ aWorld,
+ i2,
+ k1,
+ k2,
+ Blocks.leaves,
+ this.metaLeaves);
}
}
}
@@ -245,31 +255,56 @@ public class TreeGenerator {
if (block.isAir(null, aWorldX, aWorldY + k1, aWorldZ)
|| block.isLeaves(null, aWorldX, aWorldY + k1, aWorldZ)) {
this.setBlockAndNotifyAdequately(
- aWorld, aWorldX, aWorldY + k1, aWorldZ, Blocks.log, this.metaWood);
+ 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);
+ 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);
+ 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);
+ 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);
+ aWorld,
+ aWorldX,
+ aWorldY + k1,
+ aWorldZ + 1,
+ Blocks.vine,
+ 4);
}
}
}
@@ -286,26 +321,22 @@ public class TreeGenerator {
for (j2 = aWorldZ - l1; j2 <= aWorldZ + l1; ++j2) {
if (aWorld.getBlock(i2, k1, j2).isLeaves(null, i2, k1, j2)) {
if (CORE.RANDOM.nextInt(4) == 0
- && aWorld.getBlock(i2 - 1, k1, j2)
- .isAir(null, i2 - 1, k1, j2)) {
+ && aWorld.getBlock(i2 - 1, k1, j2).isAir(null, 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(null, i2 + 1, k1, j2)) {
+ && aWorld.getBlock(i2 + 1, k1, j2).isAir(null, 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(null, i2, k1, j2 - 1)) {
+ && aWorld.getBlock(i2, k1, j2 - 1).isAir(null, 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(null, i2, k1, j2 + 1)) {
+ && aWorld.getBlock(i2, k1, j2 + 1).isAir(null, i2, k1, j2 + 1)) {
this.growVines(aWorld, i2, k1, j2 + 1, 4);
}
}
@@ -361,8 +392,16 @@ public class TreeGenerator {
protected void setBlockAndNotifyAdequately(FakeWorld aWorld, int aX, int aY, int aZ, Block aBlock, int aMeta) {
if (aBlock != null && (aMeta >= 0 && aMeta <= Short.MAX_VALUE)) {
- Logger.WARNING("Setting block " + aX + ", " + aY + ", " + aZ + " | " + aBlock.getLocalizedName() + " | "
- + aMeta);
+ Logger.WARNING(
+ "Setting block " + aX
+ + ", "
+ + aY
+ + ", "
+ + aZ
+ + " | "
+ + aBlock.getLocalizedName()
+ + " | "
+ + aMeta);
aWorld.setBlockAtCoords(aX, aY, aZ, aBlock, aMeta);
// aOutputsFromGenerator.put(ItemUtils.simpleMetaStack(aBlock, aMeta, 1));
}