aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-07-26 04:23:36 +0100
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2019-07-26 04:23:36 +0100
commit9fe3f693f1d6d015f45898818b7958b3a57a9f4a (patch)
tree1e35a386d5ab58244e6a6e8249f947b321de5828
parent5a3076e52ea188c69851e0c8711937485123dc18 (diff)
downloadGT5-Unofficial-9fe3f693f1d6d015f45898818b7958b3a57a9f4a.tar.gz
GT5-Unofficial-9fe3f693f1d6d015f45898818b7958b3a57a9f4a.tar.bz2
GT5-Unofficial-9fe3f693f1d6d015f45898818b7958b3a57a9f4a.zip
+ Added config option to adjust ingame BGM delays. (Should be working)
+ Added a Pest Killer for quick removal of Butterflies and Bats. + Added Hydrogen Cyanide. % Replaced existing assets for the Bat King. % Replaced Bat King Logic, it's now an offensive mob. $ Fixed Bat King model scaling.
-rw-r--r--src/Java/gtPlusPlus/GTplusplus.java2
-rw-r--r--src/Java/gtPlusPlus/api/interfaces/IPlugin.java3
-rw-r--r--src/Java/gtPlusPlus/api/objects/Logger.java2
-rw-r--r--src/Java/gtPlusPlus/api/plugin/Sample_Plugin.java10
-rw-r--r--src/Java/gtPlusPlus/core/block/ModBlocks.java5
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/Machine_PestKiller.java137
-rw-r--r--src/Java/gtPlusPlus/core/client/model/ModelBatKing.java120
-rw-r--r--src/Java/gtPlusPlus/core/client/renderer/RenderBatKing.java42
-rw-r--r--src/Java/gtPlusPlus/core/config/ConfigHandler.java1
-rw-r--r--src/Java/gtPlusPlus/core/container/Container_PestKiller.java154
-rw-r--r--src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java540
-rw-r--r--src/Java/gtPlusPlus/core/gui/machine/GUI_PestKiller.java161
-rw-r--r--src/Java/gtPlusPlus/core/handler/GuiHandler.java9
-rw-r--r--src/Java/gtPlusPlus/core/inventories/InventoryPestKiller.java176
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java55
-rw-r--r--src/Java/gtPlusPlus/core/lib/CORE.java2
-rw-r--r--src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java16
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotGeneric.java5
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java20
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java506
-rw-r--r--src/Java/gtPlusPlus/core/util/Utils.java45
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java12
-rw-r--r--src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java38
-rw-r--r--src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java10
-rw-r--r--src/Java/gtPlusPlus/plugin/fishing/Core_Fishing.java10
-rw-r--r--src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java13
-rw-r--r--src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBackgroundMusicFix.java59
-rw-r--r--src/Java/gtPlusPlus/plugin/fixes/vanilla/music/MusicTocker.java130
-rw-r--r--src/Java/gtPlusPlus/plugin/manager/Core_Manager.java32
-rw-r--r--src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java10
-rw-r--r--src/Java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java16
-rw-r--r--src/Java/gtPlusPlus/plugin/waila/Core_WailaPlugin.java10
-rw-r--r--src/Java/gtPlusPlus/preloader/CORE_Preloader.java3
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java25
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer.java29
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java8
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java8
-rw-r--r--src/resources/assets/miscutils/lang/en_US.lang3
-rw-r--r--src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_PESTKILLER_TOP.pngbin0 -> 624 bytes
-rw-r--r--src/resources/assets/miscutils/textures/entity/batKing.pngbin0 -> 1994 bytes
-rw-r--r--src/resources/assets/miscutils/textures/gui/PestKiller.pngbin0 -> 1833 bytes
41 files changed, 2082 insertions, 345 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java
index c51b2e2997..9813e550ad 100644
--- a/src/Java/gtPlusPlus/GTplusplus.java
+++ b/src/Java/gtPlusPlus/GTplusplus.java
@@ -238,12 +238,14 @@ public class GTplusplus implements ActionListener {
if (LoadedMods.Thaumcraft) {
event.registerServerCommand(new CommandDumpAspects());
}
+ Core_Manager.serverStart();
INIT_PHASE.STARTED.setPhaseActive(true);
}
@Mod.EventHandler
public synchronized void serverStopping(final FMLServerStoppingEvent event) {
mChunkLoading.serverStopping(event);
+ Core_Manager.serverStop();
if (GregtechBufferThread.mBufferThreadAllocation.size() > 0) {
for (GregtechBufferThread i : GregtechBufferThread.mBufferThreadAllocation.values()) {
i.destroy();
diff --git a/src/Java/gtPlusPlus/api/interfaces/IPlugin.java b/src/Java/gtPlusPlus/api/interfaces/IPlugin.java
index c3840476e9..67be182402 100644
--- a/src/Java/gtPlusPlus/api/interfaces/IPlugin.java
+++ b/src/Java/gtPlusPlus/api/interfaces/IPlugin.java
@@ -34,4 +34,7 @@ public interface IPlugin {
public boolean init();
public boolean postInit();
+ public boolean serverStart();
+ public boolean serverStop();
+
}
diff --git a/src/Java/gtPlusPlus/api/objects/Logger.java b/src/Java/gtPlusPlus/api/objects/Logger.java
index f994c40b52..616a241d89 100644
--- a/src/Java/gtPlusPlus/api/objects/Logger.java
+++ b/src/Java/gtPlusPlus/api/objects/Logger.java
@@ -112,7 +112,7 @@ public class Logger {
* Special Logger for Materials related content
*/
public static void MATERIALS(final String s) {
- if (CORE.DEVENV || CORE.DEBUG)
+ if (/* CORE.DEVENV || */CORE.DEBUG)
modLogger.info("[Materials] "+s);
}
/**
diff --git a/src/Java/gtPlusPlus/api/plugin/Sample_Plugin.java b/src/Java/gtPlusPlus/api/plugin/Sample_Plugin.java
index 82671acaea..543ec8e1fa 100644
--- a/src/Java/gtPlusPlus/api/plugin/Sample_Plugin.java
+++ b/src/Java/gtPlusPlus/api/plugin/Sample_Plugin.java
@@ -25,6 +25,16 @@ public final class Sample_Plugin implements IPlugin {
}
@Override
+ public boolean serverStart() {
+ return true;
+ }
+
+ @Override
+ public boolean serverStop() {
+ return true;
+ }
+
+ @Override
public String getPluginName() {
return "Sample Plugin";
}
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java
index b904b04556..b59facf9e2 100644
--- a/src/Java/gtPlusPlus/core/block/ModBlocks.java
+++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java
@@ -18,6 +18,7 @@ import gtPlusPlus.core.block.machine.DecayablesChest;
import gtPlusPlus.core.block.machine.FishTrap;
import gtPlusPlus.core.block.machine.HeliumGenerator;
import gtPlusPlus.core.block.machine.Machine_ModularityTable;
+import gtPlusPlus.core.block.machine.Machine_PestKiller;
import gtPlusPlus.core.block.machine.Machine_PooCollector;
import gtPlusPlus.core.block.machine.Machine_ProjectTable;
import gtPlusPlus.core.block.machine.Machine_SuperJukebox;
@@ -91,6 +92,8 @@ public final class ModBlocks {
public static Block blockCustomJukebox;
public static Block blockPooCollector;
+
+ public static Block blockPestKiller;
public static void init() {
Logger.INFO("Initializing Blocks.");
@@ -142,6 +145,8 @@ public final class ModBlocks {
blockCustomJukebox = new Machine_SuperJukebox();
blockPooCollector = new Machine_PooCollector();
+
+ blockPestKiller = new Machine_PestKiller();
new BlockGenericRedstoneDetector();
new BlockGenericRedstoneTest();
diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_PestKiller.java b/src/Java/gtPlusPlus/core/block/machine/Machine_PestKiller.java
new file mode 100644
index 0000000000..11fa80f439
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/block/machine/Machine_PestKiller.java
@@ -0,0 +1,137 @@
+package gtPlusPlus.core.block.machine;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.common.registry.LanguageRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.GTplusplus;
+import gtPlusPlus.api.interfaces.ITileTooltip;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.handler.GuiHandler;
+import gtPlusPlus.core.item.base.itemblock.ItemBlockBasicTile;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller;
+import gtPlusPlus.core.util.minecraft.InventoryUtils;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.EnumCreatureType;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+public class Machine_PestKiller extends BlockContainer implements ITileTooltip
+{
+ @SideOnly(Side.CLIENT)
+ private IIcon textureTop;
+ @SideOnly(Side.CLIENT)
+ private IIcon textureBottom;
+ @SideOnly(Side.CLIENT)
+ private IIcon textureFront;
+
+ /**
+ * Determines which tooltip is displayed within the itemblock.
+ */
+ private final int mTooltipID = 6;
+
+ @Override
+ public int getTooltipID() {
+ return this.mTooltipID;
+ }
+
+ @SuppressWarnings("deprecation")
+ public Machine_PestKiller()
+ {
+ super(Material.wood);
+ this.setBlockName("blockPestKiller");
+ this.setHardness(5f);
+ this.setResistance(1f);
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockPestKiller");
+ LanguageRegistry.addName(this, "Pest Killer");
+
+ }
+
+ /**
+ * Gets the block's texture. Args: side, meta
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(final int aSide, final int p_149691_2_)
+ {
+ return aSide == 1 ? this.textureTop : (aSide == 0 ? this.textureBottom : this.textureFront);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(final IIconRegister p_149651_1_)
+ {
+ this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "MACHINE_CASING_FARM_MANAGER_STRUCTURAL");
+ this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "MACHINE_PESTKILLER_TOP");
+ this.textureBottom = p_149651_1_.registerIcon("planks_acacia");
+ this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "MACHINE_CASING_FARM_MANAGER_STRUCTURAL");
+ }
+
+ /**
+ * Called upon block activation (right click on the block.)
+ */
+ @Override
+ public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz)
+ {
+ if (world.isRemote) {
+ return true;
+ }
+
+ final TileEntity te = world.getTileEntity(x, y, z);
+ if ((te != null) && (te instanceof TileEntityPestKiller)){
+ player.openGui(GTplusplus.instance, GuiHandler.GUI15, world, x, y, z);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public int getRenderBlockPass() {
+ return 0;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
+ return new TileEntityPestKiller();
+ }
+
+ @Override
+ public void onBlockAdded(final World world, final int x, final int y, final int z) {
+ super.onBlockAdded(world, x, y, z);
+ }
+
+ @Override
+ public void breakBlock(final World world, final int x, final int y, final int z, final Block block, final int number) {
+ InventoryUtils.dropInventoryItems(world, x, y, z, block);
+ super.breakBlock(world, x, y, z, block, number);
+ }
+
+ @Override
+ public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase entity, final ItemStack stack) {
+ if (stack.hasDisplayName()) {
+ ((TileEntityPestKiller) world.getTileEntity(x,y,z)).setCustomName(stack.getDisplayName());
+ }
+ }
+
+ @Override
+ public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) {
+ return false;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/client/model/ModelBatKing.java b/src/Java/gtPlusPlus/core/client/model/ModelBatKing.java
new file mode 100644
index 0000000000..ac64dee26a
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/client/model/ModelBatKing.java
@@ -0,0 +1,120 @@
+package gtPlusPlus.core.client.model;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.core.entity.monster.EntityBatKing;
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.model.ModelRenderer;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.passive.EntityBat;
+import net.minecraft.util.MathHelper;
+
+@SideOnly(Side.CLIENT)
+public class ModelBatKing extends ModelBase
+{
+ private ModelRenderer batHead;
+ /** The body box of the bat model. */
+ private ModelRenderer batBody;
+ /** The inner right wing box of the bat model. */
+ private ModelRenderer batRightWing;
+ /** The inner left wing box of the bat model. */
+ private ModelRenderer batLeftWing;
+ /** The outer right wing box of the bat model. */
+ private ModelRenderer batOuterRightWing;
+ /** The outer left wing box of the bat model. */
+ private ModelRenderer batOuterLeftWing;
+
+ public ModelBatKing()
+ {
+ this.textureWidth = 64;
+ this.textureHeight = 64;
+
+ this.batHead = new ModelRenderer(this, 0, 0);
+ this.batHead.addBox(-3.0F, -3.0F, -3.0F, 6, 6, 6);
+ ModelRenderer modelrenderer = new ModelRenderer(this, 24, 0);
+ modelrenderer.addBox(-4.0F, -6.0F, -2.0F, 3, 4, 1);
+ this.batHead.addChild(modelrenderer);
+ ModelRenderer modelrenderer1 = new ModelRenderer(this, 24, 0);
+ modelrenderer1.mirror = true;
+ modelrenderer1.addBox(1.0F, -6.0F, -2.0F, 3, 4, 1);
+ this.batHead.addChild(modelrenderer1);
+ this.batBody = new ModelRenderer(this, 0, 16);
+ this.batBody.addBox(-3.0F, 4.0F, -3.0F, 6, 12, 6);
+ this.batBody.setTextureOffset(0, 34).addBox(-5.0F, 16.0F, 0.0F, 10, 6, 1);
+ this.batRightWing = new ModelRenderer(this, 42, 0);
+ this.batRightWing.addBox(-12.0F, 1.0F, 1.5F, 10, 16, 1);
+ this.batOuterRightWing = new ModelRenderer(this, 24, 16);
+ this.batOuterRightWing.setRotationPoint(-12.0F, 1.0F, 1.5F);
+ this.batOuterRightWing.addBox(-8.0F, 1.0F, 0.0F, 8, 12, 1);
+ this.batLeftWing = new ModelRenderer(this, 42, 0);
+ this.batLeftWing.mirror = true;
+ this.batLeftWing.addBox(2.0F, 1.0F, 1.5F, 10, 16, 1);
+ this.batOuterLeftWing = new ModelRenderer(this, 24, 16);
+ this.batOuterLeftWing.mirror = true;
+ this.batOuterLeftWing.setRotationPoint(12.0F, 1.0F, 1.5F);
+ this.batOuterLeftWing.addBox(0.0F, 1.0F, 0.0F, 8, 12, 1);
+ this.batBody.addChild(this.batRightWing);
+ this.batBody.addChild(this.batLeftWing);
+ this.batRightWing.addChild(this.batOuterRightWing);
+ this.batLeftWing.addChild(this.batOuterLeftWing);
+ }
+
+ /**
+ * not actually sure this is size, is not used as of now, but the model would be recreated if the value changed and
+ * it seems a good match for a bats size
+ */
+ public int getBatSize()
+ {
+ return 72;
+ }
+
+ /**
+ * Sets the models various rotation angles then renders the model.
+ */
+ public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_)
+ {
+ EntityBatKing entitybat = (EntityBatKing)p_78088_1_;
+ float f6;
+
+ if (entitybat.getIsBatHanging())
+ {
+ f6 = (180F / (float)Math.PI);
+ this.batHead.rotateAngleX = p_78088_6_ / (180F / (float)Math.PI);
+ this.batHead.rotateAngleY = (float)Math.PI - p_78088_5_ / (180F / (float)Math.PI);
+ this.batHead.rotateAngleZ = (float)Math.PI;
+ this.batHead.setRotationPoint(0.0F, -2.0F, 0.0F);
+ this.batRightWing.setRotationPoint(-3.0F, 0.0F, 3.0F);
+ this.batLeftWing.setRotationPoint(3.0F, 0.0F, 3.0F);
+ this.batBody.rotateAngleX = (float)Math.PI;
+ this.batRightWing.rotateAngleX = -0.15707964F;
+ this.batRightWing.rotateAngleY = -((float)Math.PI * 2F / 5F);
+ this.batOuterRightWing.rotateAngleY = -1.7278761F;
+ this.batLeftWing.rotateAngleX = this.batRightWing.rotateAngleX;
+ this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY;
+ this.batOuterLeftWing.rotateAngleY = -this.batOuterRightWing.rotateAngleY;
+ }
+ else
+ {
+ f6 = (180F / (float)Math.PI);
+ this.batHead.rotateAngleX = p_78088_6_ / (180F / (float)Math.PI);
+ this.batHead.rotateAngleY = p_78088_5_ / (180F / (float)Math.PI);
+ this.batHead.rotateAngleZ = 0.0F;
+ this.batHead.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.batRightWing.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.batLeftWing.setRotationPoint(0.0F, 0.0F, 0.0F);
+ this.batBody.rotateAngleX = ((float)Math.PI / 4F) + MathHelper.cos(p_78088_4_ * 0.1F) * 0.15F;
+ this.batBody.rotateAngleY = 0.0F;
+ this.batRightWing.rotateAngleY = MathHelper.cos(p_78088_4_ * 1.3F) * (float)Math.PI * 0.25F;
+ this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY;
+ this.batOuterRightWing.rotateAngleY = this.batRightWing.rotateAngleY * 0.5F;
+ this.batOuterLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY * 0.5F;
+ }
+
+
+ GL11.glScalef(4, 4, 4);
+ this.batHead.render(p_78088_7_);
+ this.batBody.render(p_78088_7_);
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderBatKing.java b/src/Java/gtPlusPlus/core/client/renderer/RenderBatKing.java
index fb260eedeb..000badb80f 100644
--- a/src/Java/gtPlusPlus/core/client/renderer/RenderBatKing.java
+++ b/src/Java/gtPlusPlus/core/client/renderer/RenderBatKing.java
@@ -1,21 +1,23 @@
package gtPlusPlus.core.client.renderer;
+import org.lwjgl.opengl.GL11;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-import net.minecraft.client.model.ModelBat;
+import gtPlusPlus.core.client.model.ModelBatKing;
+import gtPlusPlus.core.entity.monster.EntityBatKing;
+import gtPlusPlus.core.lib.CORE;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.passive.EntityBat;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
-import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class RenderBatKing extends RenderLiving {
- private static final ResourceLocation batTextures = new ResourceLocation("textures/entity/bat.png");
+ private static final ResourceLocation batTextures = new ResourceLocation(CORE.MODID+":"+"textures/entity/batKing.png");
/**
* not actually sure this is size, is not used as of now, but the model would be
@@ -24,8 +26,8 @@ public class RenderBatKing extends RenderLiving {
private int renderedBatSize;
public RenderBatKing() {
- super(new ModelBat(), 1F);
- this.renderedBatSize = ((ModelBat) this.mainModel).getBatSize();
+ super(new ModelBatKing(), 0.7F);
+ this.renderedBatSize = (((ModelBatKing) this.mainModel).getBatSize());
}
/**
@@ -36,13 +38,13 @@ public class RenderBatKing extends RenderLiving {
* func_76986_a(T entity, double d, double d1, double d2, float f, float f1).
* But JAD is pre 1.5 so doesn't do that.
*/
- public void doRender(EntityBat p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_,
+ public void doRender(EntityBatKing p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_,
float p_76986_8_, float p_76986_9_) {
- int i = ((ModelBat) this.mainModel).getBatSize();
+ int i = ((ModelBatKing) this.mainModel).getBatSize();
if (i != this.renderedBatSize) {
this.renderedBatSize = i;
- this.mainModel = new ModelBat();
+ this.mainModel = new ModelBatKing();
}
super.doRender((EntityLiving) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
@@ -52,7 +54,7 @@ public class RenderBatKing extends RenderLiving {
* Returns the location of an entity's texture. Doesn't seem to be called unless
* you call Render.bindEntityTexture.
*/
- protected ResourceLocation getEntityTexture(EntityBat p_110775_1_) {
+ protected ResourceLocation getEntityTexture(EntityBatKing p_110775_1_) {
return batTextures;
}
@@ -60,18 +62,18 @@ public class RenderBatKing extends RenderLiving {
* Allows the render to do any OpenGL state modifications necessary before the
* model is rendered. Args: entityLiving, partialTickTime
*/
- protected void preRenderCallback(EntityBat p_77041_1_, float p_77041_2_) {
+ protected void preRenderCallback(EntityBatKing p_77041_1_, float p_77041_2_) {
GL11.glScalef(0.35F, 0.35F, 0.35F);
}
/**
* Sets a simple glTranslate on a LivingEntity.
*/
- protected void renderLivingAt(EntityBat p_77039_1_, double p_77039_2_, double p_77039_4_, double p_77039_6_) {
+ protected void renderLivingAt(EntityBatKing p_77039_1_, double p_77039_2_, double p_77039_4_, double p_77039_6_) {
super.renderLivingAt(p_77039_1_, p_77039_2_, p_77039_4_, p_77039_6_);
}
- protected void rotateCorpse(EntityBat p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) {
+ protected void rotateCorpse(EntityBatKing p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) {
if (!p_77043_1_.getIsBatHanging()) {
GL11.glTranslatef(0.0F, MathHelper.cos(p_77043_2_ * 0.3F) * 0.1F, 0.0F);
} else {
@@ -91,7 +93,7 @@ public class RenderBatKing extends RenderLiving {
*/
public void doRender(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_,
float p_76986_8_, float p_76986_9_) {
- this.doRender((EntityBat) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
+ this.doRender((EntityBatKing) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
/**
@@ -99,11 +101,11 @@ public class RenderBatKing extends RenderLiving {
* model is rendered. Args: entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityLivingBase p_77041_1_, float p_77041_2_) {
- this.preRenderCallback((EntityBat) p_77041_1_, p_77041_2_);
+ this.preRenderCallback((EntityBatKing) p_77041_1_, p_77041_2_);
}
protected void rotateCorpse(EntityLivingBase p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) {
- this.rotateCorpse((EntityBat) p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_);
+ this.rotateCorpse((EntityBatKing) p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_);
}
/**
@@ -111,7 +113,7 @@ public class RenderBatKing extends RenderLiving {
*/
protected void renderLivingAt(EntityLivingBase p_77039_1_, double p_77039_2_, double p_77039_4_,
double p_77039_6_) {
- this.renderLivingAt((EntityBat) p_77039_1_, p_77039_2_, p_77039_4_, p_77039_6_);
+ this.renderLivingAt((EntityBatKing) p_77039_1_, p_77039_2_, p_77039_4_, p_77039_6_);
}
/**
@@ -124,7 +126,7 @@ public class RenderBatKing extends RenderLiving {
*/
public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_,
float p_76986_8_, float p_76986_9_) {
- this.doRender((EntityBat) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
+ this.doRender((EntityBatKing) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
/**
@@ -132,7 +134,7 @@ public class RenderBatKing extends RenderLiving {
* you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
- return this.getEntityTexture((EntityBat) p_110775_1_);
+ return this.getEntityTexture((EntityBatKing) p_110775_1_);
}
/**
@@ -145,6 +147,6 @@ public class RenderBatKing extends RenderLiving {
*/
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_,
float p_76986_9_) {
- this.doRender((EntityBat) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
+ this.doRender((EntityBatKing) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/config/ConfigHandler.java b/src/Java/gtPlusPlus/core/config/ConfigHandler.java
index 89c1324a54..ecaf031030 100644
--- a/src/Java/gtPlusPlus/core/config/ConfigHandler.java
+++ b/src/Java/gtPlusPlus/core/config/ConfigHandler.java
@@ -176,6 +176,7 @@ public class ConfigHandler {
"Enables Custom GT++ Cape.");
disableZombieReinforcement = config.getBoolean("disableZombieReinforcement", "features", false,
"Disables Zombie Reinforcement on hard difficutly.");
+ enableWatchdogBGM = config.getInt("enableWatchdogBGM", "features", 0, 0, Short.MAX_VALUE, "Set to a value greater than 0 to reduce the ticks taken to delay between BGM tracks. Acceptable Values are 1-32767, where 0 is disabled. Vanilla Uses 12,000 & 24,000. 200 is 10s.");
//Biomes
EVERGLADES_ID = config.getInt("darkworld_ID", "worldgen", 227, 1, 254, "The ID of the Dark Dimension.");
diff --git a/src/Java/gtPlusPlus/core/container/Container_PestKiller.java b/src/Java/gtPlusPlus/core/container/Container_PestKiller.java
new file mode 100644
index 0000000000..2f25c5aace
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/container/Container_PestKiller.java
@@ -0,0 +1,154 @@
+package gtPlusPlus.core.container;
+
+import gregtech.api.gui.GT_Slot_Render;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.inventories.InventoryPestKiller;
+import gtPlusPlus.core.slots.SlotGeneric;
+import gtPlusPlus.core.slots.SlotNoInput;
+import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import net.minecraftforge.fluids.FluidStack;
+
+public class Container_PestKiller extends Container {
+
+ public TileEntityPestKiller tile_entity;
+ public final InventoryPestKiller inventoryChest;
+
+ private final World worldObj;
+ private final int posX;
+ private final int posY;
+ private final int posZ;
+
+ public static int StorageSlotNumber = 3; // Number of slots in storage area
+ public static int InventorySlotNumber = 36; // Inventory Slots (Inventory
+ // and Hotbar)
+ public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All
+ // slots
+
+ public Container_PestKiller(final InventoryPlayer inventory, final TileEntityPestKiller te) {
+ this.tile_entity = te;
+ this.inventoryChest = te.getInventory();
+ te.openInventory();
+ int var6;
+ int var7;
+ this.worldObj = te.getWorldObj();
+ this.posX = te.xCoord;
+ this.posY = te.yCoord;
+ this.posZ = te.zCoord;
+ int o = 0;
+
+ int aSlotX = 134;
+
+ this.addSlotToContainer(new SlotGeneric(this.inventoryChest, o++, aSlotX, 10));
+ this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, aSlotX, 60));
+ addSlotToContainer(new GT_Slot_Render(tile_entity, o++, aSlotX, 35));
+
+ // Player Inventory
+ for (var6 = 0; var6 < 3; ++var6) {
+ for (var7 = 0; var7 < 9; ++var7) {
+ this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18)));
+ }
+ }
+
+ // Player Hotbar
+ for (var6 = 0; var6 < 9; ++var6) {
+ this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142));
+ }
+
+ }
+
+ public FluidStack getFluidOfStoredTank() {
+ if (tile_entity != null) {
+ if (tile_entity.getTank() != null) {
+ return tile_entity.getTank().getFluid();
+ }
+ }
+ return null;
+ }
+
+ public int getFluidStoredAmount() {
+ FluidStack f = getFluidOfStoredTank();
+ return f == null ? 0 : f.amount;
+ }
+
+ @Override
+ public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) {
+ boolean fluid = false;
+ if (aSlotIndex == 2) {
+ fluid = true;
+ }
+ if (!fluid) {
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public void onContainerClosed(final EntityPlayer par1EntityPlayer) {
+ super.onContainerClosed(par1EntityPlayer);
+ tile_entity.closeInventory();
+ }
+
+ @Override
+ public boolean canInteractWith(final EntityPlayer par1EntityPlayer) {
+ if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockPestKiller) {
+ return false;
+ }
+ return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D;
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) {
+ ItemStack var3 = null;
+ final Slot var4 = (Slot) this.inventorySlots.get(par2);
+
+ if ((var4 != null) && var4.getHasStack()) {
+ final ItemStack var5 = var4.getStack();
+ var3 = var5.copy();
+
+ /*
+ * if (par2 == 0) { if (!this.mergeItemStack(var5,
+ * InOutputSlotNumber, FullSlotNumber, true)) { return null; }
+ *
+ * var4.onSlotChange(var5, var3); } else if (par2 >=
+ * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if
+ * (!this.mergeItemStack(var5, InventoryOutSlotNumber,
+ * FullSlotNumber, false)) { return null; } } else if (par2 >=
+ * InventoryOutSlotNumber && par2 < FullSlotNumber) { if
+ * (!this.mergeItemStack(var5, InOutputSlotNumber,
+ * InventoryOutSlotNumber, false)) { return null; } } else if
+ * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber,
+ * false)) { return null; }
+ */
+
+ if (var5.stackSize == 0) {
+ var4.putStack((ItemStack) null);
+ } else {
+ var4.onSlotChanged();
+ }
+
+ if (var5.stackSize == var3.stackSize) {
+ return null;
+ }
+
+ var4.onPickupFromSlot(par1EntityPlayer, var5);
+ }
+
+ return var3;
+ }
+
+ // Can merge Slot
+ @Override
+ public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) {
+ return super.func_94530_a(p_94530_1_, p_94530_2_);
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java b/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java
index 114ca50b4b..ae8c8f38b8 100644
--- a/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java
+++ b/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java
@@ -1,228 +1,338 @@
package gtPlusPlus.core.entity.monster;
import java.util.Calendar;
+
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.EnumCreatureAttribute;
+import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.entity.SharedMonsterAttributes;
+import net.minecraft.entity.ai.EntityAIArrowAttack;
+import net.minecraft.entity.ai.EntityAIAttackOnCollide;
+import net.minecraft.entity.ai.EntityAIFleeSun;
+import net.minecraft.entity.ai.EntityAIHurtByTarget;
+import net.minecraft.entity.ai.EntityAILookIdle;
+import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
+import net.minecraft.entity.ai.EntityAIRestrictSun;
+import net.minecraft.entity.ai.EntityAIWander;
+import net.minecraft.entity.ai.EntityAIWatchClosest;
+import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.passive.EntityBat;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
-public class EntityBatKing extends EntityBat
-{
- /** Coordinates of where the bat spawned. */
- private ChunkCoordinates spawnPosition;
-
- public EntityBatKing(World p_i1680_1_)
- {
- super(p_i1680_1_);
- this.setSize(2F, 3.6F);
- this.setIsBatHanging(false);
- }
-
- protected void entityInit()
- {
- super.entityInit();
- }
-
- /**
- * Returns the volume for the sounds this mob makes.
- */
- protected float getSoundVolume()
- {
- return 0.3F;
- }
-
- /**
- * Gets the pitch of living sounds in living entities.
- */
- protected float getSoundPitch()
- {
- return super.getSoundPitch() * 0.35F;
- }
-
- /**
- * Returns the sound this mob makes while it's alive.
- */
- protected String getLivingSound()
- {
- return this.getIsBatHanging() && this.rand.nextInt(4) != 0 ? null : "mob.bat.idle";
- }
-
- /**
- * Returns the sound this mob makes when it is hurt.
- */
- protected String getHurtSound()
- {
- return "mob.bat.hurt";
- }
-
- /**
- * Returns the sound this mob makes on death.
- */
- protected String getDeathSound()
- {
- return "mob.bat.death";
- }
-
- /**
- * Returns true if this entity should push and be pushed by other entities when colliding.
- */
- public boolean canBePushed()
- {
- return false;
- }
-
- protected void collideWithEntity(Entity p_82167_1_) {}
-
- protected void collideWithNearbyEntities() {}
-
- protected void applyEntityAttributes()
- {
- super.applyEntityAttributes();
- this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(60.0D);
- }
-
- public boolean getIsBatHanging()
- {
- return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0;
- }
-
- public void setIsBatHanging(boolean p_82236_1_)
- {
- byte b0 = this.dataWatcher.getWatchableObjectByte(16);
-
- if (p_82236_1_)
- {
- this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1)));
- }
- else
- {
- this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2)));
- }
- }
-
- /**
- * Returns true if the newer Entity AI code should be run
- */
- protected boolean isAIEnabled()
- {
- return true;
- }
-
- /**
- * Called to update the entity's position/logic.
- */
- public void onUpdate()
- {
- super.onUpdate();
- }
-
- protected void updateAITasks()
- {
- super.updateAITasks();
-
- }
-
- /**
- * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
- * prevent them from trampling crops
- */
- protected boolean canTriggerWalking()
- {
- return false;
- }
-
- /**
- * Called when the mob is falling. Calculates and applies fall damage.
- */
- protected void fall(float p_70069_1_) {}
-
- /**
- * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance
- * and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround
- */
- protected void updateFallState(double p_70064_1_, boolean p_70064_3_) {}
-
- /**
- * Return whether this entity should NOT trigger a pressure plate or a tripwire.
- */
- public boolean doesEntityNotTriggerPressurePlate()
- {
- return true;
- }
-
- /**
- * Called when the entity is attacked.
- */
- public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
- {
- if (this.isEntityInvulnerable())
- {
- return false;
- }
- else
- {
- if (!this.worldObj.isRemote && this.getIsBatHanging())
- {
- this.setIsBatHanging(false);
- }
-
- return super.attackEntityFrom(p_70097_1_, p_70097_2_);
- }
- }
-
- /**
- * (abstract) Protected helper method to read subclass entity data from NBT.
- */
- public void readEntityFromNBT(NBTTagCompound p_70037_1_)
- {
- super.readEntityFromNBT(p_70037_1_);
- }
-
- /**
- * (abstract) Protected helper method to write subclass entity data to NBT.
- */
- public void writeEntityToNBT(NBTTagCompound p_70014_1_)
- {
- super.writeEntityToNBT(p_70014_1_);
- }
-
- /**
- * Checks if the entity's current position is a valid location to spawn this entity.
- */
- public boolean getCanSpawnHere()
- {
- int i = MathHelper.floor_double(this.boundingBox.minY);
-
- if (i >= 63)
- {
- return false;
- }
- else
- {
- int j = MathHelper.floor_double(this.posX);
- int k = MathHelper.floor_double(this.posZ);
- int l = this.worldObj.getBlockLightValue(j, i, k);
- byte b0 = 4;
- Calendar calendar = this.worldObj.getCurrentDate();
-
- if ((calendar.get(2) + 1 != 10 || calendar.get(5) < 20) && (calendar.get(2) + 1 != 11 || calendar.get(5) > 3))
- {
- if (this.rand.nextBoolean())
- {
- return false;
- }
- }
- else
- {
- b0 = 7;
- }
-
- return l > this.rand.nextInt(b0) ? false : super.getCanSpawnHere();
- }
- }
+public class EntityBatKing extends EntityMob implements IRangedAttackMob {
+
+
+ private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F);
+ private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
+
+ public EntityBatKing(World p_i1680_1_) {
+ super(p_i1680_1_);
+ this.setSize(2.5F, 1.5F);
+
+ this.setIsBatHanging(false);
+ this.isImmuneToFire = true;
+ this.experienceValue = 1000;
+
+ this.tasks.addTask(3, this.aiArrowAttack);
+ this.tasks.addTask(4, this.aiAttackOnCollide);
+ this.tasks.addTask(4, new EntityAIRestrictSun(this));
+ this.tasks.addTask(5, new EntityAIFleeSun(this, 1.0D));
+ this.tasks.addTask(5, new EntityAIWander(this, 1.0D));
+ this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
+ this.tasks.addTask(6, new EntityAILookIdle(this));
+
+ this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
+ this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
+ this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityBat.class, 0, false));
+
+ }
+
+ protected void entityInit() {
+ super.entityInit();
+ }
+
+ /**
+ * Get this Entity's EnumCreatureAttribute
+ */
+ public EnumCreatureAttribute getCreatureAttribute()
+ {
+ return EnumCreatureAttribute.UNDEAD;
+ }
+
+ /**
+ * Returns the volume for the sounds this mob makes.
+ */
+ protected float getSoundVolume() {
+ return 0.45F;
+ }
+
+ /**
+ * Gets the pitch of living sounds in living entities.
+ */
+ protected float getSoundPitch() {
+ return super.getSoundPitch() * 0.15F;
+ }
+
+ /**
+ * Returns the sound this mob makes while it's alive.
+ */
+ protected String getLivingSound() {
+ int aRand = MathUtils.randInt(0, 10);
+ if (aRand < 6) {
+ return null;
+ } else if (aRand <= 8) {
+ return "mob.bat.idle";
+ } else {
+ return "mob.blaze.breathe";
+ }
+ }
+
+ /**
+ * Returns the sound this mob makes when it is hurt.
+ */
+ protected String getHurtSound() {
+ return "mob.blaze.hit";
+ }
+
+ /**
+ * Returns the sound this mob makes on death.
+ */
+ protected String getDeathSound() {
+ return "mob.bat.death";
+ }
+
+ /**
+ * Returns true if this entity should push and be pushed by other entities when
+ * colliding.
+ */
+ public boolean canBePushed() {
+ return false;
+ }
+
+ protected void collideWithEntity(Entity aEntity) {
+ if (aEntity != null) {
+ if (aEntity instanceof EntityPlayer) {
+ EntityUtils.doDamage(aEntity, DamageSource.magic, (int) (((EntityPlayer) aEntity).getHealth() / 20));
+ }
+ }
+ }
+
+ protected void collideWithNearbyEntities() {
+ }
+
+ protected void applyEntityAttributes() {
+
+ this.getAttributeMap().registerAttribute(SharedMonsterAttributes.maxHealth);
+ this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage);
+ this.getAttributeMap().registerAttribute(SharedMonsterAttributes.knockbackResistance);
+ this.getAttributeMap().registerAttribute(SharedMonsterAttributes.movementSpeed);
+ this.getAttributeMap().registerAttribute(SharedMonsterAttributes.followRange);
+
+ this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(60.0D);
+ this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D);
+ this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D);
+ this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(32.0D);
+ }
+
+ public boolean getIsBatHanging() {
+ return false;
+ }
+
+ public void setIsBatHanging(boolean p_82236_1_) {
+
+ }
+
+ /**
+ * Returns true if the newer Entity AI code should be run
+ */
+ protected boolean isAIEnabled() {
+ return true;
+ }
+
+ /**
+ * Called to update the entity's position/logic.
+ */
+ public void onUpdate() {
+ super.onUpdate();
+
+ for (int i = 0; i < 2; ++i) {
+ this.worldObj.spawnParticle("largesmoke", this.posX + (this.rand.nextDouble() - 0.5D) * (double) this.width,
+ this.posY + this.rand.nextDouble() * (double) this.height,
+ this.posZ + (this.rand.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D);
+ }
+
+ if (!isFlying()) {
+ this.jump();
+ }
+ /*
+ * if (!hasAir()) { if (isFlying()) { this.jump(); this.jump(); } }
+ */
+
+ if (!this.onGround && this.motionY < 0.0D)
+ {
+ this.motionY *= 0.0001D;
+ }
+
+ }
+
+ protected void updateAITasks() {
+ super.updateAITasks();
+ }
+
+ private boolean isFlying() {
+ if (this.onGround) {
+ return false;
+ }
+ return true;
+ }
+
+ private boolean hasAir() {
+ BlockPos p = EntityUtils.findBlockPosUnderEntity(this);
+ int y = p.yPos;
+ int yOriginal = p.yPos;
+ int breaker = 0;
+ while (y > 0) {
+ if (breaker > 50) {
+ break;
+ }
+ if (!this.worldObj.isAirBlock(p.xPos, y, p.zPos)) {
+ break;
+ }
+ y--;
+ breaker++;
+ }
+ if (yOriginal - y < 3) {
+ for (int i=0;i<y;y++) {
+ this.jump();
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * returns if this entity triggers Block.onEntityWalking on the blocks they walk
+ * on. used for spiders and wolves to prevent them from trampling crops
+ */
+ protected boolean canTriggerWalking() {
+ return false;
+ }
+
+ /**
+ * Called when the mob is falling. Calculates and applies fall damage.
+ */
+ protected void fall(float p_70069_1_) {
+ }
+
+ /**
+ * Takes in the distance the entity has fallen this tick and whether its on the
+ * ground to update the fall distance and deal fall damage if landing on the
+ * ground. Args: distanceFallenThisTick, onGround
+ */
+ protected void updateFallState(double p_70064_1_, boolean p_70064_3_) {
+ }
+
+ /**
+ * Return whether this entity should NOT trigger a pressure plate or a tripwire.
+ */
+ public boolean doesEntityNotTriggerPressurePlate() {
+ return true;
+ }
+
+ /**
+ * Called when the entity is attacked.
+ */
+ public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) {
+ if (this.isEntityInvulnerable()) {
+ return false;
+ } else {
+ if (!this.worldObj.isRemote && this.getIsBatHanging()) {
+ this.setIsBatHanging(false);
+ }
+
+ return super.attackEntityFrom(p_70097_1_, p_70097_2_);
+ }
+ }
+
+ /**
+ * (abstract) Protected helper method to read subclass entity data from NBT.
+ */
+ public void readEntityFromNBT(NBTTagCompound p_70037_1_) {
+ super.readEntityFromNBT(p_70037_1_);
+ }
+
+ /**
+ * (abstract) Protected helper method to write subclass entity data to NBT.
+ */
+ public void writeEntityToNBT(NBTTagCompound p_70014_1_) {
+ super.writeEntityToNBT(p_70014_1_);
+ }
+
+ /**
+ * Checks if the entity's current position is a valid location to spawn this
+ * entity.
+ */
+ public boolean getCanSpawnHere() {
+ int i = MathHelper.floor_double(this.boundingBox.minY);
+
+ if (i >= 63) {
+ return false;
+ } else {
+ int j = MathHelper.floor_double(this.posX);
+ int k = MathHelper.floor_double(this.posZ);
+ int l = this.worldObj.getBlockLightValue(j, i, k);
+ byte b0 = 4;
+ Calendar calendar = this.worldObj.getCurrentDate();
+
+ if ((calendar.get(2) + 1 != 10 || calendar.get(5) < 20)
+ && (calendar.get(2) + 1 != 11 || calendar.get(5) > 3)) {
+ if (this.rand.nextBoolean()) {
+ return false;
+ }
+ } else {
+ b0 = 7;
+ }
+
+ return l > this.rand.nextInt(b0) ? false : super.getCanSpawnHere();
+ }
+ }
+
+ /**
+ * Attack the specified entity using a ranged attack.
+ */
+ @Override
+ public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_)
+ {
+ EntityArrow entityarrow = new EntityArrow(this.worldObj, this, p_82196_1_, 1.6F, (float)(14 - this.worldObj.difficultySetting.getDifficultyId() * 4));
+ int i = MathUtils.randInt(0, 4);
+ int j = MathUtils.randInt(0, 3);
+ int k = MathUtils.randInt(0, 3);
+ entityarrow.setDamage((double)(p_82196_2_ * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.worldObj.difficultySetting.getDifficultyId() * 0.11F));
+
+ boolean boostAttack = MathUtils.randInt(0, 100) <= 21;
+ if (boostAttack) {
+ if (i > 0) {
+ entityarrow.setDamage(entityarrow.getDamage() + (double) i * 0.5D + 0.5D);
+ }
+
+ if (j > 0) {
+ entityarrow.setKnockbackStrength(j);
+ }
+ if (k > 0) {
+ entityarrow.setFire(50 * k);
+ }
+ }
+
+ this.playSound("mob.skeleton.say", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
+ this.worldObj.spawnEntityInWorld(entityarrow);
+ }
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_PestKiller.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_PestKiller.java
new file mode 100644
index 0000000000..889b19443e
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_PestKiller.java
@@ -0,0 +1,161 @@
+package gtPlusPlus.core.gui.machine;
+
+import java.awt.Color;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.core.container.Container_PestKiller;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.MISC_MATERIALS;
+import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller;
+import gtPlusPlus.core.util.math.MathUtils;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.fluids.FluidTank;
+import net.minecraftforge.fluids.IFluidTank;
+
+@SideOnly(Side.CLIENT)
+public class GUI_PestKiller extends GuiContainer {
+
+ private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/PestKiller.png");
+ private final TileEntityPestKiller mTileKiller;
+
+ public GUI_PestKiller(final InventoryPlayer player_inventory, final TileEntityPestKiller te) {
+ super(new Container_PestKiller(player_inventory, te));
+ mTileKiller = te;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(final int i, final int j) {
+ if (mTileKiller != null) {
+ this.fontRendererObj.drawString(I18n.format(mTileKiller.getInventoryName(), new Object[0]), 4, 6, 4210752);
+ drawFluidTank(mTileKiller.getTank(), 134, 35);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j) {
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ this.mc.renderEngine.bindTexture(craftingTableGuiTextures);
+ final int x = (this.width - this.xSize) / 2;
+ final int y = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
+ }
+
+ // This method is called when the Gui is first called!
+ @Override
+ public void initGui() {
+ super.initGui();
+ }
+
+ private void drawFluidTank(IFluidTank tank, int x, int y) {
+ Color startGrad = new Color(50, 50, 50);
+ Color endGrad = new Color(20, 20, 20);
+ Container_PestKiller aCont = (Container_PestKiller) this.inventorySlots;
+ TileEntityPestKiller aTileKiller = aCont.tile_entity;
+
+ double aPercentage = 0;
+ double aDivisor = (100/16);
+ int aFrameHeight = 16;
+
+
+ boolean didRender = false;
+ if (aCont != null) {
+ TileEntityPestKiller aTile = mTileKiller;
+ if (aTile != null) {
+ FluidTank aTank = aTile.getTank();
+ int aTier = aTile.getTier();
+ drawGradientRect(x, y, x+16, y+16, startGrad.getRGB(), endGrad.getRGB());
+ if (aTier <= 0 || aTier > 2) {
+ if (aTank != null && aTank.getFluidAmount() > 0) {
+ aPercentage = MathUtils.findPercentage(aTank.getFluidAmount(), aTank.getCapacity());
+ //Logger.INFO("Percent = "+aPercentage);
+ aFrameHeight = (int) (aPercentage / aDivisor);
+ //Logger.INFO("Frame Height = "+aFrameHeight);
+ }
+ this.fontRendererObj.drawString("Tier: 0", 4, 18, 4210752);
+ this.fontRendererObj.drawString("Range: 1x1", 4, 30, 4210752);
+ this.fontRendererObj.drawString("Poison: None", 4, 42, 4210752);
+ this.fontRendererObj.drawString("Amount: 0", 4, 64, 4210752);
+ didRender = true;
+ }
+ else if (aTier == 1) {
+ if (aTank != null && aTank.getFluidAmount() > 0) {
+ aPercentage = MathUtils.findPercentage(aTank.getFluidAmount(), aTank.getCapacity());
+ //Logger.INFO("Percent = "+aPercentage);
+ aFrameHeight = (int) (aPercentage / aDivisor);
+ //Logger.INFO("Frame Height = "+aFrameHeight);
+ }
+ startGrad = new Color(240, 50, 240);
+ endGrad = new Color(130, 30, 130);
+ drawGradientRect(x, y+(16-aFrameHeight), x+16, y+16, startGrad.getRGB(), endGrad.getRGB());
+ this.fontRendererObj.drawString("Tier: 1", 4, 18, 4210752);
+ this.fontRendererObj.drawString("Range: 5x5", 4, 30, 4210752);
+ this.fontRendererObj.drawString("Poison: ", 4, 42, 4210752);
+ this.fontRendererObj.drawString(""+aTile.getTank().getFluid().getLocalizedName(), 4, 54, 4210752);
+ this.fontRendererObj.drawString("Amount: "+aTile.getTank().getFluidAmount(), 4, 64, 4210752);
+ didRender = true;
+ }
+ else if (aTier == 2) {
+ if (aTank != null && aTank.getFluidAmount() > 0) {
+ aPercentage = MathUtils.findPercentage(aTank.getFluidAmount(), aTank.getCapacity());
+ //Logger.INFO("Percent = "+aPercentage);
+ aFrameHeight = (int) (aPercentage / aDivisor);
+ //Logger.INFO("Frame Height = "+aFrameHeight);
+ }
+ short[] aRGB = MISC_MATERIALS.HYDROGEN_CYANIDE.getRGB();
+ startGrad = new Color(aRGB[0], aRGB[1], aRGB[2]);
+ endGrad = new Color(Math.max(aRGB[0], 0), Math.max(aRGB[1], 0), Math.max(aRGB[2], 0));
+ drawGradientRect(x, y+(16-aFrameHeight), x+16, y+16, startGrad.getRGB(), endGrad.getRGB());
+ this.fontRendererObj.drawString("Tier: 2", 4, 18, 4210752);
+ this.fontRendererObj.drawString("Range: 9x9", 4, 30, 4210752);
+ this.fontRendererObj.drawString("Poison: ", 4, 42, 4210752);
+ this.fontRendererObj.drawString(""+aTile.getTank().getFluid().getLocalizedName(), 4, 54, 4210752);
+ this.fontRendererObj.drawString("Amount: "+aTile.getTank().getFluidAmount(), 4, 64, 4210752);
+ didRender = true;
+ }
+ }
+ }
+ if (!didRender) {
+ startGrad = new Color(255, 30, 120);
+ endGrad = new Color(255, 0, 50);
+ drawGradientRect(x, y, x+16, y+16, startGrad.getRGB(), endGrad.getRGB());
+ this.fontRendererObj.drawString("Tier: 0", 4, 18, 4210752);
+ }
+
+
+
+
+
+
+ /*
+ * FluidStack fluid = tank.getFluid(); TextureManager manager =
+ * mc.getTextureManager(); if (fluid != null) {
+ * manager.bindTexture(manager.getResourceLocation(0)); float amount =
+ * fluid.amount; float capacity = tank.getCapacity(); float scale = amount /
+ * capacity; int fluidTankHeight = 60; int fluidAmount = (int) (scale *
+ * fluidTankHeight); drawFluid(x, y + fluidTankHeight - fluidAmount,
+ * fluid.getFluid().getIcon(fluid), 16, fluidAmount); }
+ */
+ }
+
+ private void drawFluid(int x, int y, IIcon icon, int width, int height) {
+ int i = 0;
+ int j = 0;
+ int drawHeight = 0;
+ int drawWidth = 0;
+ for (i = 0; i < width; i += 16) {
+ for (j = 0; j < height; j += 16) {
+ drawWidth = Math.min(width - i, 16);
+ drawHeight = Math.min(height - j, 16);
+ drawTexturedModelRectFromIcon(x + i, y + j, icon, drawWidth, drawHeight);
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
index 8448b738a2..67493d7964 100644
--- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
@@ -53,6 +53,7 @@ public class GuiHandler implements IGuiHandler {
public static final int GUI12 = 11; // Bag for Magic Tools
public static final int GUI13 = 12; // Decayables Chest
public static final int GUI14 = 13; // Super Jukebox
+ public static final int GUI15 = 14; // Pest Killer
public static void init() {
@@ -97,9 +98,11 @@ public class GuiHandler implements IGuiHandler {
return new Container_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer) te);
} else if (ID == GUI13) {
return new Container_DecayablesChest(player.inventory, (TileEntityDecayablesChest) te);
- }else if (ID == GUI14) {
+ } else if (ID == GUI14) {
return new Container_SuperJukebox(player.inventory, (TileEntitySuperJukebox) te);
- }
+ } else if (ID == GUI15) {
+ return new Container_PestKiller(player.inventory, (TileEntityPestKiller) te);
+ }
}
if (ID == GUI9) {
@@ -157,6 +160,8 @@ public class GuiHandler implements IGuiHandler {
return new GUI_DecayablesChest(player.inventory, (TileEntityDecayablesChest) te);
} else if (ID == GUI14) {
return new GUI_SuperJukebox(player.inventory, (TileEntitySuperJukebox) te);
+ } else if (ID == GUI15) {
+ return new GUI_PestKiller(player.inventory, (TileEntityPestKiller) te);
}
}
diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryPestKiller.java b/src/Java/gtPlusPlus/core/inventories/InventoryPestKiller.java
new file mode 100644
index 0000000000..1c5d98f7d2
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/inventories/InventoryPestKiller.java
@@ -0,0 +1,176 @@
+package gtPlusPlus.core.inventories;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+
+public class InventoryPestKiller implements IInventory{
+
+ private final String name = "Pest Killer";
+
+ /** Defining your inventory size this way is handy */
+ public static final int INV_SIZE = 3;
+
+ /** Inventory's size must be same as number of slots you add to the Container class */
+ private ItemStack[] inventory = new ItemStack[INV_SIZE];
+
+ public void readFromNBT(final NBTTagCompound nbt){
+ final NBTTagList list = nbt.getTagList("Items", 10);
+ this.inventory = new ItemStack[INV_SIZE];
+ for(int i = 0;i<list.tagCount();i++){
+ final NBTTagCompound data = list.getCompoundTagAt(i);
+ final int slot = data.getInteger("Slot");
+ if((slot >= 0) && (slot < INV_SIZE)){
+ //Utils.LOG_INFO("Trying to read NBT data from inventory.");
+ this.inventory[slot] = ItemStack.loadItemStackFromNBT(data);
+ }
+ }
+ }
+
+ public void writeToNBT(final NBTTagCompound nbt){
+ final NBTTagList list = new NBTTagList();
+ for(int i = 0;i<INV_SIZE;i++){
+ final ItemStack stack = this.inventory[i];
+ if(stack != null){
+ //Utils.LOG_INFO("Trying to write NBT data to inventory.");
+ final NBTTagCompound data = new NBTTagCompound();
+ stack.writeToNBT(data);
+ data.setInteger("Slot", i);
+ list.appendTag(data);
+ }
+ }
+ nbt.setTag("Items", list);
+ }
+
+ @Override
+ public int getSizeInventory()
+ {
+ return this.inventory.length;
+ }
+
+ public ItemStack[] getInventory(){
+ return this.inventory;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int slot)
+ {
+ return this.inventory[slot];
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int slot, final int amount)
+ {
+ ItemStack stack = this.getStackInSlot(slot);
+ if(stack != null)
+ {
+ if(stack.stackSize > amount)
+ {
+ stack = stack.splitStack(amount);
+ // Don't forget this line or your inventory will not be saved!
+ this.markDirty();
+ }
+ else
+ {
+ // this method also calls markDirty, so we don't need to call it again
+ this.setInventorySlotContents(slot, null);
+ }
+ }
+ return stack;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int slot)
+ {
+ final ItemStack stack = this.getStackInSlot(slot);
+ this.setInventorySlotContents(slot, null);
+ return stack;
+ }
+
+ @Override
+ public void setInventorySlotContents(final int slot, final ItemStack stack)
+ {
+ this.inventory[slot] = stack;
+
+ if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit()))
+ {
+ stack.stackSize = this.getInventoryStackLimit();
+ }
+
+ // Don't forget this line or your inventory will not be saved!
+ this.markDirty();
+ }
+
+ // 1.7.2+ renamed to getInventoryName
+ @Override
+ public String getInventoryName()
+ {
+ return this.name;
+ }
+
+ // 1.7.2+ renamed to hasCustomInventoryName
+ @Override
+ public boolean hasCustomInventoryName()
+ {
+ return this.name.length() > 0;
+ }
+
+ @Override
+ public int getInventoryStackLimit()
+ {
+ return 64;
+ }
+
+ /**
+ * This is the method that will handle saving the inventory contents, as it is called (or should be called!)
+ * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also
+ * let you change things in your inventory without ever opening a Gui, if you want.
+ */
+ // 1.7.2+ renamed to markDirty
+ @Override
+ public void markDirty()
+ {
+ for (int i = 0; i < this.getSizeInventory(); ++i)
+ {
+ final ItemStack temp = this.getStackInSlot(i);
+ if (temp != null){
+ //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize);
+ }
+
+ if ((temp != null) && (temp.stackSize == 0)) {
+ this.inventory[i] = null;
+ }
+ }
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer entityplayer)
+ {
+ return true;
+ }
+
+ // 1.7.2+ renamed to openInventory(EntityPlayer player)
+ @Override
+ public void openInventory() {}
+
+ // 1.7.2+ renamed to closeInventory(EntityPlayer player)
+ @Override
+ public void closeInventory() {}
+
+ /**
+ * This method doesn't seem to do what it claims to do, as
+ * items can still be left-clicked and placed in the inventory
+ * even when this returns false
+ */
+ @Override
+ public boolean isItemValidForSlot(final int slot, final ItemStack itemstack)
+ {
+ // Don't want to be able to store the inventory item within itself
+ // Bad things will happen, like losing your inventory
+ // Actually, this needs a custom Slot to work
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java
index 51b133241b..21ea826eea 100644
--- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java
@@ -9,10 +9,10 @@ import net.minecraft.item.ItemStack;
import gtPlusPlus.api.interfaces.ITileTooltip;
-public class ItemBlockBasicTile extends ItemBlock{
+public class ItemBlockBasicTile extends ItemBlock {
private final int mID;
-
+
public ItemBlockBasicTile(final Block block) {
super(block);
this.mID = ((ITileTooltip) block).getTooltipID();
@@ -21,37 +21,34 @@ public class ItemBlockBasicTile extends ItemBlock{
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- if (this.mID == 0){ //Fish trap
- list.add("This trap catches fish faster if surrounded by more water blocks");
- list.add("Can also be placed beside upto 4 other fish traps");
- list.add("Requires at least two faces touching water");
- list.add("1/1000 chance to produce triple loot.");
- }
- else if (this.mID == 1){ //Modularity
- list.add("Used to construct modular armour & bauble upgrades..");
- }
- else if (this.mID == 2){ //Trade
- list.add("Allows for SMP trade-o-mat type trading.");
- }
- else if (this.mID == 3){ //Project
- list.add("Scan any crafting recipe in this to mass fabricate them in the Autocrafter..");
- }
- else if (this.mID == 4){ //Circuit Table
+ if (this.mID == 0) { // Fish trap
+ list.add("This trap catches fish faster if surrounded by more water blocks");
+ list.add("Can also be placed beside upto 4 other fish traps");
+ list.add("Requires at least two faces touching water");
+ list.add("1/1000 chance to produce triple loot.");
+ } else if (this.mID == 1) { // Modularity
+ list.add("Used to construct modular armour & bauble upgrades..");
+ } else if (this.mID == 2) { // Trade
+ list.add("Allows for SMP trade-o-mat type trading.");
+ } else if (this.mID == 3) { // Project
+ list.add("Scan any crafting recipe in this to mass fabricate them in the Autocrafter..");
+ } else if (this.mID == 4) { // Circuit Table
list.add("Easy Circuit Configuration");
list.add("Change default setting with a Screwdriver");
- list.add("Default is used to select slot for auto-insertion");
- }
- else if (this.mID == 5){ //Decayables Chest
- list.add("Chest which holds radioactive materials");
- list.add("Items which decay will tick while inside");
- list.add("Place with right click");
- }
- else {
- list.add("Bad Tooltip ID - "+mID);
-
+ list.add("Default is used to select slot for auto-insertion");
+ } else if (this.mID == 5) { // Decayables Chest
+ list.add("Chest which holds radioactive materials");
+ list.add("Items which decay will tick while inside");
+ list.add("Place with right click");
+ } else if (this.mID == 6) { // Butterfly Killer
+ list.add("Kills Forestry Butterflies, Bats and other pests");
+ list.add("Use either Formaldehyde or Hydrogen cyanide");
+ list.add("Be weary of your neighbours");
+ } else {
+ list.add("Bad Tooltip ID - " + mID);
+
}
super.addInformation(stack, aPlayer, list, bool);
}
-
}
diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java
index 38be7d8593..04f1861cfe 100644
--- a/src/Java/gtPlusPlus/core/lib/CORE.java
+++ b/src/Java/gtPlusPlus/core/lib/CORE.java
@@ -11,6 +11,7 @@ import gtPlusPlus.api.objects.random.XSTR;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.sys.GeoUtils;
import gtPlusPlus.core.util.sys.NetworkUtils;
+import gtPlusPlus.preloader.CORE_Preloader;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials;
import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder;
import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
@@ -209,6 +210,7 @@ public class CORE {
public static boolean enableCustomCircuits = true;
public static boolean enableOldGTcircuits = false;
public static boolean disableZombieReinforcement = false;
+ public static int enableWatchdogBGM = CORE_Preloader.enableWatchdogBGM;
//GT Fixes
public static boolean enableNitroFix = false;
diff --git a/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java b/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java
index c7032ab7c7..936e711ac2 100644
--- a/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java
+++ b/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java
@@ -83,6 +83,22 @@ public final class MISC_MATERIALS {
new MaterialStack(ELEMENT.getInstance().HYDROGEN, 8),
new MaterialStack(ELEMENT.getInstance().OXYGEN, 4)
});
+
+ public static final Material HYDROGEN_CYANIDE = new Material(
+ "Hydrogen Cyanide",
+ MaterialState.PURE_LIQUID, //State
+ null, //Material Colour
+ 4, //Melting Point in C
+ 26, //Boiling Point in C
+ -1, //Protons
+ -1,
+ false, //Uses Blast furnace?
+ //Material Stacks with Percentage of required elements.
+ new MaterialStack[]{
+ new MaterialStack(ELEMENT.getInstance().HYDROGEN, 1),
+ new MaterialStack(ELEMENT.getInstance().CARBON, 1),
+ new MaterialStack(ELEMENT.getInstance().NITROGEN, 1)
+ });
diff --git a/src/Java/gtPlusPlus/core/slots/SlotGeneric.java b/src/Java/gtPlusPlus/core/slots/SlotGeneric.java
index d4c389d9cc..533539d914 100644
--- a/src/Java/gtPlusPlus/core/slots/SlotGeneric.java
+++ b/src/Java/gtPlusPlus/core/slots/SlotGeneric.java
@@ -6,9 +6,8 @@ import net.minecraft.item.ItemStack;
public class SlotGeneric extends Slot {
- public SlotGeneric(final IInventory inventory, final int x, final int y, final int z) {
- super(inventory, x, y, z);
-
+ public SlotGeneric(final IInventory inventory, final int aSlotID, final int x, final int y) {
+ super(inventory, aSlotID, x, y);
}
@Override
diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
index c3670ef959..ada0fd7b86 100644
--- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
+++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
@@ -1,14 +1,25 @@
package gtPlusPlus.core.tileentities;
import cpw.mods.fml.common.registry.GameRegistry;
-
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.general.BlockSuperLight.TileEntitySuperLight;
import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox;
import gtPlusPlus.core.lib.LoadedMods;
-import gtPlusPlus.core.tileentities.general.*;
-import gtPlusPlus.core.tileentities.general.redstone.TileEntityRedstoneHandler;
-import gtPlusPlus.core.tileentities.machines.*;
+import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer;
+import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest;
+import gtPlusPlus.core.tileentities.general.TileEntityFirepit;
+import gtPlusPlus.core.tileentities.general.TileEntityFishTrap;
+import gtPlusPlus.core.tileentities.general.TileEntityInfiniteFluid;
+import gtPlusPlus.core.tileentities.general.TileEntityPlayerDoorBase;
+import gtPlusPlus.core.tileentities.general.TileEntityXpConverter;
+import gtPlusPlus.core.tileentities.machines.TileEntityAdvPooCollector;
+import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable;
+import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller;
+import gtPlusPlus.core.tileentities.machines.TileEntityPooCollector;
+import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable;
+import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable;
+import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench;
+import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced;
import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner;
public class ModTileEntities {
@@ -32,6 +43,7 @@ public class ModTileEntities {
GameRegistry.registerTileEntity(TileEntityDecayablesChest.class, "TileDecayablesChest");
GameRegistry.registerTileEntity(TileEntitySuperJukebox.class, "TileEntitySuperJukebox");
GameRegistry.registerTileEntity(TileEntitySuperLight.class, "TileEntitySuperLight");
+ GameRegistry.registerTileEntity(TileEntityPestKiller.class, "TileEntityPestKiller");
//Mod TEs
diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java
new file mode 100644
index 0000000000..b518072e48
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java
@@ -0,0 +1,506 @@
+package gtPlusPlus.core.tileentities.machines;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.BTF_FluidTank;
+import gtPlusPlus.core.inventories.InventoryPestKiller;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.material.MISC_MATERIALS;
+import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.passive.EntityBat;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.DamageSource;
+import net.minecraft.world.World;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidEvent;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTank;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+import net.minecraftforge.oredict.OreDictionary;
+
+public class TileEntityPestKiller extends TileEntity implements ISidedInventory, IFluidHandler {
+
+ private final int mBaseTickRate = 20 * 30;
+ private final InventoryPestKiller mInventory;
+ private final FluidTank mTank;
+ private int mChunkX;
+ private int mChunkZ;
+ private boolean mSet = false;
+
+ private int mTickCounter = 0;
+ private int mUpdateTick = 0;
+ private boolean mNeedsUpdate = false;
+ private String mCustomName;
+
+ private static final AutoMap<Class<?>> mEntityMap = new AutoMap<Class<?>>();
+
+ static {
+ mEntityMap.put(EntityBat.class);
+ if (LoadedMods.Forestry) {
+ mEntityMap.put(ReflectionUtils.getClass("forestry.lepidopterology.entities.EntityButterfly.class"));
+ }
+ }
+
+ public TileEntityPestKiller() {
+ this.mInventory = new InventoryPestKiller();
+ mTank = new BTF_FluidTank(2000);
+ }
+
+ public InventoryPestKiller getInventory() {
+ return this.mInventory;
+ }
+
+ public FluidTank getTank() {
+ return mTank;
+ }
+
+ private final void setup() {
+ World w = this.worldObj;
+ if (w != null) {
+ Chunk c = w.getChunkFromBlockCoords(this.xCoord, this.zCoord);
+ if (c != null) {
+ mChunkX = c.xPosition;
+ mChunkZ = c.zPosition;
+ mSet = true;
+ }
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ public boolean tryKillPests() {
+ int min = 0;
+ int max = 0;
+ switch (getTier()) {
+ case 1:
+ min = -2;
+ max = 3;
+ break;
+ case 2:
+ min = -4;
+ max = 5;
+ break;
+ default:
+ // code block
+ }
+ int aChunkCount = 0;
+ AutoMap<Entity> entities = new AutoMap<Entity>();
+ if (min != 0 && max != 0) {
+ for (int x = min; x < max; x++) {
+ for (int z = min; z < max; z++) {
+ Chunk c = getChunkFromOffsetIfLoaded(x, z);
+ if (c != null) {
+ if (c.hasEntities) {
+ aChunkCount++;
+ List[] lists = c.entityLists;
+ for (List o : lists) {
+ for (Object e : o) {
+ if (e instanceof Entity) {
+ for (Class<?> C : mEntityMap) {
+ if (e.getClass().equals(C) || C.isAssignableFrom(e.getClass())) {
+ entities.put((Entity) e);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ } else {
+ Chunk c = getChunkFromOffsetIfLoaded(0, 0);
+ if (c != null) {
+ if (c.hasEntities) {
+ List[] lists = c.entityLists;
+ for (List o : lists) {
+ for (Object e : o) {
+ if (e instanceof Entity) {
+ for (Class<?> C : mEntityMap) {
+ if (e.getClass().equals(C) || C.isAssignableFrom(e.getClass())) {
+ entities.put((Entity) e);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ boolean killed = false;
+ if (!entities.isEmpty()) {
+ for (Entity e : entities) {
+ if (e != null) {
+ if (e.isEntityAlive()) {
+ if (this.mTank.getFluidAmount() >= 1 || getTier() == 0) {
+ if (getTier() > 0) {
+ int aChanceToUse = MathUtils.randInt(1, (100 * getTier()));
+ if (aChanceToUse == 1) {
+ this.mTank.drain(1, true);
+ }
+ }
+ e.performHurtAnimation();
+ EntityUtils.doDamage(e, DamageSource.generic, Short.MAX_VALUE);
+ e.setDead();
+ killed = true;
+ }
+ }
+ }
+ }
+ }
+ updateTileEntity();
+ return killed;
+ }
+
+ public Chunk getChunkFromOffsetIfLoaded(int x, int y) {
+ Chunk c = this.worldObj.getChunkFromChunkCoords(mChunkX + x, mChunkZ + y);
+ if (c.isChunkLoaded) {
+ return c;
+ }
+ return null;
+ }
+
+ public int getTier() {
+ if (this.mTank != null) {
+ FluidStack f = mTank.getFluid();
+ if (f != null) {
+ if (f.isFluidEqual(FluidUtils.getWildcardFluidStack("formaldehyde", 1))) {
+ return 1;
+ } else if (f.isFluidEqual(MISC_MATERIALS.HYDROGEN_CYANIDE.getFluid(1))) {
+ return 2;
+ }
+ }
+ }
+ return 0;
+ }
+
+ @Override
+ public void updateEntity() {
+ if (worldObj.isRemote) {
+ return;
+ }
+ if (!mSet) {
+ setup();
+ }
+ this.mTickCounter++;
+ if (this.mTank != null) {
+ if (this.hasFluidSpace()) {
+ handleInventory();
+ }
+ }
+ if (this.mTickCounter % this.mBaseTickRate == 0) {
+ tryKillPests();
+ }
+ updateTick();
+ }
+
+ public boolean anyPlayerInRange() {
+ return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null;
+ }
+
+ public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) {
+ if (!nbt.hasKey(tag)) {
+ nbt.setTag(tag, new NBTTagCompound());
+ }
+ return nbt.getCompoundTag(tag);
+ }
+
+ @Override
+ public void writeToNBT(final NBTTagCompound nbt) {
+ mTank.writeToNBT(nbt);
+ super.writeToNBT(nbt);
+ // Utils.LOG_MACHINE_INFO("Trying to write NBT data to TE.");
+ final NBTTagCompound chestData = new NBTTagCompound();
+ this.mInventory.writeToNBT(chestData);
+ nbt.setTag("ContentsChest", chestData);
+ if (this.hasCustomInventoryName()) {
+ nbt.setString("CustomName", this.getCustomName());
+ }
+ }
+
+ @Override
+ public void readFromNBT(final NBTTagCompound nbt) {
+ mTank.readFromNBT(nbt);
+ super.readFromNBT(nbt);
+ // Utils.LOG_MACHINE_INFO("Trying to read NBT data from TE.");
+ this.mInventory.readFromNBT(nbt.getCompoundTag("ContentsChest"));
+ if (nbt.hasKey("CustomName", 8)) {
+ this.setCustomName(nbt.getString("CustomName"));
+ }
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return this.getInventory().getSizeInventory();
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int slot) {
+ return this.getInventory().getStackInSlot(slot);
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int slot, final int count) {
+ return this.getInventory().decrStackSize(slot, count);
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int slot) {
+ return this.getInventory().getStackInSlotOnClosing(slot);
+ }
+
+ @Override
+ public void setInventorySlotContents(final int slot, final ItemStack stack) {
+ this.getInventory().setInventorySlotContents(slot, stack);
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return this.getInventory().getInventoryStackLimit();
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer entityplayer) {
+ return this.getInventory().isUseableByPlayer(entityplayer);
+ }
+
+ @Override
+ public void openInventory() {
+ this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1);
+ this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType());
+ this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType());
+ this.getInventory().openInventory();
+ }
+
+ @Override
+ public void closeInventory() {
+ this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1);
+ this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType());
+ this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType());
+ this.getInventory().closeInventory();
+ }
+
+ @Override
+ public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) {
+ return this.getInventory().isItemValidForSlot(slot, itemstack);
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(final int p_94128_1_) {
+ final int[] accessibleSides = new int[this.getSizeInventory()];
+ for (int r = 0; r < this.getInventory().getSizeInventory(); r++) {
+ accessibleSides[r] = r;
+ }
+ return accessibleSides;
+
+ }
+
+ @Override
+ public boolean canInsertItem(final int aSlot, final ItemStack aStack, final int p_102007_3_) {
+ if (this.getInventory().getInventory()[0] == null) {
+ return true;
+ } else if (GT_Utility.areStacksEqual(aStack, this.getInventory().getInventory()[0])) {
+ if (this.getInventory().getInventory()[0].stackSize < 64) {
+ int diff = 64 - this.getInventory().getInventory()[0].stackSize;
+ if (aStack.stackSize <= diff) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(final int aSlot, final ItemStack aStack, final int p_102008_3_) {
+ if (this.getInventory().getInventory()[1] == null) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public String getCustomName() {
+ return this.mCustomName;
+ }
+
+ public void setCustomName(final String customName) {
+ this.mCustomName = customName;
+ }
+
+ @Override
+ public String getInventoryName() {
+ return this.hasCustomInventoryName() ? this.mCustomName : "container.pestkiller";
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return (this.mCustomName != null) && !this.mCustomName.equals("");
+ }
+
+ @Override
+ public final int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
+ updateTileEntity();
+ return this.mTank.fill(resource, doFill);
+ }
+
+ @Override
+ public final FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
+ updateTileEntity();
+ return this.mTank.drain(resource.amount, doDrain);
+ }
+
+ @Override
+ public final FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
+ FluidStack fluid = this.mTank.getFluid();
+ // return this.tank.drain(maxDrain, doDrain);
+ if (fluid == null) {
+ return null;
+ }
+
+ int drained = maxDrain;
+ if (fluid.amount < drained) {
+ drained = fluid.amount;
+ }
+
+ FluidStack stack = new FluidStack(fluid, drained);
+ if (doDrain) {
+ fluid.amount -= drained;
+ if (fluid.amount <= 0) {
+ fluid = null;
+ }
+
+ if (this != null) {
+ FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluid, this.getWorldObj(), this.xCoord,
+ this.yCoord, this.zCoord, this.mTank, 0));
+ }
+ }
+ updateTileEntity();
+ return stack;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection from, Fluid fluid) {
+ return mTank.getFluid() == null || mTank.getFluid().getFluid().equals(fluid);
+ }
+
+ @Override
+ public boolean canDrain(ForgeDirection from, Fluid fluid) {
+ return false;
+ }
+
+ @Override
+ public final FluidTankInfo[] getTankInfo(ForgeDirection from) {
+ return new FluidTankInfo[] { this.mTank.getInfo() };
+ }
+
+ @Override
+ public final Packet getDescriptionPacket() {
+ NBTTagCompound tag = new NBTTagCompound();
+ writeToNBT(tag);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag);
+ }
+
+ @Override
+ public final void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
+ NBTTagCompound tag = pkt.func_148857_g();
+ readFromNBT(tag);
+ }
+
+
+ public boolean hasFluidSpace() {
+ if (this.mTank.getFluidAmount() <= 1000) {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean drainCell() {
+ boolean didFill = false;
+ ItemStack aInput = this.getStackInSlot(0);
+ if (aInput == null) {
+ return false;
+ }
+ aInput = aInput.copy();
+ if (aInput != null && (this.getStackInSlot(1) == null || this.getStackInSlot(1).stackSize < 64)) {
+ ArrayList<ItemStack> t1Cells = OreDictionary.getOres("cellFormaldehyde");
+ ArrayList<ItemStack> t2Cells = OreDictionary.getOres("cellHydrogenCyanide");
+ didFill = addFluid(t1Cells, aInput, FluidUtils.getWildcardFluidStack("formaldehyde", 1000));
+ if (!didFill) {
+ didFill = addFluid(t2Cells, aInput, MISC_MATERIALS.HYDROGEN_CYANIDE.getFluid(1000));
+ }
+ }
+
+ return didFill;
+ }
+
+ public boolean handleInventory() {
+ if (this.getInventory() != null && drainCell()) {
+ this.decrStackSize(0, 1);
+ if (this.getStackInSlot(1) == null) {
+ this.setInventorySlotContents(1, CI.emptyCells(1));
+ } else {
+ this.getStackInSlot(1).stackSize++;
+ }
+ this.updateTileEntity();
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public boolean addFluid(ArrayList<ItemStack> inputs, ItemStack aInput, FluidStack aFluidForInput) {
+ for (ItemStack a : inputs) {
+ if (GT_Utility.areStacksEqual(a, aInput)) {
+ if (mTank.getFluid() == null || mTank.getFluid()
+ .isFluidEqual(aFluidForInput)) {
+ boolean didFill = fill(ForgeDirection.UNKNOWN, aFluidForInput, true) > 0;
+ return didFill;
+ }
+ } else {
+ continue;
+ }
+ }
+ return false;
+ }
+
+ public void updateTileEntity() {
+ this.getInventory().markDirty();
+ this.markDirty();
+ this.mNeedsUpdate = true;
+ }
+
+ private final void updateTick() {
+ if (mNeedsUpdate) {
+ if (mUpdateTick == 0) {
+ mUpdateTick = 4; // every 4 ticks it will send an update
+ } else {
+ --mUpdateTick;
+ if (mUpdateTick == 0) {
+ markDirty();
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ mNeedsUpdate = false;
+ }
+ }
+ }
+ }
+
+
+
+}
diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java
index bb1d9064e8..0325198213 100644
--- a/src/Java/gtPlusPlus/core/util/Utils.java
+++ b/src/Java/gtPlusPlus/core/util/Utils.java
@@ -2,13 +2,23 @@ package gtPlusPlus.core.util;
import java.awt.Color;
import java.awt.Graphics;
-import java.io.*;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Timer;
+import java.util.TimerTask;
import javax.xml.bind.DatatypeConverter;
@@ -17,30 +27,15 @@ import org.apache.commons.lang3.EnumUtils;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
-import net.minecraft.block.Block;
-import net.minecraft.client.Minecraft;
-import net.minecraft.entity.Entity;
-import net.minecraft.item.Item.ToolMaterial;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
-import net.minecraft.nbt.NBTTagString;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.IChatComponent;
-import net.minecraft.world.World;
-
import gregtech.GT_Mod;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
-import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.TC_Aspects;
import gregtech.api.enums.TC_Aspects.TC_AspectStack;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
-
import gtPlusPlus.GTplusplus;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
@@ -59,6 +54,18 @@ import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner;
import ic2.core.Ic2Items;
import ic2.core.init.InternalName;
import ic2.core.item.resources.ItemCell;
+import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
+import net.minecraft.entity.Entity;
+import net.minecraft.item.Item.ToolMaterial;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.nbt.NBTTagString;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.IChatComponent;
+import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fluids.FluidContainerRegistry;
@@ -73,6 +80,10 @@ public class Utils {
public static final boolean isServer() {
return FMLCommonHandler.instance().getEffectiveSide().isServer();
}
+
+ public static final boolean isClient() {
+ return FMLCommonHandler.instance().getEffectiveSide().isClient();
+ }
static class ShortTimerTask extends TimerTask {
@Override
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java
index 09263bb639..a670f341fd 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java
@@ -564,12 +564,12 @@ public class FluidUtils {
}
public static FluidStack getWildcardFluidStack(String aFluidName, int amount) {
- FluidStack aFStack1 = (FluidUtils.getFluidStack("molten"+"."+aFluidName.toLowerCase(), 1));
- FluidStack aFStack2 = (FluidUtils.getFluidStack("fluid"+"."+aFluidName.toLowerCase(), 1));
- FluidStack aFStack3 = (FluidUtils.getFluidStack(aFluidName.toLowerCase(), 1));
- FluidStack aFStack4 = (FluidUtils.getFluidStack(aFluidName, 1));
- FluidStack aFStack5 = (FluidUtils.getFluidStack("liquid_"+aFluidName.toLowerCase(), 1));
- FluidStack aFStack6 = (FluidUtils.getFluidStack("liquid"+"."+aFluidName.toLowerCase(), 1));
+ FluidStack aFStack1 = (FluidUtils.getFluidStack("molten"+"."+aFluidName.toLowerCase(), amount));
+ FluidStack aFStack2 = (FluidUtils.getFluidStack("fluid"+"."+aFluidName.toLowerCase(), amount));
+ FluidStack aFStack3 = (FluidUtils.getFluidStack(aFluidName.toLowerCase(), amount));
+ FluidStack aFStack4 = (FluidUtils.getFluidStack(aFluidName, amount));
+ FluidStack aFStack5 = (FluidUtils.getFluidStack("liquid_"+aFluidName.toLowerCase(), amount));
+ FluidStack aFStack6 = (FluidUtils.getFluidStack("liquid"+"."+aFluidName.toLowerCase(), amount));
if (aFStack1 != null) {
return aFStack1;
}
diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
index 2371753fe6..efc86122e2 100644
--- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
+++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
@@ -25,7 +25,7 @@ import gtPlusPlus.core.util.data.StringUtils;
public class ReflectionUtils {
- public static Map<String, Class> mCachedClasses = new LinkedHashMap<String, Class>();
+ public static Map<String, Class<?>> mCachedClasses = new LinkedHashMap<String, Class<?>>();
public static Map<String, CachedMethod> mCachedMethods = new LinkedHashMap<String, CachedMethod>();
public static Map<String, CachedField> mCachedFields = new LinkedHashMap<String, CachedField>();
@@ -69,11 +69,11 @@ public class ReflectionUtils {
}
- private static boolean cacheClass(Class aClass) {
+ private static boolean cacheClass(Class<?> aClass) {
if (aClass == null) {
return false;
}
- Class y = mCachedClasses.get(aClass.getCanonicalName());
+ Class<?> y = mCachedClasses.get(aClass.getCanonicalName());
if (y == null) {
mCachedClasses.put(aClass.getCanonicalName(), aClass);
return true;
@@ -81,7 +81,7 @@ public class ReflectionUtils {
return false;
}
- private static boolean cacheMethod(Class aClass, Method aMethod) {
+ private static boolean cacheMethod(Class<?> aClass, Method aMethod) {
if (aMethod == null) {
return false;
}
@@ -94,7 +94,7 @@ public class ReflectionUtils {
return false;
}
- private static boolean cacheField(Class aClass, Field aField) {
+ private static boolean cacheField(Class<?> aClass, Field aField) {
if (aField == null) {
return false;
}
@@ -113,11 +113,11 @@ public class ReflectionUtils {
* @param aClassCanonicalName - The canonical name of the underlying class.
* @return - Valid, {@link Class} object, or {@link null}.
*/
- public static Class getClass(String aClassCanonicalName) {
+ public static Class<?> getClass(String aClassCanonicalName) {
if (aClassCanonicalName == null || aClassCanonicalName.length() <= 0) {
return null;
}
- Class y = mCachedClasses.get(aClassCanonicalName);
+ Class<?> y = mCachedClasses.get(aClassCanonicalName);
if (y == null) {
y = getClass_Internal(aClassCanonicalName);
if (y != null) {
@@ -149,7 +149,7 @@ public class ReflectionUtils {
* @param aTypes - Varags Class Types for {@link Method}'s constructor.
* @return - Valid, non-final, {@link Method} object, or {@link null}.
*/
- public static Method getMethod(Class aClass, String aMethodName, Class... aTypes) {
+ public static Method getMethod(Class<?> aClass, String aMethodName, Class<?>... aTypes) {
if (aClass == null || aMethodName == null || aMethodName.length() <= 0) {
return null;
}
@@ -178,7 +178,7 @@ public class ReflectionUtils {
* @param aFieldName - Field name in {@link String} form.
* @return - Valid, non-final, {@link Field} object, or {@link null}.
*/
- public static Field getField(final Class aClass, final String aFieldName) {
+ public static Field getField(final Class<?> aClass, final String aFieldName) {
if (aClass == null || aFieldName == null || aFieldName.length() <= 0) {
return null;
}
@@ -662,7 +662,7 @@ public class ReflectionUtils {
return m;
}
- private static Method getMethod_Internal(Class aClass, String aMethodName, Class... aTypes) {
+ private static Method getMethod_Internal(Class<?> aClass, String aMethodName, Class<?>... aTypes) {
Method m = null;
try {
Logger.REFLECTION("Method: Internal Lookup: "+aMethodName);
@@ -704,7 +704,7 @@ public class ReflectionUtils {
}
}
- private static void dumpClassInfo(Class aClass) {
+ private static void dumpClassInfo(Class<?> aClass) {
Logger.INFO("We ran into an error processing reflection in "+aClass.getName()+", dumping all data for debugging.");
// Get the methods
Method[] methods = aClass.getDeclaredMethods();
@@ -720,7 +720,7 @@ public class ReflectionUtils {
System.out.println(f.getName());
}
Logger.INFO("Dumping all Constructors.");
- for (Constructor c : consts) {
+ for (Constructor<?> c : consts) {
System.out.println(c.getName()+" | "+c.getParameterCount()+" | "+StringUtils.getDataStringFromArray(c.getParameterTypes()));
}
}
@@ -800,4 +800,18 @@ public class ReflectionUtils {
}
+ public static boolean doesFieldExist(String clazz, String string) {
+ return doesFieldExist(ReflectionUtils.getClass(clazz), string);
+ }
+
+ public static boolean doesFieldExist(Class<?> clazz, String string) {
+ if (clazz != null) {
+ if (ReflectionUtils.getField(clazz, string) != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
}
diff --git a/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java b/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java
index d515375149..fd346590d4 100644
--- a/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java
+++ b/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java
@@ -31,6 +31,16 @@ public class Core_Agrichem implements IPlugin {
}
@Override
+ public boolean serverStart() {
+ return true;
+ }
+
+ @Override
+ public boolean serverStop() {
+ return true;
+ }
+
+ @Override
public String getPluginName() {
return "GT++ Agrichemistry Module";
}
diff --git a/src/Java/gtPlusPlus/plugin/fishing/Core_Fishing.java b/src/Java/gtPlusPlus/plugin/fishing/Core_Fishing.java
index 1a7d6833aa..48706bc986 100644
--- a/src/Java/gtPlusPlus/plugin/fishing/Core_Fishing.java
+++ b/src/Java/gtPlusPlus/plugin/fishing/Core_Fishing.java
@@ -32,6 +32,16 @@ public class Core_Fishing implements IPlugin {
}
@Override
+ public boolean serverStart() {
+ return false;
+ }
+
+ @Override
+ public boolean serverStop() {
+ return false;
+ }
+
+ @Override
public String getPluginName() {
return "GT++ Fishing Module";
}
diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java
index cf9676635d..2c808002cb 100644
--- a/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java
+++ b/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java
@@ -11,10 +11,12 @@ public class Core_VanillaFixes implements IPlugin {
final static Core_VanillaFixes mInstance;
final static VanillaBedHeightFix mBedFixInstance;
+ final static VanillaBackgroundMusicFix mMusicFixInstance;
static {
mInstance = new Core_VanillaFixes();
mBedFixInstance = new VanillaBedHeightFix(mInstance);
+ mMusicFixInstance = new VanillaBackgroundMusicFix(mInstance);
mInstance.log("Preparing "+mInstance.getPluginName()+" for use.");
}
@@ -38,6 +40,17 @@ public class Core_VanillaFixes implements IPlugin {
}
@Override
+ public boolean serverStart() {
+ mMusicFixInstance.manage();
+ return true;
+ }
+
+ @Override
+ public boolean serverStop() {
+ return true;
+ }
+
+ @Override
public String getPluginName() {
return "GT++ Vanilla Fixes Module";
}
diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBackgroundMusicFix.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBackgroundMusicFix.java
new file mode 100644
index 0000000000..0039de7da2
--- /dev/null
+++ b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBackgroundMusicFix.java
@@ -0,0 +1,59 @@
+package gtPlusPlus.plugin.fixes.vanilla;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+import gtPlusPlus.api.interfaces.IPlugin;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.plugin.fixes.interfaces.IBugFix;
+import gtPlusPlus.plugin.fixes.vanilla.music.MusicTocker;
+import gtPlusPlus.preloader.CORE_Preloader;
+
+public class VanillaBackgroundMusicFix implements IBugFix {
+
+ private final IPlugin mParent;
+ private final boolean enabled;
+ private MusicTocker mFixInstance;
+
+ public VanillaBackgroundMusicFix(IPlugin minstance) {
+ mParent = minstance;
+ if (CORE_Preloader.enableWatchdogBGM > 0 && Utils.isClient()) {
+ mParent.log("[BGM] Registering BGM delay Fix.");
+ enabled = true;
+ mFixInstance = new MusicTocker(mParent);
+ } else if (CORE_Preloader.enableWatchdogBGM > 0 && Utils.isServer()) {
+ mParent.log("[BGM] Tried registering BGM delay Fix on Server, disabling.");
+ enabled = false;
+ } else {
+ mParent.log("[BGM] Not registering BGM delay Fix.");
+ enabled = false;
+ }
+ }
+
+ public boolean isFixValid() {
+ return enabled;
+ }
+
+ public void manage() {
+ TimerTask task = new ManageTask(this.mFixInstance);
+ Timer timer = new Timer("BGM-WatchDog");
+ long delay = 1000 * 60;
+ timer.scheduleAtFixedRate(task, delay, 5000);
+ }
+
+ private static class ManageTask extends TimerTask {
+ private final MusicTocker A;
+
+ public ManageTask(MusicTocker a) {
+ A = a;
+ }
+
+ @Override
+ public void run() {
+ if (!A.mVanillaManager) {
+ A.run();
+ }
+ }
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/music/MusicTocker.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/music/MusicTocker.java
new file mode 100644
index 0000000000..452c902e05
--- /dev/null
+++ b/src/Java/gtPlusPlus/plugin/fixes/vanilla/music/MusicTocker.java
@@ -0,0 +1,130 @@
+package gtPlusPlus.plugin.fixes.vanilla.music;
+
+import java.lang.reflect.Field;
+import java.util.Random;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.api.interfaces.IPlugin;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.random.XSTR;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.preloader.CORE_Preloader;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.audio.ISound;
+import net.minecraft.client.audio.MusicTicker;
+import net.minecraft.client.audio.PositionedSoundRecord;
+import net.minecraft.util.MathHelper;
+
+@SideOnly(Side.CLIENT)
+public class MusicTocker extends MusicTicker implements Runnable {
+
+ private final Random mRandom = new XSTR();
+ private final Minecraft mMinecraft;
+ private final IPlugin mPlugin;
+ private ISound mSound;
+ private int mTimeUntilNextTrack = 100;
+
+ public boolean mVanillaManager = false;
+
+ public MusicTocker(IPlugin aPlugin) {
+ super(Minecraft.getMinecraft());
+ mPlugin = aPlugin;
+ mMinecraft = Minecraft.getMinecraft();
+ mPlugin.log("[BGM] Created BGM Watchdog with a delay of "+getDelay()+" ticks.");
+ inject();
+ }
+
+ private static int getDelay() {
+ return CORE_Preloader.enableWatchdogBGM;
+ }
+
+ private boolean inject() {
+ mPlugin.log("[BGM] Inject new Watchdog into Minecraft instance.");
+ ReflectionUtils.setField(Minecraft.getMinecraft(), "mcMusicTicker", this);
+ mPlugin.log("[BGM] Verifying...");
+ Field f = ReflectionUtils.getField(Minecraft.class, "mcMusicTicker");
+ try {
+ Object m = f.get(mMinecraft);
+ if (m != null) {
+ if (m instanceof MusicTocker || m.getClass().isAssignableFrom(getClass())) {
+ mPlugin.log("[BGM] Success.");
+ return true;
+ }
+ else if (m instanceof MusicTicker || m.getClass().isAssignableFrom(MusicTicker.class)) {
+ mPlugin.log("[BGM] Found Vanilla MusicTicker, but may be instance of MusicTocker.");
+ return true;
+ }
+ }
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ }
+
+ mPlugin.log("[BGM] Failed.");
+ return false;
+ }
+
+ private final void updateInternalNumber() {
+ if (ReflectionUtils.doesFieldExist(getClass(), "field_147676_d")) {
+ ReflectionUtils.setField(this, "field_147676_d", mTimeUntilNextTrack);
+ }
+ }
+
+ private final void updateInternalSound(ISound aSound) {
+ if (ReflectionUtils.doesFieldExist(getClass(), "field_147678_c")) {
+ ReflectionUtils.setField(this, "field_147678_c", aSound);
+ }
+ }
+
+ /**
+ * Updates the JList with a new model.
+ */
+ @Override
+ public void update() {
+ run();
+ mVanillaManager = true;
+ }
+
+ @Override
+ public void run() {
+ MusicType musictype = this.mMinecraft.func_147109_W();
+
+ if (this.mSound != null) {
+ if (!musictype.getMusicTickerLocation().equals(this.mSound.getPositionedSoundLocation())) {
+ this.mMinecraft.getSoundHandler().stopSound(this.mSound);
+ this.mTimeUntilNextTrack = MathHelper.getRandomIntegerInRange(this.mRandom, 0, getDelay() / 2);
+ updateInternalNumber();
+ Logger.INFO("[BGM] Adjusted BGM delay 1");
+ }
+ if (!this.mMinecraft.getSoundHandler().isSoundPlaying(this.mSound)) {
+ this.mSound = null;
+ updateInternalSound(null);
+ this.mTimeUntilNextTrack = Math.min(MathHelper.getRandomIntegerInRange(this.mRandom, getDelay(), getDelay() * 2), this.mTimeUntilNextTrack);
+ updateInternalNumber();
+ Logger.INFO("[BGM] Adjusted BGM delay 2");
+ }
+ }
+ else if (this.mSound == null && this.mTimeUntilNextTrack-- <= 0) {
+ this.mSound = PositionedSoundRecord.func_147673_a(musictype.getMusicTickerLocation());
+ updateInternalSound(mSound);
+ this.mMinecraft.getSoundHandler().playSound(this.mSound);
+ this.mTimeUntilNextTrack = getDelay();
+ updateInternalNumber();
+ Logger.INFO("[BGM] Adjusted BGM 3");
+ }
+
+ /*
+ * try { // Get Value stored in underlying object. Integer aRealDelay =
+ * (Integer) ReflectionUtils.getField(getClass(), "field_147676_d").get(this);
+ *
+ * if (aRealDelay == null) { return; } else { if (aRealDelay > getDelay() ||
+ * aRealDelay <= 0) { this.mTimeUntilNextTrack = getDelay();
+ * updateInternalNumber(); } else { this.mTimeUntilNextTrack -= 5 * 20;
+ * updateInternalNumber(); } aRealDelay = (Integer)
+ * ReflectionUtils.getField(getClass(), "field_147676_d").get(this);
+ * Logger.INFO("[BGM] Adjusted BGM - "+aRealDelay); }
+ *
+ * } catch (IllegalArgumentException | IllegalAccessException e) { }
+ */
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/plugin/manager/Core_Manager.java b/src/Java/gtPlusPlus/plugin/manager/Core_Manager.java
index 4526a43a5b..45e85d68ac 100644
--- a/src/Java/gtPlusPlus/plugin/manager/Core_Manager.java
+++ b/src/Java/gtPlusPlus/plugin/manager/Core_Manager.java
@@ -74,5 +74,37 @@ public class Core_Manager {
return false;
}
+ public static boolean serverStart() {
+ try {
+ for (IPlugin h : mPlugins) {
+ if (h.serverStart()) {
+ Logger.INFO("[Plugin] Completed Server Start Phase for "+h.getPluginName()+".");
+ }
+ else {
+ Logger.INFO("[Plugin] Failed during Server Start Phase for "+h.getPluginName()+".");
+ }
+ }
+ return true;
+ }
+ catch (Throwable t) {}
+ return false;
+ }
+
+ public static boolean serverStop() {
+ try {
+ for (IPlugin h : mPlugins) {
+ if (h.serverStop()) {
+ Logger.INFO("[Plugin] Completed Server Stop Phase for "+h.getPluginName()+".");
+ }
+ else {
+ Logger.INFO("[Plugin] Failed during Server Stop Phase for "+h.getPluginName()+".");
+ }
+ }
+ return true;
+ }
+ catch (Throwable t) {}
+ return false;
+ }
+
}
diff --git a/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java b/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java
index 92dae4e913..6da6ddccaa 100644
--- a/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java
+++ b/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java
@@ -85,6 +85,16 @@ public class Core_SulfuricChemistry implements IPlugin {
}
@Override
+ public boolean serverStart() {
+ return false;
+ }
+
+ @Override
+ public boolean serverStop() {
+ return false;
+ }
+
+ @Override
public String getPluginName() {
return "GT++ Revised Sulfuric Chemistry Module";
}
diff --git a/src/Java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java b/src/Java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java
index 01fd549c7b..09e4c4865f 100644
--- a/src/Java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java
+++ b/src/Java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java
@@ -102,6 +102,22 @@ public class Core_VillagerAdditions implements IPlugin {
}
@Override
+ public boolean serverStart() {
+ if (shouldLoad) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean serverStop() {
+ if (shouldLoad) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
public String getPluginName() {
return "GT++ Enhanced Villagers";
}
diff --git a/src/Java/gtPlusPlus/plugin/waila/Core_WailaPlugin.java b/src/Java/gtPlusPlus/plugin/waila/Core_WailaPlugin.java
index e3af6d9681..3317ef6a11 100644
--- a/src/Java/gtPlusPlus/plugin/waila/Core_WailaPlugin.java
+++ b/src/Java/gtPlusPlus/plugin/waila/Core_WailaPlugin.java
@@ -37,6 +37,16 @@ public class Core_WailaPlugin implements IPlugin {
}
@Override
+ public boolean serverStart() {
+ return mActive;
+ }
+
+ @Override
+ public boolean serverStop() {
+ return mActive;
+ }
+
+ @Override
public String getPluginName() {
return "GT++ WAILA module";
}
diff --git a/src/Java/gtPlusPlus/preloader/CORE_Preloader.java b/src/Java/gtPlusPlus/preloader/CORE_Preloader.java
index 09ce810ccd..b8ebdaf49c 100644
--- a/src/Java/gtPlusPlus/preloader/CORE_Preloader.java
+++ b/src/Java/gtPlusPlus/preloader/CORE_Preloader.java
@@ -7,7 +7,8 @@ import java.util.List;
public class CORE_Preloader {
public static final String NAME = "GT++ Preloader";
public static final String MODID = "GT++_Preloader";
- public static final String VERSION = "0.3-Alpha";
+ public static final String VERSION = "0.4-Beta";
public static boolean enableOldGTcircuits = false;
+ public static int enableWatchdogBGM = 0;
public static List<?> DEPENDENCIES = new ArrayList<>(Arrays.asList(new String[] {"required-before:gregtech;"}));
}
diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java
index c175d921b1..d8a4bf96f5 100644
--- a/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java
+++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java
@@ -15,6 +15,7 @@ import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.util.Utils;
import gtPlusPlus.preloader.CORE_Preloader;
import net.minecraftforge.common.config.Configuration;
@@ -72,12 +73,28 @@ public class Preloader_DummyContainer extends DummyModContainer {
}
public static void handleConfigFile(final FMLPreInitializationEvent event) {
- final Configuration config = new Configuration(
- new File(event.getModConfigurationDirectory(), "GTplusplus/GTplusplus.cfg"));
+ final Configuration config = new Configuration(new File(event.getModConfigurationDirectory(), "GTplusplus/GTplusplus.cfg"));
config.load();
+ //BGM Watchdog
+ CORE_Preloader.enableWatchdogBGM = config.getInt("enableWatchdogBGM", "features", 0, 0, Short.MAX_VALUE, "Set to a value greater than 0 to reduce the ticks taken to delay between BGM tracks. Acceptable Values are 1-32767, where 0 is disabled. Vanilla Uses 12,000 & 24,000. 200 is 10s.");
+
// Circuits
- CORE_Preloader.enableOldGTcircuits = config.getBoolean("enableOldGTcircuits", "gregtech", false,
- "Restores circuits and their recipes from Pre-5.09.28 times.");
+ CORE_Preloader.enableOldGTcircuits = config.getBoolean("enableOldGTcircuits", "gregtech", false, "Restores circuits and their recipes from Pre-5.09.28 times.");
+ }
+
+ public static boolean getConfig(){
+ final Configuration config = new Configuration( new File(Utils.getMcDir(), "config/GTplusplus/GTplusplus.cfg"));
+ if (config != null){
+ config.load();
+ // Circuits
+ CORE_Preloader.enableOldGTcircuits = config.getBoolean("enableOldGTcircuits", "gregtech", false, "Restores circuits and their recipes from Pre-5.09.28 times.");
+ CORE_Preloader.enableWatchdogBGM = config.getInt("enableWatchdogBGM", "features", 0, 0, Short.MAX_VALUE, "Set to a value greater than 0 to reduce the ticks taken to delay between BGM tracks. Acceptable Values are 1-32767, where 0 is disabled. Vanilla Uses 12,000 & 24,000. 200 is 10s.");
+
+ Logger.INFO("GT++ Preloader - Loaded the configuration file.");
+ return true;
+ }
+ Logger.INFO("GT++ Preloader - Failed loading the configuration file.");
+ return false;
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer.java b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer.java
index cba11d4e29..05a476c1c8 100644
--- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer.java
+++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer.java
@@ -1,8 +1,10 @@
package gtPlusPlus.preloader.asm.transformers;
-import static org.objectweb.asm.Opcodes.*;
-
-import java.io.File;
+import static org.objectweb.asm.Opcodes.ALOAD;
+import static org.objectweb.asm.Opcodes.ASM5;
+import static org.objectweb.asm.Opcodes.IFEQ;
+import static org.objectweb.asm.Opcodes.INVOKESTATIC;
+import static org.objectweb.asm.Opcodes.RETURN;
import org.apache.logging.log4j.Level;
import org.objectweb.asm.ClassVisitor;
@@ -11,26 +13,7 @@ import org.objectweb.asm.MethodVisitor;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.preloader.CORE_Preloader;
-import net.minecraftforge.common.config.Configuration;
-
-public class Preloader_ClassTransformer {
-
- public static boolean getConfig(){
- final Configuration config = new Configuration( new File(Utils.getMcDir(), "config/GTplusplus/GTplusplus.cfg"));
- if (config != null){
- config.load();
- // Circuits
- CORE_Preloader.enableOldGTcircuits = config.getBoolean("enableOldGTcircuits", "gregtech", false,
- "Restores circuits and their recipes from Pre-5.09.28 times.");
- Logger.INFO("GT++ ASM - Loaded the configuration file.");
- return CORE_Preloader.enableOldGTcircuits;
- }
- Logger.INFO("GT++ ASM - Failed loading the configuration file.");
- return false;
- }
+public class Preloader_ClassTransformer {
public static final class OreDictionaryVisitor extends ClassVisitor {
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 8a29dc5db2..be23123193 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java
@@ -18,13 +18,7 @@ public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid {
public static final boolean mGt6Pipe;
static {
- Boolean aGt6 = (Boolean) StaticFields59.getFieldFromGregtechProxy("gt6Pipe");
- if (aGt6 != null) {
- mGt6Pipe = aGt6;
- }
- else {
- mGt6Pipe = false;
- }
+ mGt6Pipe = StaticFields59.mGT6StylePipes;
}
public final GT_Materials mMaterial;
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 77f3a31020..61c563d7c7 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
@@ -35,6 +35,7 @@ import gtPlusPlus.core.material.ELEMENT;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.minecraft.FluidUtils;
import gtPlusPlus.core.util.minecraft.MaterialUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity;
import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.BaseCustomPower_MTE;
import net.minecraft.block.Block;
@@ -94,8 +95,13 @@ public class Meta_GT_Proxy {
//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");
+ if (ReflectionUtils.doesFieldExist(GT_Proxy.class, "gt6Pipe")) {
+ StaticFields59.mGT6StylePipes = (boolean) StaticFields59.getFieldFromGregtechProxy("gt6Pipe");
+ }
+ else {
+ StaticFields59.mGT6StylePipes = false;
+ }
GT_Log.out.println("GT++ Mod: Registering the BaseMetaTileEntity.");
GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntity_GTPP");
diff --git a/src/resources/assets/miscutils/lang/en_US.lang b/src/resources/assets/miscutils/lang/en_US.lang
index 38188e838b..cf25dad8a9 100644
--- a/src/resources/assets/miscutils/lang/en_US.lang
+++ b/src/resources/assets/miscutils/lang/en_US.lang
@@ -2956,3 +2956,6 @@ item.GTPP.bauble.fireprotection.0.name=Supreme Pizza Gloves
//Added 16/5/19
item.itemCellSeleniumDioxide.name=Selenium Dioxide Cell
item.itemCellSeleniousAcid.name=Selenious Acid Cell
+
+//Added 25/8/19
+container.pestkiller=Pest Killer
diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_PESTKILLER_TOP.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_PESTKILLER_TOP.png
new file mode 100644
index 0000000000..2602f44af3
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_PESTKILLER_TOP.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/entity/batKing.png b/src/resources/assets/miscutils/textures/entity/batKing.png
new file mode 100644
index 0000000000..ced2722563
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/entity/batKing.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/gui/PestKiller.png b/src/resources/assets/miscutils/textures/gui/PestKiller.png
new file mode 100644
index 0000000000..d1978ae04a
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/gui/PestKiller.png
Binary files differ