aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-01-31 03:49:33 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2019-01-31 03:49:33 +0000
commitc0daba1659c667342da1529c31896a98768a8eda (patch)
treee1e1f25c265c63fb2dbbb5c113e941a92e9cfa4c /src
parent241df1134f16c6c9c54b198db97279d697de8c77 (diff)
downloadGT5-Unofficial-c0daba1659c667342da1529c31896a98768a8eda.tar.gz
GT5-Unofficial-c0daba1659c667342da1529c31896a98768a8eda.tar.bz2
GT5-Unofficial-c0daba1659c667342da1529c31896a98768a8eda.zip
+ Added a config option for control cores. Someone should definitely test this works as expected.
% Reduced cost of Hatch_Control_Core recipe. % Minor tweaks to Fish Traps. $ Fixed inventory shuffling for some Tile Entities. $ Fixed Super Jukebox, it's now mostly functional. $ Fixed constructBaseMetaTileEntity returning the wrong type of Entity for pre-existing wooden pipes, this should now get caught and thrown if the GT++ entity fails to a ClassCastException.
Diffstat (limited to 'src')
-rw-r--r--src/Java/gtPlusPlus/core/block/ModBlocks.java2
-rw-r--r--src/Java/gtPlusPlus/core/block/general/BlockSuperLight.java220
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/Machine_SuperJukebox.java662
-rw-r--r--src/Java/gtPlusPlus/core/config/ConfigHandler.java5
-rw-r--r--src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java217
-rw-r--r--src/Java/gtPlusPlus/core/gui/GUI_Base_Tile_Entity.java15
-rw-r--r--src/Java/gtPlusPlus/core/gui/machine/GUI_SuperJukebox.java82
-rw-r--r--src/Java/gtPlusPlus/core/handler/GuiHandler.java6
-rw-r--r--src/Java/gtPlusPlus/core/inventories/Inventory_SuperJukebox.java172
-rw-r--r--src/Java/gtPlusPlus/core/lib/CORE.java1
-rw-r--r--src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java16
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotJukebox.java37
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java66
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java38
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java17
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java50
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java23
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java9
-rw-r--r--src/resources/assets/miscutils/textures/gui/SuperJukebox.pngbin0 -> 5198 bytes
19 files changed, 1267 insertions, 371 deletions
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java
index dc1239f4be..f95f8814a9 100644
--- a/src/Java/gtPlusPlus/core/block/ModBlocks.java
+++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java
@@ -125,7 +125,7 @@ public final class ModBlocks {
blockPlayerDoorCustom_Ice = new PlayerDoors(Material.ice, "door_ice", false);
blockPlayerDoorCustom_Cactus = new PlayerDoors(Material.cactus, "door_cactus", false, 0.6f, Block.soundTypeGrass, "Cactus");
- blockCustomSuperLight = new BlockSuperLight();
+ //blockCustomSuperLight = new BlockSuperLight();
blockCustomJukebox = new Machine_SuperJukebox();
}
diff --git a/src/Java/gtPlusPlus/core/block/general/BlockSuperLight.java b/src/Java/gtPlusPlus/core/block/general/BlockSuperLight.java
new file mode 100644
index 0000000000..a1ba3be487
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/block/general/BlockSuperLight.java
@@ -0,0 +1,220 @@
+package gtPlusPlus.core.block.general;
+
+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.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockAir;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.init.Blocks;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+public class BlockSuperLight extends BlockContainer {
+
+ @SideOnly(Side.CLIENT)
+ private IIcon textureFront;
+
+ //propecia (Inhibit DHD - recover hair get depression)
+
+ public BlockSuperLight() {
+ super(Material.circuits);
+ this.setBlockName("blockSuperLight");
+ this.setCreativeTab(CreativeTabs.tabRedstone);
+ GameRegistry.registerBlock(this, "blockSuperLight");
+ LanguageRegistry.addName(this, "Shining Star");
+ }
+
+ /**
+ * Gets the block's texture. Args: side, meta
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) {
+ return this.blockIcon;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(final IIconRegister p_149651_1_) {
+ this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "SwirlBigBlue");
+ }
+
+ /**
+ * Returns a new instance of a block's tile entity class. Called on placing the
+ * block.
+ */
+ public TileEntity createNewTileEntity(World aWorld, int p_149915_2_) {
+ return new TileEntitySuperLight();
+ }
+
+ public static class TileEntitySuperLight extends TileEntity {
+
+ private long mCreated;
+
+ private long mLastUpdateTick = 0;
+
+ private int mLitBlockCount = 0;
+
+ private int[][][][] aLitBlocks = new int[50][10][50][1];
+
+ private boolean mPowered = false;
+
+ public TileEntitySuperLight() {
+ mCreated = System.currentTimeMillis();
+ Logger.INFO("Created Super-Lamp");
+ }
+
+ public void readFromNBT(NBTTagCompound aNBT) {
+ super.readFromNBT(aNBT);
+ mCreated = aNBT.getLong("mCreated");
+ mPowered = aNBT.getBoolean("mPowered");
+ NBTTagCompound aLightingData = aNBT.getCompoundTag("lighting");
+ for (int x = 0; x < 50; x++) {
+ for (int y = 0; y < 10; y++) {
+ for (int z = 0; z < 50; z++) {
+ int aData = aLightingData.getInteger("["+x+"]["+y+"]["+z+"]");
+ aLitBlocks[x][y][z][0] = aData;
+ }
+ }
+ }
+ }
+
+ public void writeToNBT(NBTTagCompound aNBT) {
+ super.writeToNBT(aNBT);
+ aNBT.setLong("mCreated", mCreated);
+ aNBT.setBoolean("mPowered", mPowered);
+ NBTTagCompound aLightingData = new NBTTagCompound();
+ for (int x = 0; x < 50; x++) {
+ for (int y = 0; y < 10; y++) {
+ for (int z = 0; z < 50; z++) {
+ int aFlag = aLitBlocks[x][y][z][0];
+ aLightingData.setInteger("["+x+"]["+y+"]["+z+"]", aFlag);
+ }
+ }
+ }
+ aNBT.setTag("lighting", aLightingData);
+ }
+
+ @Override
+ public void updateEntity() {
+ super.updateEntity();
+
+ if (this.worldObj.isRemote) {
+ return;
+ }
+
+ try {
+ if (mLastUpdateTick == 0 || (System.currentTimeMillis() - mLastUpdateTick) >= 30000) {
+ boolean powered = (this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord));
+ boolean aLastState = mPowered;
+ //Logger.INFO("Powered: "+powered);
+ mPowered = powered;
+ if (mPowered != aLastState) {
+ updateLighting(powered);
+ }
+ }
+ } catch (Throwable t) {
+ }
+ }
+
+ @Override
+ public void markDirty() {
+ super.markDirty();
+ }
+
+ @Override
+ public boolean canUpdate() {
+ return super.canUpdate();
+ }
+
+ public void updateLighting(boolean enable) {
+
+
+ mLastUpdateTick = System.currentTimeMillis();
+
+ if (false) {
+ return;
+ }
+
+ aLitBlocks = new int[50][10][50][1];
+ int aLitCounter = 0;
+ AutoMap<BlockPos> aBlocksToUpdate = new AutoMap<BlockPos>();
+ Logger.INFO("Trying to relight area.");
+
+ BlockPos aStartIterationPoint = new BlockPos(this.xCoord-24, this.yCoord-4, this.zCoord-24, this.worldObj);
+ for (int x = 0; x < 50; x++) {
+ for (int y = 0; y < 10; y++) {
+ for (int z = 0; z < 50; z++) {
+ int xOff = aStartIterationPoint.xPos + x;
+ int yOff = aStartIterationPoint.yPos + y;
+ int zOff = aStartIterationPoint.zPos + z;
+ Block aBlockGet = this.worldObj.getBlock(xOff, yOff, zOff);
+ if (aBlockGet != null) {
+ if (aBlockGet instanceof BlockAir || aBlockGet instanceof LightGlass) {
+
+ int aLight = aBlockGet.getLightValue();
+
+ //Don't Need to relight anything.
+ if ((enable && aLight > 0) || (!enable && aLight == 0)) {
+ continue;
+ }
+ //Turning Lights on
+ else if (enable && aLight == 0) {
+ aBlocksToUpdate.put(new BlockPos(xOff, yOff, zOff, this.worldObj));
+ if (aBlockGet instanceof BlockAir) {
+ Logger.INFO("Lit air.");
+ this.worldObj.setBlock(xOff, yOff, zOff, ModBlocks.MatterFabricatorEffectBlock, 0, 3);
+ }
+ //aBlockGet.setLightLevel(15);
+ aLitCounter++;
+ }
+ //Turning Lights off
+ else if (!enable && aLight > 0) {
+ aBlocksToUpdate.put(new BlockPos(xOff, yOff, zOff, this.worldObj));
+ if (aBlockGet instanceof LightGlass) {
+ Logger.INFO("Dimmed air.");
+ this.worldObj.setBlock(xOff, yOff, zOff, Blocks.air, 0, 3);
+ }
+ //aBlockGet.setLightLevel(0);
+ }
+ aLitBlocks[x][y][z][0] = enable ? 15 : 0;
+ }
+ else {
+ aLitBlocks[x][y][z][0] = -1;
+ }
+ }
+ else {
+ aLitBlocks[x][y][z][0] = -1;
+ }
+ }
+ }
+ }
+ mLitBlockCount = aLitCounter;
+ doLargeBlockUpdate(aBlocksToUpdate);
+ }
+
+ public void doLargeBlockUpdate(AutoMap<BlockPos> aUpdateMap) {
+ if (aUpdateMap.isEmpty()) {
+ return;
+ }
+ for (BlockPos p : aUpdateMap) {
+ //this.worldObj.markBlockForUpdate(p.xPos, p.yPos, p.zPos);
+ //this.worldObj.markBlocksDirtyVertical(p_72975_1_, p_72975_2_, p_72975_3_, p_72975_4_);
+ }
+ }
+
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_SuperJukebox.java b/src/Java/gtPlusPlus/core/block/machine/Machine_SuperJukebox.java
index e3d9d0e646..fe8120e635 100644
--- a/src/Java/gtPlusPlus/core/block/machine/Machine_SuperJukebox.java
+++ b/src/Java/gtPlusPlus/core/block/machine/Machine_SuperJukebox.java
@@ -4,13 +4,22 @@ 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 gregtech.api.util.GT_Utility;
+import gtPlusPlus.GTplusplus;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.core.handler.GuiHandler;
+import gtPlusPlus.core.inventories.Inventory_SuperJukebox;
+import gtPlusPlus.core.util.math.MathUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockJukebox;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.Item;
+import net.minecraft.item.ItemRecord;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@@ -19,10 +28,10 @@ import net.minecraft.world.World;
public class Machine_SuperJukebox extends BlockJukebox
{
- @SideOnly(Side.CLIENT)
- private IIcon mIcon;
+ @SideOnly(Side.CLIENT)
+ private IIcon mIcon;
- public Machine_SuperJukebox(){
+ public Machine_SuperJukebox(){
this.setBlockName("blockSuperJukebox");
this.setCreativeTab(CreativeTabs.tabRedstone);
setHardness(2.0F);
@@ -31,24 +40,36 @@ public class Machine_SuperJukebox extends BlockJukebox
setBlockTextureName("jukebox");
GameRegistry.registerBlock(this, "blockSuperJukebox");
LanguageRegistry.addName(this, "Sir Mixalot [Jukebox]");
- }
-
- /**
- * Gets the block's texture. Args: side, meta
- */
- @SideOnly(Side.CLIENT)
- public IIcon getIcon(int aSide, int aMeta)
- {
- return aSide == 1 ? this.mIcon : this.blockIcon;
- }
-
- /**
- * Called upon block activation (right click on the block.)
- */
- @Override
- public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
- {
- if (aWorld.getBlockMetadata(aX, aY, aZ) == 0)
+ }
+
+ /**
+ * Gets the block's texture. Args: side, meta
+ */
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int aSide, int aMeta)
+ {
+ return aSide == 1 ? this.mIcon : this.blockIcon;
+ }
+
+ /**
+ * 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 TileEntitySuperJukebox)){
+ player.openGui(GTplusplus.instance, GuiHandler.GUI14, world, x, y, z);
+ return true;
+ }
+ return false;
+
+
+ /* if (aWorld.getBlockMetadata(aX, aY, aZ) == 0)
{
return false;
}
@@ -56,23 +77,23 @@ public class Machine_SuperJukebox extends BlockJukebox
{
this.func_149925_e(aWorld, aX, aY, aZ);
return true;
- }
- }
-
- /**
- * Set the record in the {@link SuperJukebox} {@link TileEntity}.
- */
- @Override
- public final void func_149926_b(World aWorld, int aX, int aY, int aZ, ItemStack aStackToSet) {
- setRecordInJukeBox(aWorld, aX, aY, aZ, aStackToSet);
- }
-
+ }*/
+ }
+
+ /**
+ * Set the record in the {@link SuperJukebox} {@link TileEntity}.
+ */
+ @Override
+ public final void func_149926_b(World aWorld, int aX, int aY, int aZ, ItemStack aStackToSet) {
+ setRecordInJukeBox(aWorld, aX, aY, aZ, aStackToSet);
+ }
+
public void setRecordInJukeBox(World aWorld, int aX, int aY, int aZ, ItemStack aStackToSet) {
if (!aWorld.isRemote) {
TileEntitySuperJukebox tileentityjukebox = (TileEntitySuperJukebox) aWorld.getTileEntity(aX, aY, aZ);
- if (tileentityjukebox != null) {
- tileentityjukebox.func_145857_a(aStackToSet.copy());
- aWorld.setBlockMetadataWithNotify(aX, aY, aZ, 1, 2);
+ if (tileentityjukebox != null && aStackToSet.getItem() instanceof ItemRecord) {
+ tileentityjukebox.setCurrentRecord(aStackToSet.copy());
+ //aWorld.setBlockMetadataWithNotify(aX, aY, aZ, 1, 2);
}
}
}
@@ -80,13 +101,13 @@ public class Machine_SuperJukebox extends BlockJukebox
/**
* Function to handle playing of records.
*/
- @Override
- public final void func_149925_e(World aWorld, int aX, int aY, int aZ) {
- playerJukeboxRecord(aWorld, aX, aY, aZ);
+ @Override
+ public final void func_149925_e(World aWorld, int aX, int aY, int aZ) {
+ playJukeboxRecord(aWorld, aX, aY, aZ);
}
-
- public void playerJukeboxRecord(World aWorld, int aX, int aY, int aZ) {
- if (!aWorld.isRemote) {
+
+ public void playJukeboxRecord(World aWorld, int aX, int aY, int aZ) {
+ if (!aWorld.isRemote) {
TileEntitySuperJukebox tileentityjukebox = (TileEntitySuperJukebox) aWorld.getTileEntity(aX,
aY, aZ);
@@ -94,11 +115,14 @@ public class Machine_SuperJukebox extends BlockJukebox
ItemStack itemstack = tileentityjukebox.func_145856_a();
if (itemstack != null) {
- aWorld.playAuxSFX(1005, aX, aY, aZ, 0);
- aWorld.playRecord((String) null, aX, aY, aZ);
- tileentityjukebox.func_145857_a((ItemStack) null);
- aWorld.setBlockMetadataWithNotify(aX, aY, aZ, 0, 2);
- float f = 0.7F;
+
+
+
+ aWorld.playAuxSFX(1005, aX, aY, aZ, Item.getIdFromItem(itemstack.getItem()));
+ //aWorld.playRecord((String) null, aX, aY, aZ);
+ //tileentityjukebox.func_145857_a((ItemStack) null);
+ //aWorld.setBlockMetadataWithNotify(aX, aY, aZ, 0, 2);
+ /*float f = 0.7F;
double d0 = (double) (aWorld.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double d1 = (double) (aWorld.rand.nextFloat() * f) + (double) (1.0F - f) * 0.2D + 0.6D;
double d2 = (double) (aWorld.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
@@ -106,110 +130,452 @@ public class Machine_SuperJukebox extends BlockJukebox
EntityItem entityitem = new EntityItem(aWorld, (double) aX + d0,
(double) aY + d1, (double) aZ + d2, itemstack1);
entityitem.delayBeforeCanPickup = 10;
- aWorld.spawnEntityInWorld(entityitem);
+ aWorld.spawnEntityInWorld(entityitem);*/
}
}
}
- }
+ }
- @Override
- public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
- {
- this.func_149925_e(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_);
- super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
- }
+ @Override
+ public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
+ {
+ this.func_149925_e(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_);
+ super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
+ }
- /**
- * Drops the block items with a specified chance of dropping the specified items
- */
- @Override
- public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
- {
- if (!p_149690_1_.isRemote)
- {
- super.dropBlockAsItemWithChance(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, 0);
- }
- }
-
- /**
- * Returns a new instance of a block's tile entity class. Called on placing the block.
- */
- @Override
- public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
- {
- return new TileEntitySuperJukebox();
- }
-
- @SideOnly(Side.CLIENT)
- @Override
- public void registerBlockIcons(IIconRegister p_149651_1_)
- {
- this.blockIcon = p_149651_1_.registerIcon(this.getTextureName() + "_side");
- this.mIcon = p_149651_1_.registerIcon(this.getTextureName() + "_top");
- }
-
- public static class TileEntitySuperJukebox extends TileEntityJukebox {
-
- private ItemStack field_145858_a;
-
- @Override
- public void readFromNBT(NBTTagCompound aNBT)
- {
- super.readFromNBT(aNBT);
-
- if (aNBT.hasKey("RecordItem", 10))
- {
- this.func_145857_a(ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag("RecordItem")));
- }
- else if (aNBT.getInteger("Record") > 0)
- {
- this.func_145857_a(new ItemStack(Item.getItemById(aNBT.getInteger("Record")), 1, 0));
- }
- }
-
- @Override
- public void writeToNBT(NBTTagCompound aNBT)
- {
- super.writeToNBT(aNBT);
-
- if (this.func_145856_a() != null)
- {
- aNBT.setTag("RecordItem", this.func_145856_a().writeToNBT(new NBTTagCompound()));
- aNBT.setInteger("Record", Item.getIdFromItem(this.func_145856_a().getItem()));
- }
- }
-
- /**
- * Called to get the internal stack
- */
- @Override
- public ItemStack func_145856_a()
- {
- return this.field_145858_a;
- }
-
- /**
- * Called to get the internal stack, wraps vanilla function {@link func_145856_a}.
- */
- public ItemStack getCurrentRecord() {
- return func_145856_a();
- }
-
- /**
- * Called to set the internal stack
- */
- @Override
- public void func_145857_a(ItemStack p_145857_1_)
- {
- this.field_145858_a = p_145857_1_;
- this.markDirty();
- }
-
- /**
- * Called to set the internal stack, wraps vanilla function {@link func_145857_a}.
- */
- public void setCurrentRecord(ItemStack aStack) {
- func_145857_a(aStack);
- }
- }
+ /**
+ * Drops the block items with a specified chance of dropping the specified items
+ */
+ @Override
+ public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
+ {
+ if (!p_149690_1_.isRemote)
+ {
+ super.dropBlockAsItemWithChance(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, 0);
+ }
+ }
+
+ /**
+ * Returns a new instance of a block's tile entity class. Called on placing the block.
+ */
+ @Override
+ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
+ {
+ return new TileEntitySuperJukebox();
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public void registerBlockIcons(IIconRegister p_149651_1_)
+ {
+ this.blockIcon = p_149651_1_.registerIcon(this.getTextureName() + "_side");
+ this.mIcon = p_149651_1_.registerIcon(this.getTextureName() + "_top");
+ }
+
+ public static class TileEntitySuperJukebox extends TileEntityJukebox implements ISidedInventory {
+
+ /** The number of players currently using this chest */
+ public int numPlayersUsing;
+ private ItemStack mCurrentlyPlayingStack;
+ private final Inventory_SuperJukebox inventoryContents;
+ private String customName;
+
+
+ /*
+ * Important Data
+ */
+
+ public int a_TEST_INT_VAR_1;
+ public int a_TEST_INT_VAR_2;
+ public int a_TEST_INT_VAR_3;
+ public int a_TEST_INT_VAR_4;
+
+ public boolean mIsPlaying = false;
+ public boolean mIsLooping = false;
+ public boolean a_TEST_BOOL_VAR_3;
+ public boolean a_TEST_BOOL_VAR_4;
+
+
+
+ public TileEntitySuperJukebox() {
+ this.inventoryContents = new Inventory_SuperJukebox();
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound aNBT) {
+ super.readFromNBT(aNBT);
+
+ if (aNBT.hasKey("RecordItem", 10)) {
+ this.func_145857_a(ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag("RecordItem")));
+ } else if (aNBT.getInteger("Record") > 0) {
+ this.func_145857_a(new ItemStack(Item.getItemById(aNBT.getInteger("Record")), 1, 0));
+ }
+
+ this.inventoryContents.readFromNBT(aNBT.getCompoundTag("ContentsChest"));
+ if (aNBT.hasKey("CustomName", 8)) {
+ this.setCustomName(aNBT.getString("CustomName"));
+ }
+
+ mIsPlaying = aNBT.getBoolean("mIsPlaying");
+ mIsLooping = aNBT.getBoolean("mIsLooping");
+
+
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound aNBT) {
+ super.writeToNBT(aNBT);
+
+ if (this.getCurrentRecord() != null) {
+ aNBT.setTag("RecordItem", this.func_145856_a().writeToNBT(new NBTTagCompound()));
+ aNBT.setInteger("Record", Item.getIdFromItem(this.func_145856_a().getItem()));
+ }
+
+ final NBTTagCompound chestData = new NBTTagCompound();
+ this.inventoryContents.writeToNBT(chestData);
+ aNBT.setTag("ContentsChest", chestData);
+ if (this.hasCustomInventoryName()) {
+ aNBT.setString("CustomName", this.getCustomName());
+ }
+
+ aNBT.setBoolean("mIsPlaying", mIsPlaying);
+ aNBT.setBoolean("mIsLooping", mIsLooping);
+
+ }
+
+ /**
+ * Called to get the internal stack
+ */
+ @Override
+ public ItemStack func_145856_a() {
+ return this.mCurrentlyPlayingStack;
+ }
+
+ /**
+ * Called to get the internal stack, wraps vanilla function
+ * {@link func_145856_a}.
+ */
+ public ItemStack getCurrentRecord() {
+ return func_145856_a();
+ }
+
+ /**
+ * Called to set the internal stack
+ */
+ @Override
+ public void func_145857_a(ItemStack p_145857_1_) {
+ this.mCurrentlyPlayingStack = p_145857_1_;
+ this.markDirty();
+ }
+
+ /**
+ * Called to set the internal stack, wraps vanilla function
+ * {@link func_145857_a}.
+ */
+ public void setCurrentRecord(ItemStack aStack) {
+ func_145857_a(aStack);
+ this.markDirty();
+ }
+
+ public Inventory_SuperJukebox getInventory() {
+ return this.inventoryContents;
+ }
+
+
+
+
+
+ public boolean playRecord(ItemStack aRecord) {
+
+
+
+ return false;
+ }
+
+ public boolean stopRecord() {
+ return openDiscDrive();
+ }
+
+ public void setLoopState(boolean isShufflingForever) {
+
+
+
+ }
+
+
+ //Play button pressed
+ public boolean jukeboxLogicUpdate() {
+
+ if (this.worldObj.isRemote) {
+ return true;
+ }
+
+ Logger.INFO("a");
+ if (this.mIsPlaying || this.mIsLooping) {
+ return selectRecordToPlayFromInventoryAndSetViaVanillaHandler();
+ }
+ else {
+ return stopRecord();
+ }
+ }
+
+
+ //Determine which record to play
+ public boolean selectRecordToPlayFromInventoryAndSetViaVanillaHandler() {
+ AutoMap<ItemStack> mValidRecords = new AutoMap<ItemStack>();
+ for (ItemStack g : this.getInventory().getInventory()) {
+ if (g != null) {
+ if (g.getItem() instanceof ItemRecord) {
+ mValidRecords.put(g);
+ }
+ }
+ }
+
+ Logger.INFO("b1");
+ //Select First Record
+ ItemStack aRecordToPlay;
+ if (mValidRecords.size() == 0) {
+ Logger.INFO("bX");
+ return false;
+ }
+ else {
+ aRecordToPlay = mValidRecords.get(!mIsLooping ? 0 : MathUtils.randInt(0, (mValidRecords.size()-1)));
+ }
+ Logger.INFO("b2 - "+aRecordToPlay.getDisplayName());
+
+ int aSlotCounter = 0;
+ for (ItemStack g : this.getInventory().getInventory()) {
+ if (g != null && aSlotCounter <= 17) {
+ Logger.INFO("b3 - "+g.getDisplayName());
+ if (GT_Utility.areStacksEqual(g, aRecordToPlay, true)) {
+ IInventory aThisInv = this.getInventory();
+ if (aThisInv.getStackInSlot(20) != null) {
+ openDiscDrive();
+ }
+
+ GT_Utility.moveStackFromSlotAToSlotB(aThisInv, aThisInv, aSlotCounter, 20, (byte) 1, (byte) 1, (byte) 1, (byte) 1);
+ setCurrentRecord(aThisInv.getStackInSlot(20));
+
+ World aWorld = this.worldObj;
+ int aX = this.xCoord;
+ int aY = this.yCoord;
+ int aZ = this.zCoord;
+ if (!aWorld.isRemote) {
+ aRecordToPlay = this.func_145856_a();
+ if (aRecordToPlay != null) {
+ aWorld.playAuxSFX(1005, aX, aY, aZ, Item.getIdFromItem(aRecordToPlay.getItem()));
+ this.markDirty();
+ return true;
+ }
+ }
+
+ Logger.INFO("b++");
+ this.markDirty();
+ return false;
+ }
+ }
+ aSlotCounter++;
+ }
+
+
+ Logger.INFO("b4");
+ this.markDirty();
+ return false;
+ }
+
+
+ public boolean genericMethodThree(Object a1, Object a2, Object a3, Object a4) {
+ return false;
+ }
+
+
+ public void vanillaStopJukebox() {
+ World aWorld = this.worldObj;
+ int aX = this.xCoord;
+ int aY = this.yCoord;
+ int aZ = this.zCoord;
+ if (!aWorld.isRemote) {
+ TileEntitySuperJukebox tileentityjukebox = (TileEntitySuperJukebox) aWorld.getTileEntity(aX, aY, aZ);
+ if (tileentityjukebox != null) {
+ ItemStack aRecordToPlay = tileentityjukebox.func_145856_a();
+ if (aRecordToPlay != null) {
+ aWorld.playAuxSFX(1005, aX, aY, aZ, 0);
+ aWorld.playRecord((String) null, aX, aY, aZ);
+ tileentityjukebox.func_145857_a((ItemStack) null);
+ this.markDirty();
+ }
+ }
+ }
+ }
+
+ public boolean openDiscDrive() {
+ int aSlotCounter = 17;
+
+ ItemStack g;
+
+ for (int i = 17; i >= 0; i--) {
+ g = this.getInventory().getInventory()[i];
+ if (g == null && aSlotCounter >= 0) {
+ IInventory aThisInv = this.getInventory();
+ GT_Utility.moveStackFromSlotAToSlotB(aThisInv, aThisInv, 20, i, (byte) 1, (byte) 1, (byte) 1, (byte) 1);
+ vanillaStopJukebox();
+ Logger.INFO("b++");
+ this.markDirty();
+ return true;
+
+ }
+ }
+
+
+ /*for (ItemStack g : this.getInventory().getInventory()) {
+ if (g == null && aSlotCounter >= 0) {
+ IInventory aThisInv = this.getInventory();
+ GT_Utility.moveStackFromSlotAToSlotB(aThisInv, aThisInv, 20, aSlotCounter, (byte) 1, (byte) 1, (byte) 1, (byte) 1);
+ vanillaStopJukebox();
+ Logger.INFO("b++");
+ return true;
+
+ }
+ aSlotCounter--;
+ } */
+ this.markDirty();
+ return false;
+ }
+
+
+
+
+
+
+
+
+
+
+ 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 int getSizeInventory() {
+ return this.getInventory().getSizeInventory()-3;
+ }
+
+ @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 1;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer entityplayer) {
+ return this.getInventory().isUseableByPlayer(entityplayer);
+ }
+
+ @Override
+ public void openInventory() {
+ if (this.numPlayersUsing < 0) {
+ this.numPlayersUsing = 0;
+ }
+ if (!this.worldObj.isRemote) {
+ this.numPlayersUsing++;
+ }
+ this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1,
+ this.numPlayersUsing);
+ 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() {
+ if (!this.worldObj.isRemote) {
+ this.numPlayersUsing--;
+ }
+ this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1,
+ this.numPlayersUsing);
+ 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) {
+ if (slot >= 18) {
+ return false;
+ }
+ 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 p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) {
+ if (p_102007_1_ >= 18) {
+ return false;
+ }
+ return this.getInventory().isItemValidForSlot(p_102007_1_, p_102007_2_);
+ }
+
+ @Override
+ public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) {
+ if (p_102008_1_ >= 18) {
+ return false;
+ }
+ return this.getInventory().isItemValidForSlot(p_102008_1_, p_102008_2_);
+ }
+
+ public String getCustomName() {
+ return this.customName;
+ }
+
+ public void setCustomName(final String customName) {
+ this.customName = customName;
+ }
+
+ @Override
+ public String getInventoryName() {
+ return this.hasCustomInventoryName() ? this.customName : "container.SuperJukebox";
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return (this.customName != null) && !this.customName.equals("");
+ }
+
+ }
} \ 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 d5a43ab883..2fbd3f60c2 100644
--- a/src/Java/gtPlusPlus/core/config/ConfigHandler.java
+++ b/src/Java/gtPlusPlus/core/config/ConfigHandler.java
@@ -46,7 +46,10 @@ public class ConfigHandler {
enableAlternativeDivisionSigilRecipe = config.getBoolean("enableAlternativeDivisionSigilRecipe", "machines",
false, "Utilizes Neutronium instead.");
boilerSteamPerSecond = config.getInt("boilerSteamPerSecond", "machines", 750, 0, 10000, "Sets the steam per second value in LV,MV,HV boilers (respectively 1x,2x,3x this number for the tiers)");
-
+ requireControlCores = config.getBoolean("requireControlCores", "machines", true, "Multiblocks Require Control Cores");
+
+
+
//Circuits
enableCustomCircuits = config.getBoolean("enableCustomCircuits", "gregtech", false,
"Adds custom circuits to expand past the Master Tier. Only really recommended to enable if enableOldGTcircuits is enabled.");
diff --git a/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java b/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java
index cb2f33dd47..34a4e9fa97 100644
--- a/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java
+++ b/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java
@@ -1,37 +1,46 @@
package gtPlusPlus.core.container;
+import java.util.Iterator;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox;
+import gtPlusPlus.core.inventories.Inventory_SuperJukebox;
+import gtPlusPlus.core.slots.SlotIntegratedCircuit;
+import gtPlusPlus.core.slots.SlotJukebox;
+import gtPlusPlus.core.slots.SlotNoInput;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.core.block.ModBlocks;
-import gtPlusPlus.core.inventories.InventoryCircuitProgrammer;
-import gtPlusPlus.core.slots.SlotIntegratedCircuit;
-import gtPlusPlus.core.slots.SlotNoInput;
-import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer;
public class Container_SuperJukebox extends Container {
- protected TileEntityCircuitProgrammer tile_entity;
- public final InventoryCircuitProgrammer inventoryChest;
+ protected TileEntitySuperJukebox tile_entity;
+ public final Inventory_SuperJukebox inventoryChest;
private final World worldObj;
private final int posX;
private final int posY;
private final int posZ;
- public static final int SLOT_OUTPUT = 25;
+
+ public static final int SLOT_HOLO_PLAY = 18;
+ public static final int SLOT_HOLO_LOOP = 19;
+ public static final int SLOT_OUTPUT = 20;
public static int StorageSlotNumber = 26; // Number of slots in storage area
public static int InventorySlotNumber = 36; // Inventory Slots (Inventory
- // and Hotbar)
+ // and Hotbar)
public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All
- // slots
+ // slots
- public Container_SuperJukebox(final InventoryPlayer inventory, final TileEntityCircuitProgrammer te) {
+ public Container_SuperJukebox(final InventoryPlayer inventory, final TileEntitySuperJukebox te) {
this.tile_entity = te;
this.inventoryChest = te.getInventory();
@@ -52,79 +61,70 @@ public class Container_SuperJukebox extends Container {
o++;
}
}*/
-
-
- int xStart = 8;
- int yStart = 5;
+
+
+ int xStart = 9;
+ int yStart = 20;
try {
- //0
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart, yStart));
- //1-10
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+18));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+18));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+18));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+18));
- //11-20
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+18));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+18));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+36));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+36));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+36));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+36));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+36));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+36));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+54));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+54));
- //21-24
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+54));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+54));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+54));
- this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+54));
- Logger.INFO("2");
-
- //Add Output
- this.addSlotToContainer(new SlotNoInput(this.inventoryChest, SLOT_OUTPUT, xStart+(8*18), yStart+54));
- o++;
- Logger.INFO("3");
-
-
-
- // 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)));
+
+ //Row One
+ for (int c = 0; c < 9; c++) {
+ if (c >= 3 && c < 6) {
+ continue;
+ }
+ this.addSlotToContainer(new SlotJukebox(this.inventoryChest, o++, xStart+(18*c), yStart));
}
- }
- // Player Hotbar
- for (var6 = 0; var6 < 9; ++var6) {
- this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142));
- }
-
-
-
- Logger.INFO("4");
- }
- catch (Throwable t) {}
- }
+ //Row Two
+ for (int c = 0; c < 9; c++) {
+ if (c >= 3 && c < 6) {
+ continue;
+ }
+ this.addSlotToContainer(new SlotJukebox(this.inventoryChest, o++, xStart+(18*c), yStart+18));
+ }
+
+ //Row Two
+ for (int c = 0; c < 9; c++) {
+ if (c >= 3 && c < 6) {
+ continue;
+ }
+ this.addSlotToContainer(new SlotJukebox(this.inventoryChest, o++, xStart+(18*c), yStart+36));
+ }
+
+
+ //Controls
+ int c = 4;
+
+ //Two Control Buttons
+ this.addSlotToContainer(new SlotNoInput(this.inventoryChest, SLOT_HOLO_PLAY, xStart+(18*c), 12));
+ this.addSlotToContainer(new SlotNoInput(this.inventoryChest, SLOT_HOLO_LOOP, xStart+(18*c), 12+(1*18)));
+
+ //Active playing slot for visual
+ this.addSlotToContainer(new SlotJukebox(this.inventoryChest, SLOT_OUTPUT, xStart+(18*c), 18+(2*18), true));
- @Override
- public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold,
- final EntityPlayer aPlayer) {
- if (!aPlayer.worldObj.isRemote) {
- if ((aSlotIndex == 999) || (aSlotIndex == -999)) {
- // Utils.LOG_WARNING("??? - "+aSlotIndex);
+
+
+ // 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));
+ }
+
+
+ Logger.INFO("3");
+
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
}
- return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+
}
@Override
@@ -134,7 +134,7 @@ public class Container_SuperJukebox extends Container {
@Override
public boolean canInteractWith(final EntityPlayer par1EntityPlayer) {
- if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockCircuitProgrammer) {
+ if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockCustomJukebox) {
return false;
}
@@ -187,4 +187,65 @@ public class Container_SuperJukebox extends Container {
return super.func_94530_a(p_94530_1_, p_94530_2_);
}
+
+
+ @Override
+ public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) {
+ if (tile_entity.getWorldObj().isRemote || tile_entity == null) return null;
+ switch (aSlotIndex) {
+ case SLOT_HOLO_PLAY:
+ if (tile_entity == null) return null;
+ tile_entity.mIsPlaying = !tile_entity.mIsPlaying;
+ Logger.INFO("Jukebox | Playing: "+tile_entity.mIsPlaying);
+ tile_entity.jukeboxLogicUpdate();
+ return null;
+ case SLOT_HOLO_LOOP:
+ if (tile_entity == null) return null;
+ tile_entity.mIsLooping = !tile_entity.mIsLooping;
+ Logger.INFO("Jukebox | Looping: "+tile_entity.mIsLooping);
+ return null;
+ case 20:
+ return null;
+ default:
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+ }
+
+ public boolean isPlaying;
+ public boolean isLooping;
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (tile_entity.getWorldObj().isRemote || tile_entity == null) return;
+
+ isPlaying = tile_entity.mIsPlaying;
+ isLooping = tile_entity.mIsLooping;
+
+ Iterator var2 = this.crafters.iterator();
+ while (var2.hasNext()) {
+ ICrafting var1 = (ICrafting) var2.next();
+ var1.sendProgressBarUpdate(this, 102, isPlaying ? 1 : 0);
+ var1.sendProgressBarUpdate(this, 103, isLooping ? 1 : 0);
+ }
+ }
+
+ @Override
+ public void addCraftingToCrafters(ICrafting par1ICrafting) {
+ super.addCraftingToCrafters(par1ICrafting);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int par1, int par2) {
+ super.updateProgressBar(par1, par2);
+ switch (par1) {
+ case 102:
+ isPlaying = (par2 != 0);
+ break;
+ case 103:
+ isLooping = (par2 != 0);
+ break;
+ }
+ }
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/gui/GUI_Base_Tile_Entity.java b/src/Java/gtPlusPlus/core/gui/GUI_Base_Tile_Entity.java
new file mode 100644
index 0000000000..aa10363e7c
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/gui/GUI_Base_Tile_Entity.java
@@ -0,0 +1,15 @@
+package gtPlusPlus.core.gui;
+
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.inventory.Container;
+
+public abstract class GUI_Base_Tile_Entity extends GuiContainer {
+
+ public final Container mContainer;
+
+ public GUI_Base_Tile_Entity(Container aContainer) {
+ super(aContainer);
+ mContainer = aContainer;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_SuperJukebox.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_SuperJukebox.java
index adaf8469ad..d3d8f1e814 100644
--- a/src/Java/gtPlusPlus/core/gui/machine/GUI_SuperJukebox.java
+++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_SuperJukebox.java
@@ -1,44 +1,90 @@
package gtPlusPlus.core.gui.machine;
+import java.util.ArrayList;
+import java.util.List;
+
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-
+import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox;
+import gtPlusPlus.core.container.Container_SuperJukebox;
+import gtPlusPlus.core.gui.GUI_Base_Tile_Entity;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.slots.SlotNoInput;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
-import gtPlusPlus.core.container.Container_CircuitProgrammer;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer;
@SideOnly(Side.CLIENT)
-public class GUI_SuperJukebox extends GuiContainer {
+public class GUI_SuperJukebox extends GUI_Base_Tile_Entity {
- private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/CircuitProgrammer.png");
+ private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/SuperJukebox.png");
+ private final Container_SuperJukebox mThisContainer;
+
+ public GUI_SuperJukebox(final InventoryPlayer player_inventory, final TileEntitySuperJukebox te){
+ super(new Container_SuperJukebox(player_inventory, te));
+ mThisContainer = (Container_SuperJukebox) this.mContainer;
+ }
- public GUI_SuperJukebox(final InventoryPlayer player_inventory, final TileEntityCircuitProgrammer te){
- super(new Container_CircuitProgrammer(player_inventory, te));
+ //This method is called when the Gui is first called!
+ @Override
+ public void initGui(){
+ super.initGui();
}
@Override
- protected void drawGuiContainerForegroundLayer(final int i, final int j){
- super.drawGuiContainerForegroundLayer(i, j);
+ protected void drawGuiContainerForegroundLayer(final int par1, final int par2) {
+ super.drawGuiContainerForegroundLayer(par1, par2);
+
+ boolean a = mThisContainer.isPlaying;
+ boolean b = mThisContainer.isLooping;
+
+ if (a && b) {
+ this.fontRendererObj.drawString("[X] [X]", 72, 74, 4210752);
+ }
+ else if (a && !b) {
+ this.fontRendererObj.drawString("[X] [ ]", 72, 74, 4210752);
+ }
+ else if (!a && b) {
+ this.fontRendererObj.drawString("[ ] [X]", 72, 74, 4210752);
+ }
+ else {
+ this.fontRendererObj.drawString("[ ] [ ]", 72, 74, 4210752);
+ }
+
+ this.drawTooltip(par1, par2);
+ }
+
+ private void drawTooltip(final int x2, final int y2) {
+ final int xStart = (this.width - this.xSize) / 2;
+ final int yStart = (this.height - this.ySize) / 2;
+ final int x3 = x2 - xStart;
+ final int y3 = y2 - yStart + 5;
+ final List<String> list = new ArrayList<String>();
+
+ if (y3 >= 17 && y3 <= 33) {
+ if (x3 >= 80 && x3 <= 96) {
+ list.add("Play");
+ }
+ }
+ if (y3 >= 35 && y3 <= 53) {
+ if (x3 >= 80 && x3 <= 96) {
+ list.add("Loop");
+ }
+ }
+ if (!list.isEmpty()) {
+ this.drawHoveringText(list, x3, y3, this.fontRendererObj);
+ }
}
@Override
- protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){
+ protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) {
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();
- }
-
+
} \ 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 2ae0987ece..8448b738a2 100644
--- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
@@ -10,6 +10,7 @@ import net.minecraft.world.World;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox;
import gtPlusPlus.core.container.*;
import gtPlusPlus.core.container.box.LunchBoxContainer;
import gtPlusPlus.core.container.box.MagicBagContainer;
@@ -51,6 +52,7 @@ public class GuiHandler implements IGuiHandler {
public static final int GUI11 = 10; // Auto Lunchbox
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 void init() {
@@ -95,6 +97,8 @@ 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) {
+ return new Container_SuperJukebox(player.inventory, (TileEntitySuperJukebox) te);
}
}
@@ -151,6 +155,8 @@ public class GuiHandler implements IGuiHandler {
return new GUI_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer) te);
} else if (ID == GUI13) {
return new GUI_DecayablesChest(player.inventory, (TileEntityDecayablesChest) te);
+ } else if (ID == GUI14) {
+ return new GUI_SuperJukebox(player.inventory, (TileEntitySuperJukebox) te);
}
}
diff --git a/src/Java/gtPlusPlus/core/inventories/Inventory_SuperJukebox.java b/src/Java/gtPlusPlus/core/inventories/Inventory_SuperJukebox.java
new file mode 100644
index 0000000000..681c67a988
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/inventories/Inventory_SuperJukebox.java
@@ -0,0 +1,172 @@
+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 Inventory_SuperJukebox implements IInventory{
+
+ private final String name = "Sir Mixalot";
+
+ /** Defining your inventory size this way is handy */
+ public static final int INV_SIZE = 21;
+
+ /** 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 1;
+ }
+
+ /**
+ * 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) {
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java
index 97da974967..c7d09b959d 100644
--- a/src/Java/gtPlusPlus/core/lib/CORE.java
+++ b/src/Java/gtPlusPlus/core/lib/CORE.java
@@ -203,6 +203,7 @@ public class CORE {
public static boolean disableIC2Recipes = false;
public static boolean enableAlternativeDivisionSigilRecipe = false;
public static int boilerSteamPerSecond = 750;
+ public static boolean requireControlCores = true;
//Feature Related
public static boolean enableCustomCapes = false;
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
index e2cfb3516e..16559c4fcf 100644
--- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
+++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
@@ -1545,17 +1545,17 @@ public class RECIPES_Machines {
CORE.RA.addSixSlotAssemblingRecipe(
new ItemStack[] {
- CI.machineHull_IV,
- aOutput[2],
- aMat_A[3].getGear(GTNH ? 4 : 2),
- aMat_B[5].getPlateDouble(GTNH ? 16 : 8),
- ItemUtils.getItemStack("miscutils:item.itemBufferCore"+(GTNH ? "4" : "3"), GTNH ? 4 : 2),
- ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(GTNH ? 4 : 3), GTNH ? 10 : 5)
+ CI.machineHull_HV,
+ aOutput[1],
+ aMat_A[1].getGear(GTNH ? 4 : 2),
+ aMat_B[2].getPlateDouble(GTNH ? 16 : 8),
+ ItemUtils.getItemStack("miscutils:item.itemBufferCore"+(GTNH ? "2" : "1"), GTNH ? 4 : 2),
+ ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(GTNH ? 3 : 2), GTNH ? 10 : 5)
},
- aMat_B[4].getFluid(144 * 16), //Input Fluid
+ aMat_B[3].getFluid(144 * 8), //Input Fluid
GregtechItemList.Hatch_Control_Core.get(1),
60 * 20 * 5,
- MaterialUtils.getVoltageForTier(4));
+ MaterialUtils.getVoltageForTier(3));
for (int i = 0; i < 10; i++) {
diff --git a/src/Java/gtPlusPlus/core/slots/SlotJukebox.java b/src/Java/gtPlusPlus/core/slots/SlotJukebox.java
new file mode 100644
index 0000000000..0f8af988a1
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/slots/SlotJukebox.java
@@ -0,0 +1,37 @@
+package gtPlusPlus.core.slots;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemRecord;
+import net.minecraft.item.ItemStack;
+
+public class SlotJukebox extends SlotGeneric {
+
+ private final boolean isDisplay;
+
+
+ public SlotJukebox(IInventory inventory, int x, int y, int z) {
+ this(inventory, x, y, z, false);
+ }
+
+ public SlotJukebox(IInventory inventory, int x, int y, int z, boolean display) {
+ super(inventory, x, y, z);
+ isDisplay = display;
+ }
+
+ @Override
+ public boolean isItemValid(ItemStack itemstack) {
+ return (itemstack != null && itemstack.getItem() instanceof ItemRecord);
+ }
+
+ @Override
+ public int getSlotStackLimit() {
+ return 1;
+ }
+
+ @Override
+ public boolean canTakeStack(EntityPlayer p_82869_1_) {
+ return !isDisplay;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java
index 63ea1ac783..c184b47d25 100644
--- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java
+++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java
@@ -31,10 +31,10 @@ public class TileEntityDecayablesChest extends TileEntity implements ISidedInven
public float prevLidAngle;
/** The number of players currently using this chest */
public int numPlayersUsing;
- private int cachedChestType;
private String customName;
+ private int cachedChestType;
private int tickCount = 0;
public TileEntityDecayablesChest() {
@@ -91,8 +91,9 @@ public class TileEntityDecayablesChest extends TileEntity implements ISidedInven
boolean a1, a2;
int u = 0;
a1 = b.getIsActive(world, iStack);
- a2 = b.tickItemTag(world, iStack);
- while (u < 19) {
+ a2 = false;
+ int SECONDS_TO_PROCESS = 1;
+ while (u < (20 * SECONDS_TO_PROCESS)) {
if (!a1) {
break;
}
@@ -100,7 +101,7 @@ public class TileEntityDecayablesChest extends TileEntity implements ISidedInven
a2 = b.tickItemTag(world, iStack);
u++;
}
- Logger.INFO("| "+b.getUnlocalizedName()+" | "+a1+"/"+a2);
+ Logger.MACHINE_INFO("| "+b.getUnlocalizedName()+" | "+a1+"/"+a2);
if (!a1 && !a2) {
ItemStack replacement = ItemUtils.getSimpleStack(b.getDecayResult());
@@ -352,63 +353,6 @@ public class TileEntityDecayablesChest extends TileEntity implements ISidedInven
ItemUtils.organiseInventory(getInventory());
cachedChestType = 0;
return cachedChestType;
-
-/* //Try merge stacks
- for (int i = 0; i < this.getSizeInventory(); i++) {
- for (int i2 = 0; i2 < this.getSizeInventory(); i2++) {
- if (i != i2) {
- ItemStack[] t1 = new ItemStack[] {this.getStackInSlot(i), this.getStackInSlot(i2)};
- if (t1[0] == null || t1[1] == null) {
- continue;
- }
- else if (!GT_Utility.areStacksEqual(t1[0], t1[1])) {
- continue;
- }
- //Try Merge
- else {
-
- if (GT_Utility.areStacksEqual(t1[0], t1[1])) {
- while ((t1[0].stackSize < 64 && t1[1].stackSize > 0)) {
- t1[0].stackSize++;
- t1[1].stackSize--;
- if (t1[1].stackSize <= 0) {
- t1[1] = null;
- break;
- }
- if (t1[0].stackSize == 64) {
- break;
- }
- }
- this.setInventorySlotContents(i, t1[1]);
- this.setInventorySlotContents(i2, t1[0]);
-
- }
- }
- }
- }
- }
-
- //Move nulls to end
- int count2 = 0;
- for (int i = 0; i < this.getSizeInventory(); i++)
- if (this.getStackInSlot(i) != null)
- this.setInventorySlotContents(count2++, this.getStackInSlot(i));
- while (count2 < this.getSizeInventory())
- this.setInventorySlotContents(count2++, null);
-
- //Sort by name
- int arraySlot = 0;
- HashMap<Integer, Pair<String, ItemStack>> aNameMap = new HashMap<Integer, Pair<String, ItemStack>>();
-
- for (ItemStack ggg : this.inventoryContents.getInventory()) {
- aNameMap.put(arraySlot++, new Pair<String, ItemStack>(ggg != null ? ggg.getDisplayName() : "", ggg));
- }
- arraySlot = 0;
- String[] aNameMapInternal = new String[aNameMap.size()];
- for (Pair pp : aNameMap.values()) {
- aNameMapInternal[arraySlot++] = pp.getKey().toString();
- }
- Arrays.sort(aNameMapInternal); */
}
diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java
index 4220d57de6..e7c37f7994 100644
--- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java
+++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java
@@ -80,16 +80,17 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
}
if ((waterCount >= 2) && (trapCount <= 4)) {
this.waterSides = waterCount;
+ Logger.MACHINE_INFO("Valid Trap. "+waterCount+" | "+(this.tickCount/20)+"/"+(this.baseTickRate/20));
return true;
}
else if ((waterCount >= 2) && (trapCount > 4)) {
- Logger.WARNING("Too many fish traps surrounding this one.");
- Logger.WARNING("Not adding Loot to the fishtrap at x[" + this.locationX + "] y[" + this.locationY
+ Logger.MACHINE_INFO("Too many fish traps surrounding this one.");
+ Logger.MACHINE_INFO("Not adding Loot to the fishtrap at x[" + this.locationX + "] y[" + this.locationY
+ "] z[" + this.locationZ + "] (Ticking for loot every " + this.baseTickRate + " ticks)");
}
}
}
- // Utils.LOG_WARNING("Error finding water");
+ // Utils.LOG_MACHINE_INFO("Error finding water");
return false;
}
@@ -103,13 +104,13 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
ItemUtils.organiseInventory(getInventory());
final ItemStack loot = this.generateLootForFishTrap().copy();
try {
- //Utils.LOG_WARNING("Trying to add "+loot.getDisplayName()+" | "+loot.getItemDamage());
+ //Utils.LOG_MACHINE_INFO("Trying to add "+loot.getDisplayName()+" | "+loot.getItemDamage());
for (final ItemStack contents : this.getInventory().getInventory()) {
if (GT_Utility.areStacksEqual(loot, contents)){
if (contents.stackSize < contents.getMaxStackSize()) {
- //Utils.LOG_WARNING("3-Trying to add one more "+loot.getDisplayName()+"meta: "+loot.getItemDamage()+" to an existing stack of "+contents.getDisplayName()+" with a size of "+contents.stackSize);
+ //Utils.LOG_MACHINE_INFO("3-Trying to add one more "+loot.getDisplayName()+"meta: "+loot.getItemDamage()+" to an existing stack of "+contents.getDisplayName()+" with a size of "+contents.stackSize);
contents.stackSize++;
this.markDirty();
return true;
@@ -120,7 +121,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
checkingSlot = 0;
for (final ItemStack contents : this.getInventory().getInventory()) {
if (contents == null) {
- //Utils.LOG_WARNING("Adding Item To Empty Slot. "+(checkingSlot+1));
+ //Utils.LOG_MACHINE_INFO("Adding Item To Empty Slot. "+(checkingSlot+1));
this.getInventory().setInventorySlotContents(checkingSlot, loot);
this.markDirty();
return true;
@@ -190,7 +191,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
loot = ItemUtils.getSimpleStack(Blocks.diamond_ore);
}
loot.stackSize=1;
- Logger.WARNING("Adding x"+loot.stackSize+" "+loot.getDisplayName()+".");
+ Logger.MACHINE_INFO("Adding x"+loot.stackSize+" "+loot.getDisplayName()+".");
return loot;
}
@@ -199,7 +200,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
try{
if (!this.worldObj.isRemote) {
this.tickCount++;
- // Utils.LOG_WARNING("Ticking "+this.tickCount);
+ //Logger.MACHINE_INFO("Ticking "+this.tickCount);
// Check if the Tile is within water once per second.
if ((this.tickCount % 20) == 0) {
this.isInWater = this.isSurroundedByWater();
@@ -210,16 +211,13 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
}
// Try add some loot once every 30 seconds.
- if ((this.tickCount % this.baseTickRate) == 0) {
+ if (this.tickCount >= this.baseTickRate) {
if (this.isInWater) {
// Add loot
- // Utils.LOG_WARNING("Adding Loot to the fishtrap at
- // x["+this.locationX+"] y["+this.locationY+"]
- // z["+this.locationZ+"] (Ticking for loot every
- // "+this.baseTickRate+" ticks)");
+ Logger.MACHINE_INFO("Adding Loot to the fishtrap at x["+this.locationX+"] y["+this.locationY+"] z["+this.locationZ+"] (Ticking for loot every "+this.baseTickRate+" ticks)");
int aExtraLootChance = MathUtils.randInt(1, 1000);
- if (aExtraLootChance == 1000) {
+ if (aExtraLootChance >= 999) {
this.tryAddLoot();
this.tryAddLoot();
this.tryAddLoot();
@@ -231,11 +229,13 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
this.markDirty();
}
else {
+ Logger.MACHINE_INFO("Not in water.");
this.markDirty();
}
this.tickCount = 0;
}
- if (this.tickCount > (this.baseTickRate + 500)) {
+ if (this.tickCount >= (this.baseTickRate + 500)) {
+ Logger.MACHINE_INFO("Resetting tick counter");
this.tickCount = 0;
}
@@ -246,7 +246,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
public void calculateTickrate() {
int water = this.waterSides;
- int variance = (int) ((MathUtils.randInt(200, 2000)/water)*0.5);
+ //int variance = (int) ((MathUtils.randInt(-200, 200)/water)*0.5);
if (water <= 1) {
this.baseTickRate = 0;
} else if (water == 2) {
@@ -261,7 +261,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
this.baseTickRate = 1750;
}
if (water > 1) {
- this.baseTickRate += variance;
+ //this.baseTickRate += variance;
}
}
@@ -279,7 +279,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
@Override
public void writeToNBT(final NBTTagCompound nbt) {
super.writeToNBT(nbt);
- // Utils.LOG_WARNING("Trying to write NBT data to TE.");
+ // Utils.LOG_MACHINE_INFO("Trying to write NBT data to TE.");
final NBTTagCompound chestData = new NBTTagCompound();
this.inventoryContents.writeToNBT(chestData);
nbt.setTag("ContentsChest", chestData);
@@ -291,7 +291,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
@Override
public void readFromNBT(final NBTTagCompound nbt) {
super.readFromNBT(nbt);
- // Utils.LOG_WARNING("Trying to read NBT data from TE.");
+ // Utils.LOG_MACHINE_INFO("Trying to read NBT data from TE.");
this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest"));
if (nbt.hasKey("CustomName", 8)) {
this.setCustomName(nbt.getString("CustomName"));
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java
index 486cda42f9..a5cf9527a9 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java
@@ -936,11 +936,22 @@ public class ItemUtils {
for (int o = 0; o < aInputInventory.getSizeInventory(); o++) {
p[o] = aInputInventory.getStackInSlot(o);
}
- ItemStack[] g = organiseInventory(p);
- IInventory aTemp = aInputInventory;
+ //ItemStack[] g = organiseInventory(p);
+
+ IInventory aTemp = aInputInventory;
+ for (int i = 0; i < p.length; ++i) {
+ for (int j = i + 1; j < p.length; ++j) {
+ if (p[j] != null && (p[i] == null
+ || GT_Utility.areStacksEqual(p[i], p[j]))) {
+ GT_Utility.moveStackFromSlotAToSlotB(aTemp, aTemp, j, i, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+ }
+ }
+ }
+
+ /*
for (int o = 0; o < aInputInventory.getSizeInventory(); o++) {
aTemp.setInventorySlotContents(o, g[o]);
- }
+ }*/
return aTemp;
}
diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java
index 39cd8c248e..85300c043c 100644
--- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java
+++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_MetaPipeEntity.java
@@ -1,8 +1,14 @@
package gtPlusPlus.preloader.asm.transformers;
-import static org.objectweb.asm.Opcodes.*;
+import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static org.objectweb.asm.Opcodes.ALOAD;
+import static org.objectweb.asm.Opcodes.ARETURN;
+import static org.objectweb.asm.Opcodes.ASM5;
+import static org.objectweb.asm.Opcodes.GETFIELD;
+import static org.objectweb.asm.Opcodes.ILOAD;
+import static org.objectweb.asm.Opcodes.INVOKESTATIC;
+import static org.objectweb.asm.Opcodes.IRETURN;
-import java.io.IOException;
import org.apache.logging.log4j.Level;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
@@ -13,12 +19,7 @@ import org.objectweb.asm.MethodVisitor;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
-import gregtech.api.enums.SubTag;
import gregtech.api.metatileentity.BaseMetaPipeEntity;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.preloader.DevHelper;
-import gtPlusPlus.preloader.asm.AsmConfig;
import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@@ -110,21 +111,23 @@ public class ClassTransformer_GT_BlockMachines_MetaPipeEntity {
* 15 = BaseMetaTileEntity, Wrench lvl 3 to dismantle
*/
public static TileEntity createTileEntity(World aWorld, int aMeta) {
- Logger.INFO("Creating Tile Entity with Meta of "+aMeta);
+ //Logger.INFO("Creating Tile Entity with Meta of "+aMeta);
if (aMeta < 4) {
return GregTech_API.constructBaseMetaTileEntity();
} else if (aMeta < 12) {
return new BaseMetaPipeEntity();
- } else {
- return Meta_GT_Proxy.constructCustomGregtechMetaTileEntityByMeta(aMeta);
+ } else {
+ //Because Wooden pipes/frames may exist in world, we try cast to the GT++ tile first, if tht fails, we cast a pipe..
+ try {
+ return Meta_GT_Proxy.constructCustomGregtechMetaTileEntityByMeta(aMeta);
+ }
+ catch (ClassCastException c) {
+ //Returns a pipe entity, once this returns, it should correct itself and no longer error in future.
+ return new BaseMetaPipeEntity();
+ }
}
}
-
-
- String aEntityPlayer;
- String aEntityPlayerMP;
- String aWorld;
int mMode;
public ClassTransformer_GT_BlockMachines_MetaPipeEntity(byte[] basicClass, boolean obfuscated, int aMode) {
@@ -136,7 +139,7 @@ public class ClassTransformer_GT_BlockMachines_MetaPipeEntity {
aTempReader = new ClassReader(basicClass);
aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES);
- aTempReader.accept(new localClassVisitor(aTempWriter), 0);
+ aTempReader.accept(new localClassVisitor(aTempWriter, mMode), 0);
if (aTempReader != null && aTempWriter != null) {
isValid = true;
@@ -149,11 +152,7 @@ public class ClassTransformer_GT_BlockMachines_MetaPipeEntity {
writer = aTempWriter;
- if (reader != null && writer != null) {
- aEntityPlayer = obfuscated ? DevHelper.getObfuscated("net/minecraft/entity/player/EntityPlayer") : "net/minecraft/entity/player/EntityPlayer";
- aEntityPlayerMP = obfuscated ? DevHelper.getObfuscated("net/minecraft/entity/player/EntityPlayerMP") : "net/minecraft/entity/player/EntityPlayerMP";
- aWorld = obfuscated ? DevHelper.getObfuscated("net/minecraft/world/World") : "net/minecraft/world/World";
-
+ if (reader != null && writer != null) {
FMLRelaunchLog.log("[GT++ ASM] Gregtech getTileEntityBaseType Patch", Level.INFO, "Attempting Method Injection.");
if (aMode == 0) {
injectMethod("getHarvestTool");
@@ -243,16 +242,19 @@ public class ClassTransformer_GT_BlockMachines_MetaPipeEntity {
return didInject;
}
- public static final class localClassVisitor extends ClassVisitor {
+ public final class localClassVisitor extends ClassVisitor {
- public localClassVisitor(ClassVisitor cv) {
+ private final int mMode;
+
+ public localClassVisitor(ClassVisitor cv, int aMode) {
super(ASM5, cv);
+ mMode = aMode;
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
MethodVisitor methodVisitor;
- if (name.equals("getHarvestTool") || name.equals("createTileEntity") || name.equals("getTileEntityBaseType")) {
+ if ((mMode == 0 && (name.equals("createTileEntity") || name.equals("getHarvestTool"))) || (mMode > 0 && name.equals("getTileEntityBaseType"))) {
FMLRelaunchLog.log("[GT++ ASM] Gregtech getTileEntityBaseType Patch", Level.INFO, "Found method "+name+", removing.");
methodVisitor = null;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index 41ba313b0e..39666a2d3b 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -1,5 +1,6 @@
package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base;
+import static gtPlusPlus.core.lib.CORE.ConfigSwitches.requireControlCores;
import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
import java.lang.reflect.InvocationTargetException;
@@ -198,7 +199,7 @@ GT_MetaTileEntity_MultiBlockBase {
}
}
- int tTier = this.getControlCoreTier();
+ int tTier = requireControlCores ? this.getControlCoreTier() : -1;
mInfo.add(getMachineTooltip());
@@ -502,7 +503,7 @@ GT_MetaTileEntity_MultiBlockBase {
int aControlCoreTier = getControlCoreTier();
//If no core, return false;
- if (aControlCoreTier == 0) {
+ if (aControlCoreTier == 0 && requireControlCores) {
log("No control core found.");
return false;
}
@@ -519,7 +520,7 @@ GT_MetaTileEntity_MultiBlockBase {
log("Running checkRecipeGeneric(0)");
//Check to see if Voltage Tier > Control Core Tier
- if (tTier > aControlCoreTier) {
+ if (tTier > aControlCoreTier && requireControlCores) {
log("Control core found is lower tier than power tier.");
return false;
}
@@ -586,7 +587,7 @@ GT_MetaTileEntity_MultiBlockBase {
//Only Overclock as high as the control circuit.
byte tTierOld = tTier;
- tTier = (byte) aControlCoreTier;
+ tTier = requireControlCores ? (byte) aControlCoreTier : tTierOld;
// Overclock
if (this.mEUt <= 16) {
@@ -888,7 +889,14 @@ GT_MetaTileEntity_MultiBlockBase {
return false;
}
- public int getControlCoreTier() {
+ public int getControlCoreTier() {
+
+ //Always return best tier if config is off.
+ boolean aCoresConfig = gtPlusPlus.core.lib.CORE.ConfigSwitches.requireControlCores;
+ if (!aCoresConfig) {
+ return 10;
+ }
+
if (mControlCoreBus.isEmpty()) {
log("No Control Core Modules Found.");
return 0;
@@ -1499,7 +1507,10 @@ GT_MetaTileEntity_MultiBlockBase {
public final boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
boolean aStructureCheck = checkMultiblock(aBaseMetaTileEntity, aStack);
- boolean aHasCore = this.getControlCoreBus() != null;
+
+ boolean aCoresConfig = gtPlusPlus.core.lib.CORE.ConfigSwitches.requireControlCores;
+
+ boolean aHasCore = (aCoresConfig ? (this.getControlCoreBus() != null) : true);
return aStructureCheck && aHasCore;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
index 17e6430f99..f88065d9a9 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
@@ -21,6 +21,7 @@ import gregtech.api.util.Recipe_GT;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.FluidUtils;
@@ -516,7 +517,7 @@ public class GregtechMetaTileEntity_IndustrialFishingPond extends GregtechMeta_M
int aControlCoreTier = getControlCoreTier();
//If no core, return false;
- if (aControlCoreTier == 0) {
+ if (aControlCoreTier == 0 && CORE.ConfigSwitches.requireControlCores) {
log("Invalid/No Control Core");
return false;
}
@@ -533,7 +534,7 @@ public class GregtechMetaTileEntity_IndustrialFishingPond extends GregtechMeta_M
log("Running checkRecipeGeneric(0)");
//Check to see if Voltage Tier > Control Core Tier
- if (tTier > aControlCoreTier) {
+ if (tTier > aControlCoreTier && CORE.ConfigSwitches.requireControlCores) {
return false;
}
@@ -548,7 +549,7 @@ public class GregtechMetaTileEntity_IndustrialFishingPond extends GregtechMeta_M
ItemStack[] mFishOutput = generateLoot(this.mMode);
mFishOutput = removeNulls(mFishOutput);
- GT_Recipe g = new Recipe_GT(true, new ItemStack[] {}, mFishOutput, null, new int[] {}, aFluidInputs, mOutputFluids, 100, 8, 0);
+ GT_Recipe g = new Recipe_GT(true, new ItemStack[] {}, mFishOutput, null, new int[] {}, aFluidInputs, mOutputFluids, 100, 16, 0);
if (!this.canBufferOutputs(g, aMaxParallelRecipes)) {
log("No Space");
return false;
@@ -606,7 +607,7 @@ public class GregtechMetaTileEntity_IndustrialFishingPond extends GregtechMeta_M
//Only Overclock as high as the control circuit.
byte tTierOld = tTier;
- tTier = (byte) aControlCoreTier;
+ tTier = CORE.ConfigSwitches.requireControlCores ? (byte) aControlCoreTier : tTierOld;
// Overclock
if (this.mEUt <= 16) {
diff --git a/src/resources/assets/miscutils/textures/gui/SuperJukebox.png b/src/resources/assets/miscutils/textures/gui/SuperJukebox.png
new file mode 100644
index 0000000000..c50c0da4a5
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/gui/SuperJukebox.png
Binary files differ