aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/block
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core/block')
-rw-r--r--src/Java/gtPlusPlus/core/block/ModBlocks.java56
-rw-r--r--src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java38
-rw-r--r--src/Java/gtPlusPlus/core/block/base/BasicBlock.java80
-rw-r--r--src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java196
-rw-r--r--src/Java/gtPlusPlus/core/block/base/MetaBlock.java36
-rw-r--r--src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java47
-rw-r--r--src/Java/gtPlusPlus/core/block/general/LightGlass.java152
-rw-r--r--src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java488
-rw-r--r--src/Java/gtPlusPlus/core/block/general/fluids/BlockFluidJackDaniels.java78
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java35
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/Machine_Charger.java131
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/Machine_NHG.java131
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/Machine_WireiusDeletus.java3
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java133
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java94
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/heliumgen/block/HeliumGenerator.java279
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java69
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java111
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/heliumgen/slots/InvSlotRadiation.java88
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java854
20 files changed, 1588 insertions, 1511 deletions
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java
index 69ecb9ed5b..3b6f061ca7 100644
--- a/src/Java/gtPlusPlus/core/block/ModBlocks.java
+++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java
@@ -1,60 +1,60 @@
package gtPlusPlus.core.block;
-import cpw.mods.fml.common.registry.GameRegistry;
import gtPlusPlus.core.block.general.LightGlass;
import gtPlusPlus.core.block.machine.Machine_Workbench;
import gtPlusPlus.core.block.machine.Machine_WorkbenchAdvanced;
import gtPlusPlus.core.fluids.FluidRegistryHandler;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks2;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.fluids.Fluid;
+import cpw.mods.fml.common.registry.GameRegistry;
public final class ModBlocks {
- public static Block blockWorkbench;
- public static Block blockWorkbenchAdvanced;
- // Blocks
- // public static Block blockBloodSteel;
- // public static Block blockStaballoy;
+ public static Block blockWorkbench;
+ public static Block blockWorkbenchAdvanced;
+ //Blocks
+ //public static Block blockBloodSteel;
+ //public static Block blockStaballoy;
// WIP TODO public static Block blockToolBuilder;
- public static Block blockGriefSaver;
- public static Block blockCasingsMisc;
- public static Block blockMetaTileEntity;
- public static Block blockHeliumGenerator;
- public static Block blockNHG;
- public static Block blockCharger;
+ public static Block blockGriefSaver;
+ public static Block blockCasingsMisc;
+ public static Block blockMetaTileEntity;
+ public static Block blockHeliumGenerator;
+ public static Block blockNHG;
+ public static Block blockCharger;
+
+ public static Block MatterFabricatorEffectBlock;
+
+ public static Fluid fluidJackDaniels = new Fluid("fluidJackDaniels");
+ public static Block blockFluidJackDaniels;
+ public static Block blockCasings2Misc;
- public static Block MatterFabricatorEffectBlock;
- public static Fluid fluidJackDaniels = new Fluid("fluidJackDaniels");
- public static Block blockFluidJackDaniels;
- public static Block blockCasings2Misc;
public static void init() {
Utils.LOG_INFO("Initializing Blocks.");
- // blockGriefSaver = new
- // TowerDevice().setBlockName("blockGriefSaver").setCreativeTab(AddToCreativeTab.tabBlock).setBlockTextureName("blockDefault");
+ //blockGriefSaver = new TowerDevice().setBlockName("blockGriefSaver").setCreativeTab(AddToCreativeTab.tabBlock).setBlockTextureName("blockDefault");
- ModBlocks.registerBlocks();
+ registerBlocks();
}
- public static void registerBlocks() {
+ public static void registerBlocks(){
Utils.LOG_INFO("Registering Blocks.");
- GameRegistry.registerBlock(
- ModBlocks.MatterFabricatorEffectBlock = new LightGlass(Material.glass, false).setHardness(0.1F)
- .setBlockTextureName(CORE.MODID + ":" + "blockMFEffect").setStepSound(Block.soundTypeGlass),
- "blockMFEffect");
+ GameRegistry.registerBlock(MatterFabricatorEffectBlock = new LightGlass(Material.glass, false).setHardness(0.1F).setBlockTextureName(CORE.MODID + ":" + "blockMFEffect").setStepSound(Block.soundTypeGlass), "blockMFEffect");
- // Fluids
+ //Fluids
FluidRegistryHandler.registerFluids();
- // Workbench
- ModBlocks.blockWorkbench = new Machine_Workbench().setHardness(1.5F);
- ModBlocks.blockWorkbenchAdvanced = new Machine_WorkbenchAdvanced().setHardness(2.5F);
+ //Workbench
+ blockWorkbench = new Machine_Workbench().setHardness(1.5F);
+ blockWorkbenchAdvanced = new Machine_WorkbenchAdvanced().setHardness(2.5F);
+
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java b/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java
index 0160da883f..b7ac24a71b 100644
--- a/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java
+++ b/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java
@@ -9,25 +9,23 @@ import net.minecraft.world.World;
public class AdvancedBlock extends Block {
- protected AdvancedBlock(final String unlocalizedName, final Material material, final CreativeTabs x,
- final float blockHardness, final float blockResistance, final float blockLightLevel,
- final String blockHarvestTool, final int blockHarvestLevel, final SoundType BlockSound) {
- super(material);
- this.setBlockName(unlocalizedName);
- this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName);
- this.setCreativeTab(x);
- this.setHardness(blockHardness); // block Hardness
- this.setResistance(blockResistance);
- this.setLightLevel(blockLightLevel);
- this.setHarvestLevel(blockHarvestTool, blockHarvestLevel);
- this.setStepSound(BlockSound);
- }
-
- @Override
- public boolean onBlockActivated(final World p_149727_1_, final int p_149727_2_, final int p_149727_3_,
- final int p_149727_4_, final EntityPlayer p_149727_5_, final int p_149727_6_, final float p_149727_7_,
- final float p_149727_8_, final float p_149727_9_) {
- return false;
- }
+ protected AdvancedBlock(String unlocalizedName, Material material, CreativeTabs x, float blockHardness, float blockResistance, float blockLightLevel,
+ String blockHarvestTool, int blockHarvestLevel, SoundType BlockSound) {
+ super(material);
+ this.setBlockName(unlocalizedName);
+ this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setCreativeTab(x);
+ this.setHardness(blockHardness); //block Hardness
+ this.setResistance(blockResistance);
+ this.setLightLevel(blockLightLevel);
+ this.setHarvestLevel(blockHarvestTool, blockHarvestLevel);
+ this.setStepSound(BlockSound);
+ }
+
+ @Override
+ public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
+ {
+ return false;
+ }
}
diff --git a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java
index 64ee68224e..c95f37d9c5 100644
--- a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java
+++ b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java
@@ -8,43 +8,45 @@ import net.minecraft.block.material.Material;
public class BasicBlock extends Block {
- public static enum BlockTypes {
- STANDARD("blockBlock", "pickaxe", Block.soundTypeStone), FRAME("blockFrameGt", "wrench", Block.soundTypeMetal);
-
- private String TEXTURE_NAME;
- private String HARVEST_TOOL;
- private SoundType soundOfBlock;
-
- private BlockTypes(final String textureName, final String harvestTool, final SoundType blockSound) {
- this.TEXTURE_NAME = textureName;
- this.HARVEST_TOOL = harvestTool;
- this.soundOfBlock = blockSound;
- }
-
- public SoundType getBlockSoundType() {
- return this.soundOfBlock;
- }
-
- public String getHarvestTool() {
- return this.HARVEST_TOOL;
- }
-
- public String getTexture() {
- return this.TEXTURE_NAME;
- }
-
- }
-
- public BasicBlock(final String unlocalizedName, final Material material) {
- super(material);
- this.setBlockName(Utils.sanitizeString(unlocalizedName));
- this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName);
- this.setCreativeTab(AddToCreativeTab.tabBlock);
- this.setHardness(2.0F);
- this.setResistance(6.0F);
- this.setLightLevel(0.0F);
- this.setHarvestLevel("pickaxe", 2);
- this.setStepSound(Block.soundTypeMetal);
- }
-
+ public BasicBlock(final String unlocalizedName, final Material material) {
+ super(material);
+ this.setBlockName(Utils.sanitizeString(unlocalizedName));
+ this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setCreativeTab(AddToCreativeTab.tabBlock);
+ this.setHardness(2.0F);
+ this.setResistance(6.0F);
+ this.setLightLevel(0.0F);
+ this.setHarvestLevel("pickaxe", 2);
+ this.setStepSound(soundTypeMetal);
+ }
+
+
+ public static enum BlockTypes {
+ STANDARD("blockBlock", "pickaxe", soundTypeStone),
+ FRAME("blockFrameGt", "wrench", soundTypeMetal);
+
+ private String TEXTURE_NAME;
+ private String HARVEST_TOOL;
+ private SoundType soundOfBlock;
+ private BlockTypes (final String textureName, final String harvestTool, final SoundType blockSound)
+ {
+ this.TEXTURE_NAME = textureName;
+ this.HARVEST_TOOL = harvestTool;
+ this.soundOfBlock = blockSound;
+ }
+
+ public String getTexture() {
+ return TEXTURE_NAME;
+ }
+
+ public String getHarvestTool(){
+ return HARVEST_TOOL;
+ }
+
+ public SoundType getBlockSoundType(){
+ return soundOfBlock;
+ }
+
+ }
+
}
diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java
index f389f5bf32..a2d2589f5e 100644
--- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java
+++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java
@@ -1,9 +1,5 @@
package gtPlusPlus.core.block.base;
-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.core.item.base.itemblock.ItemBlockGtBlock;
import gtPlusPlus.core.item.base.itemblock.ItemBlockGtFrameBox;
import gtPlusPlus.core.lib.CORE;
@@ -12,142 +8,142 @@ import gtPlusPlus.core.util.math.MathUtils;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.world.IBlockAccess;
+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;
-public class BlockBaseModular extends BasicBlock {
+public class BlockBaseModular extends BasicBlock{
- protected int blockColour;
- protected BlockTypes thisBlock;
- protected String thisBlockMaterial;
- protected final String thisBlockType;
+ protected int blockColour;
+ protected BlockTypes thisBlock;
+ protected String thisBlockMaterial;
+ protected final String thisBlockType;
- public BlockBaseModular(final String unlocalizedName, final String blockMaterial, final BlockTypes blockType,
- final int colour) {
- super(blockType.getTexture() + unlocalizedName, Material.iron);
+ public BlockBaseModular(String unlocalizedName, String blockMaterial, BlockTypes blockType, int colour) {
+ super(blockType.getTexture()+unlocalizedName, Material.iron);
this.setHarvestLevel(blockType.getHarvestTool(), 2);
- this.setBlockTextureName(CORE.MODID + ":" + blockType.getTexture());
+ this.setBlockTextureName(CORE.MODID+":"+blockType.getTexture());
this.blockColour = colour;
this.thisBlock = blockType;
this.thisBlockMaterial = blockMaterial;
this.thisBlockType = blockType.name().toUpperCase();
- this.setBlockName(this.GetProperName());
-
- if (!CORE.DEBUG) {
- // Utils.LOG_INFO("=============Block Info Dump=============");
- // Utils.LOG_INFO("thisBlock.name().toLowerCase() -
- // "+thisBlock.name().toLowerCase());
- // Utils.LOG_INFO("This Blocks Type - "+thisBlockType);
- // Utils.LOG_INFO("BlockTypes.STANDARD.name().toLowerCase() -
- // "+BlockTypes.STANDARD.name().toLowerCase());
- // Utils.LOG_INFO("BlockTypes.FRAME.name().toLowerCase() -
- // "+BlockTypes.FRAME.name().toLowerCase());
- // Utils.LOG_INFO("blockMaterial - "+blockMaterial);
- // Utils.LOG_INFO("==========================================");
+ this.setBlockName(GetProperName());
+
+ if (!CORE.DEBUG){
+ //Utils.LOG_INFO("=============Block Info Dump=============");
+ //Utils.LOG_INFO("thisBlock.name().toLowerCase() - "+thisBlock.name().toLowerCase());
+ //Utils.LOG_INFO("This Blocks Type - "+thisBlockType);
+ //Utils.LOG_INFO("BlockTypes.STANDARD.name().toLowerCase() - "+BlockTypes.STANDARD.name().toLowerCase());
+ //Utils.LOG_INFO("BlockTypes.FRAME.name().toLowerCase() - "+BlockTypes.FRAME.name().toLowerCase());
+ //Utils.LOG_INFO("blockMaterial - "+blockMaterial);
+ //Utils.LOG_INFO("==========================================");
}
-
- if (this.thisBlockType == BlockTypes.STANDARD.name().toUpperCase()) {
- LanguageRegistry.addName(this, "Block of " + blockMaterial);
- // Utils.LOG_INFO("Registered Block in Language Registry as:
- // "+"Block of "+blockMaterial);
+
+ if (thisBlockType == BlockTypes.STANDARD.name().toUpperCase()){
+ LanguageRegistry.addName(this, "Block of "+blockMaterial);
+ //Utils.LOG_INFO("Registered Block in Language Registry as: "+"Block of "+blockMaterial);
}
- else if (this.thisBlockType == BlockTypes.FRAME.name().toUpperCase()) {
- LanguageRegistry.addName(this, blockMaterial + " Frame Box");
- // Utils.LOG_INFO("Registered Block in Language Registry as:
- // "+blockMaterial+ " Frame Box");
+ else if (thisBlockType == BlockTypes.FRAME.name().toUpperCase()){
+ LanguageRegistry.addName(this, blockMaterial+ " Frame Box");
+ //Utils.LOG_INFO("Registered Block in Language Registry as: "+blockMaterial+ " Frame Box");
}
else {
LanguageRegistry.addName(this, blockMaterial);
- // Utils.LOG_INFO("Registered Block in Language Registry as:
- // "+blockMaterial);
- }
-
- // setOreDict(unlocalizedName, blockType);
- if (this.thisBlockType == BlockTypes.STANDARD.name().toUpperCase()) {
- GameRegistry.registerBlock(this, ItemBlockGtBlock.class,
- Utils.sanitizeString(blockType.getTexture() + unlocalizedName));
- // Utils.LOG_INFO("Registered Block in Block Registry as: "+"Block
- // of "+blockMaterial);
+ //Utils.LOG_INFO("Registered Block in Language Registry as: "+blockMaterial);
+ }
+
+ //setOreDict(unlocalizedName, blockType);
+ if (thisBlockType == BlockTypes.STANDARD.name().toUpperCase()){
+ GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName));
+ //Utils.LOG_INFO("Registered Block in Block Registry as: "+"Block of "+blockMaterial);
}
- else if (this.thisBlockType == BlockTypes.FRAME.name().toUpperCase()) {
- GameRegistry.registerBlock(this, ItemBlockGtFrameBox.class,
- Utils.sanitizeString(blockType.getTexture() + unlocalizedName));
- // Utils.LOG_INFO("Registered Block in Block Registry as:
- // "+blockMaterial+" Frame Box");
+ else if (thisBlockType == BlockTypes.FRAME.name().toUpperCase()){
+ GameRegistry.registerBlock(this, ItemBlockGtFrameBox.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName));
+ //Utils.LOG_INFO("Registered Block in Block Registry as: "+blockMaterial+" Frame Box");
}
else {
- GameRegistry.registerBlock(this, ItemBlockGtBlock.class,
- Utils.sanitizeString(blockType.getTexture() + unlocalizedName));
- // Utils.LOG_INFO("Registered Block in Block Registry as:
- // "+blockMaterial);
+ GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName));
+ //Utils.LOG_INFO("Registered Block in Block Registry as: "+blockMaterial);
}
-
+
+
}
+ /**
+ * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
+ */
@Override
- public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) {
-
- if (this.blockColour == 0) {
- return MathUtils.generateSingularRandomHexValue();
+ @SideOnly(Side.CLIENT)
+ public int getRenderBlockPass()
+ {
+ if (thisBlock == BlockTypes.FRAME){
+ return 1;
}
-
- return this.blockColour;
+ return 0;
}
+
+ /*@Override
+ public String getLocalizedName() {
+ String tempIngot;
+ if (thisBlock == BlockTypes.STANDARD){
+ tempIngot = "Block of "+thisBlockMaterial;
+ }
+ else if (thisBlock == BlockTypes.FRAME){
+ tempIngot = thisBlockMaterial + " Frame Box";
+ }
+ else {
- /*
- * @Override public String getLocalizedName() { String tempIngot; if
- * (thisBlock == BlockTypes.STANDARD){ tempIngot = "Block of "
- * +thisBlockMaterial; } else if (thisBlock == BlockTypes.FRAME){ tempIngot
- * = thisBlockMaterial + " Frame Box"; } else {
- *
- * tempIngot = getUnlocalizedName().replace("tile.blockGt", "ingot"); }
- * return tempIngot; }
- */
-
+ tempIngot = getUnlocalizedName().replace("tile.blockGt", "ingot");
+ }
+ return tempIngot;
+ }*/
+
public String GetProperName() {
- String tempIngot;
- if (this.thisBlock == BlockTypes.STANDARD) {
- tempIngot = "Block of " + this.thisBlockMaterial;
+ String tempIngot;
+ if (thisBlock == BlockTypes.STANDARD){
+ tempIngot = "Block of "+thisBlockMaterial;
}
- else if (this.thisBlock == BlockTypes.FRAME) {
- tempIngot = this.thisBlockMaterial + " Frame Box";
+ else if (thisBlock == BlockTypes.FRAME){
+ tempIngot = thisBlockMaterial + " Frame Box";
}
else {
- tempIngot = this.getUnlocalizedName().replace("tile.blockGt", "ingot");
+ tempIngot = getUnlocalizedName().replace("tile.blockGt", "ingot");
}
return tempIngot;
}
- /**
- * Returns which pass should this block be rendered on. 0 for solids and 1
- * for alpha
- */
+ @Override
+ public boolean isOpaqueCube()
+ {
+ return false;
+ }
+
@Override
@SideOnly(Side.CLIENT)
- public int getRenderBlockPass() {
- if (this.thisBlock == BlockTypes.FRAME) {
- return 1;
- }
- return 0;
+ public void registerBlockIcons(IIconRegister iIcon)
+ {
+ this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + thisBlock.getTexture());
}
@Override
- public int getRenderColor(final int aMeta) {
- if (this.blockColour == 0) {
+ public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4){
+
+ if (this.blockColour == 0){
return MathUtils.generateSingularRandomHexValue();
}
-
+
return this.blockColour;
}
-
- @Override
- public boolean isOpaqueCube() {
- return false;
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public void registerBlockIcons(final IIconRegister iIcon) {
- this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + this.thisBlock.getTexture());
- }
+
+ @Override
+ public int getRenderColor(int aMeta) {
+ if (this.blockColour == 0){
+ return MathUtils.generateSingularRandomHexValue();
+ }
+
+ return this.blockColour;
+ }
}
diff --git a/src/Java/gtPlusPlus/core/block/base/MetaBlock.java b/src/Java/gtPlusPlus/core/block/base/MetaBlock.java
index 3763b71448..4009c36726 100644
--- a/src/Java/gtPlusPlus/core/block/base/MetaBlock.java
+++ b/src/Java/gtPlusPlus/core/block/base/MetaBlock.java
@@ -7,22 +7,22 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-public class MetaBlock extends MultiTextureBlock {
+public class MetaBlock extends MultiTextureBlock {
- protected MetaBlock(final String unlocalizedName, final Material material, final SoundType soundType) {
- super(unlocalizedName, material, soundType);
- }
-
- @Override
- public int damageDropped(final int meta) {
- return meta;
- }
-
- @Override
- public void getSubBlocks(final Item item, final CreativeTabs tab, final List list) {
- for (int i = 0; i < 6; i++) {
- list.add(new ItemStack(item, 1, i));
- }
- }
-
-} \ No newline at end of file
+ protected MetaBlock(String unlocalizedName, Material material, SoundType soundType) {
+ super(unlocalizedName, material, soundType);
+ }
+
+ @Override
+ public int damageDropped(int meta) {
+ return meta;
+ }
+
+ @Override
+ public void getSubBlocks(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 6; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java b/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java
index 9953dfa991..4f022bae6d 100644
--- a/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java
+++ b/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java
@@ -7,29 +7,30 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
-public class MultiTextureBlock extends Block {
+public class MultiTextureBlock extends Block {
public IIcon[] icons = new IIcon[6];
-
- protected MultiTextureBlock(final String unlocalizedName, final Material material, final SoundType blockSound) {
- super(material);
- this.setBlockName(unlocalizedName);
- this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName);
- this.setCreativeTab(AddToCreativeTab.tabBlock);
- this.setHardness(2.0F);
- this.setResistance(6.0F);
- this.setStepSound(blockSound);
- }
-
- @Override
- public IIcon getIcon(final int side, final int meta) {
- return this.icons[side];
- }
-
- @Override
- public void registerBlockIcons(final IIconRegister reg) {
- for (int i = 0; i < 6; i++) {
- this.icons[i] = reg.registerIcon(this.textureName + "_" + i);
- }
- }
+
+ protected MultiTextureBlock(String unlocalizedName, Material material, SoundType blockSound)
+ {
+ super(material);
+ this.setBlockName(unlocalizedName);
+ this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setCreativeTab(AddToCreativeTab.tabBlock);
+ this.setHardness(2.0F);
+ this.setResistance(6.0F);
+ this.setStepSound(blockSound);
+ }
+
+ @Override
+ public void registerBlockIcons(IIconRegister reg) {
+ for (int i = 0; i < 6; i ++) {
+ this.icons[i] = reg.registerIcon(this.textureName + "_" + i);
+ }
+ }
+
+ @Override
+ public IIcon getIcon(int side, int meta) {
+ return this.icons[side];
+ }
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/block/general/LightGlass.java b/src/Java/gtPlusPlus/core/block/general/LightGlass.java
index 9b4d8bf1b8..5aa9f5b818 100644
--- a/src/Java/gtPlusPlus/core/block/general/LightGlass.java
+++ b/src/Java/gtPlusPlus/core/block/general/LightGlass.java
@@ -1,27 +1,30 @@
package gtPlusPlus.core.block.general;
-import java.util.Random;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
+
+import java.util.Random;
+
import net.minecraft.block.BlockBreakable;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
-public class LightGlass extends BlockBreakable {
- private int state = 0;
- private final int a = 255;
- private int r = 255;
- private int g = 0;
- private int b = 0;
- private int hex;
+public class LightGlass extends BlockBreakable
+{
+ private int state = 0;
+ private int a = 255;
+ private int r = 255;
+ private int g = 0;
+ private int b = 0;
+ private int hex;
- public LightGlass(final Material mat, final boolean bool) {
+ public LightGlass(Material mat, boolean bool)
+ {
super("blockMFEffect", mat, bool);
this.setCreativeTab(AddToCreativeTab.tabBlock);
this.setBlockName("blockMFEffect");
@@ -32,99 +35,94 @@ public class LightGlass extends BlockBreakable {
}
/**
- * Return true if a player with Silk Touch can harvest this block directly,
- * and not its normal drops.
+ * Returns the quantity of items to drop on block destruction.
*/
@Override
- protected boolean canSilkHarvest() {
- return false;
- }
-
- @Override
- // http://stackoverflow.com/questions/31784658/how-can-i-loop-through-all-rgb-combinations-in-rainbow-order-in-java
- public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) {
- if (this.state == 0) {
- this.g++;
- if (this.g == 255) {
- this.state = 1;
- }
- }
- if (this.state == 1) {
- this.r--;
- if (this.r == 0) {
- this.state = 2;
- }
- }
- if (this.state == 2) {
- this.b++;
- if (this.b == 255) {
- this.state = 3;
- }
- }
- if (this.state == 3) {
- this.g--;
- if (this.g == 0) {
- this.state = 4;
- }
- }
- if (this.state == 4) {
- this.r++;
- if (this.r == 255) {
- this.state = 5;
- }
- }
- if (this.state == 5) {
- this.b--;
- if (this.b == 0) {
- this.state = 0;
- }
- }
- this.hex = (this.a << 24) + (this.r << 16) + (this.g << 8) + this.b;
- return this.hex;
+ public int quantityDropped(Random rand)
+ {
+ return 0;
}
/**
- * Returns which pass should this block be rendered on. 0 for solids and 1
- * for alpha
+ * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
*/
@Override
@SideOnly(Side.CLIENT)
- public int getRenderBlockPass() {
+ public int getRenderBlockPass()
+ {
return 0;
}
/**
- * Returns the quantity of items to drop on block destruction.
+ * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
@Override
- public int quantityDropped(final Random rand) {
- return 0;
+ public boolean renderAsNormalBlock()
+ {
+ return true;
}
/**
- * A randomly called display update to be able to add particles or other
- * items for display
+ * Return true if a player with Silk Touch can harvest this block directly, and not its normal drops.
*/
@Override
- @SideOnly(Side.CLIENT)
- public void randomDisplayTick(final World world, final int posX, final int posY, final int posZ,
- final Random random) {
- Utils.spawnFX(world, posX, posY, posZ, "smoke", "cloud");
-
+ protected boolean canSilkHarvest()
+ {
+ return false;
}
@Override
@SideOnly(Side.CLIENT)
- public void registerBlockIcons(final IIconRegister iIcon) {
+ public void registerBlockIcons(IIconRegister iIcon)
+ {
this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + "blockMFEffect");
}
+ @Override
+ //http://stackoverflow.com/questions/31784658/how-can-i-loop-through-all-rgb-combinations-in-rainbow-order-in-java
+ public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
+ {
+ if(state == 0){
+ g++;
+ if(g == 255)
+ state = 1;
+ }
+ if(state == 1){
+ r--;
+ if(r == 0)
+ state = 2;
+ }
+ if(state == 2){
+ b++;
+ if(b == 255)
+ state = 3;
+ }
+ if(state == 3){
+ g--;
+ if(g == 0)
+ state = 4;
+ }
+ if(state == 4){
+ r++;
+ if(r == 255)
+ state = 5;
+ }
+ if(state == 5){
+ b--;
+ if(b == 0)
+ state = 0;
+ }
+ hex = (a << 24) + (r << 16) + (g << 8) + (b);
+ return hex;
+ }
+
/**
- * If this block doesn't render as an ordinary block it will return False
- * (examples: signs, buttons, stairs, etc)
+ * A randomly called display update to be able to add particles or other items for display
*/
@Override
- public boolean renderAsNormalBlock() {
- return true;
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(World world, int posX, int posY, int posZ, Random random){
+ Utils.spawnFX(world, posX, posY, posZ, "smoke", "cloud");
+
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java b/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java
index 2f659b7806..7fa890b6c8 100644
--- a/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java
+++ b/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java
@@ -1,15 +1,14 @@
package gtPlusPlus.core.block.general.antigrief;
-import java.util.List;
-import java.util.Random;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import gtPlusPlus.core.block.ModBlocks;
+import static gtPlusPlus.core.block.ModBlocks.blockGriefSaver;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.tileentities.general.TileEntityReverter;
import gtPlusPlus.core.util.Utils;
+
+import java.util.List;
+import java.util.Random;
+
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -24,241 +23,254 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
public class TowerDevice extends Block {
- private static IIcon TEX_ANTIBUILDER;
- public static final int META_ANTIBUILDER = 9;
- public static boolean areNearbyLockBlocks(final World world, final int x, final int y, final int z) {
- boolean locked = false;
- for (int dx = x - 2; dx <= x + 2; dx++) {
- for (int dy = y - 2; dy <= y + 2; dy++) {
- for (int dz = z - 2; dz <= z + 2; dz++) {
- if (world.getBlock(dx, dy, dz) == ModBlocks.blockGriefSaver
- && world.getBlockMetadata(dx, dy, dz) == 4) {
- locked = true;
- }
- }
- }
- }
- return locked;
- }
-
- public static void changeToActiveVanishBlock(final World par1World, final int x, final int y, final int z,
- final int meta) {
- TowerDevice.changeToBlockMeta(par1World, x, y, z, meta);
- par1World.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.pop", 0.3F, 0.6F);
-
- final Block thereBlockID = par1World.getBlock(x, y, z);
- par1World.scheduleBlockUpdate(x, y, z, thereBlockID,
- TowerDevice.getTickRateFor(thereBlockID, meta, par1World.rand));
- }
-
- private static void changeToBlockMeta(final World par1World, final int x, final int y, final int z,
- final int meta) {
- final Block thereBlockID = par1World.getBlock(x, y, z);
- if (thereBlockID == ModBlocks.blockGriefSaver) {
- par1World.setBlock(x, y, z, thereBlockID, meta, 3);
- par1World.markBlockRangeForRenderUpdate(x, y, z, x, y, z);
- par1World.notifyBlocksOfNeighborChange(x, y, z, thereBlockID);
- }
- }
-
- public static void checkAndActivateVanishBlock(final World world, final int x, final int y, final int z) {
- final Block thereID = world.getBlock(x, y, z);
- final int thereMeta = world.getBlockMetadata(x, y, z);
- }
-
- private static int getTickRateFor(final Block thereBlockID, final int meta, final Random rand) {
- return 15;
- }
-
- public static void unlockBlock(final World par1World, final int x, final int y, final int z) {
- final Block thereBlockID = par1World.getBlock(x, y, z);
- final int thereBlockMeta = par1World.getBlockMetadata(x, y, z);
- if (thereBlockID == ModBlocks.blockGriefSaver || thereBlockMeta == 4) {
- TowerDevice.changeToBlockMeta(par1World, x, y, z, 5);
- par1World.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.click", 0.3F, 0.6F);
- }
- }
-
- private boolean bUnbreakable;
-
- public TowerDevice() {
- super(Material.wood);
- this.setHardness(10.0F);
- this.setResistance(35.0F);
- this.setStepSound(Block.soundTypeWood);
- this.setCreativeTab(AddToCreativeTab.tabMachines);
- }
-
- @Override
- public TileEntity createTileEntity(final World world, final int metadata) {
- if (metadata == 0) {
- Utils.LOG_INFO("I have been created. [Antigriefer]" + this.getLocalizedName());
- return new TileEntityReverter();
- }
- return null;
- }
-
- @Override
- public int damageDropped(final int meta) {
- return meta;
- }
-
- @Override
- public float getBlockHardness(final World world, final int x, final int y, final int z) {
- final int meta = world.getBlockMetadata(x, y, z);
- return super.getBlockHardness(world, x, y, z);
- }
-
- @Override
- public float getExplosionResistance(final Entity par1Entity, final World world, final int x, final int y,
- final int z, final double explosionX, final double explosionY, final double explosionZ) {
- final int meta = world.getBlockMetadata(x, y, z);
- return super.getExplosionResistance(par1Entity, world, x, y, z, explosionX, explosionY, explosionZ);
- }
-
- @Override
- public IIcon getIcon(final int side, final int meta) {
- return TowerDevice.TEX_ANTIBUILDER;
- }
-
- @Override
- public Item getItemDropped(final int meta, final Random par2Random, final int par3) {
- switch (meta) {
- case 0:
- return null;
- }
- return Item.getItemFromBlock(this);
- }
-
- @Override
- public int getLightValue(final IBlockAccess world, final int x, final int y, final int z) {
- final Block blockID = world.getBlock(x, y, z);
- final int meta = world.getBlockMetadata(x, y, z);
- if (blockID != this) {
- return 0;
- }
- return 10;
- }
-
- @Override
- public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
- par3List.add(new ItemStack(par1, 1, 9));
- }
-
- @Override
- public boolean hasTileEntity(final int metadata) {
- return metadata == 0;
- }
-
- private boolean isInactiveTrapCharged(final World par1World, final int x, final int y, final int z) {
- return false;
- }
-
- private boolean isReactorReady(final World world, final int x, final int y, final int z) {
- if (world.getBlock(x, y + 1, z) != Blocks.redstone_block || world.getBlock(x, y - 1, z) != Blocks.redstone_block
- || world.getBlock(x + 1, y, z) != Blocks.redstone_block
- || world.getBlock(x - 1, y, z) != Blocks.redstone_block
- || world.getBlock(x, y, z + 1) != Blocks.redstone_block
- || world.getBlock(x, y, z - 1) != Blocks.redstone_block) {
- return false;
- }
- return true;
- }
-
- private void letsBuild(final World par1World, final int x, final int y, final int z) {
-
- }
-
- public void loadNBTData(final NBTTagCompound aNBT) {
- this.bUnbreakable = aNBT.getBoolean("bUnbreakable");
- }
-
- @Override
- public boolean onBlockActivated(final World par1World, final int x, final int y, final int z,
- final EntityPlayer par5EntityPlayer, final int par6, final float par7, final float par8, final float par9) {
- final int meta = par1World.getBlockMetadata(x, y, z);
- return false;
- }
-
- @Override
- public void onBlockAdded(final World par1World, final int x, final int y, final int z) {
- final int meta = par1World.getBlockMetadata(x, y, z);
- if (!par1World.isRemote) {
-
- }
- }
-
- @Override
- public void onNeighborBlockChange(final World par1World, final int x, final int y, final int z,
- final Block myBlockID) {
- final int meta = par1World.getBlockMetadata(x, y, z);
- if (!par1World.isRemote) {
-
- }
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public void randomDisplayTick(final World par1World, final int x, final int y, final int z,
- final Random par5Random) {
- final int meta = par1World.getBlockMetadata(x, y, z);
- if (meta == 3 || meta == 1 || meta == 9) {
- for (int i = 0; i < 1; i++) {
- this.sparkle(par1World, x, y, z, par5Random);
- }
- }
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public void registerBlockIcons(final IIconRegister par1IconRegister) {
- TowerDevice.TEX_ANTIBUILDER = par1IconRegister.registerIcon(CORE.MODID + ":" + "blockAntiGrief");
- }
-
- public void saveNBTData(final NBTTagCompound aNBT) {
- aNBT.setBoolean("bUnbreakable", this.bUnbreakable);
- }
-
- public void sparkle(final World world, final int x, final int y, final int z, final Random rand) {
- final double offset = 0.0625D;
- for (int side = 0; side < 6; side++) {
- double rx = x + rand.nextFloat();
- double ry = y + rand.nextFloat();
- double rz = z + rand.nextFloat();
- if (side == 0 && !world.getBlock(x, y + 1, z).isOpaqueCube()) {
- ry = y + 1 + offset;
- }
- if (side == 1 && !world.getBlock(x, y - 1, z).isOpaqueCube()) {
- ry = y + 0 - offset;
- }
- if (side == 2 && !world.getBlock(x, y, z + 1).isOpaqueCube()) {
- rz = z + 1 + offset;
- }
- if (side == 3 && !world.getBlock(x, y, z - 1).isOpaqueCube()) {
- rz = z + 0 - offset;
- }
- if (side == 4 && !world.getBlock(x + 1, y, z).isOpaqueCube()) {
- rx = x + 1 + offset;
- }
- if (side == 5 && !world.getBlock(x - 1, y, z).isOpaqueCube()) {
- rx = x + 0 - offset;
- }
- if (rx < x || rx > x + 1 || ry < 0.0D || ry > y + 1 || rz < z || rz > z + 1) {
- world.spawnParticle("reddust", rx, ry, rz, 0.0D, 0.0D, 0.0D);
- }
- }
- }
-
- public int tickRate() {
- return 15;
+ private static IIcon TEX_ANTIBUILDER;
+ public static final int META_ANTIBUILDER = 9;
+ private boolean bUnbreakable;
+
+ public TowerDevice()
+ {
+ super(Material.wood);
+ setHardness(10.0F);
+ setResistance(35.0F);
+ setStepSound(Block.soundTypeWood);
+ setCreativeTab(AddToCreativeTab.tabMachines);
+ }
+
+ public int tickRate()
+ {
+ return 15;
+ }
+
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setBoolean("bUnbreakable", bUnbreakable);
}
- @Override
- public void updateTick(final World par1World, final int x, final int y, final int z, final Random par5Random) {
- if (!par1World.isRemote) {
- final int meta = par1World.getBlockMetadata(x, y, z);
- }
+ public void loadNBTData(NBTTagCompound aNBT) {
+ bUnbreakable = aNBT.getBoolean("bUnbreakable");
}
+
+ public IIcon getIcon(int side, int meta)
+ {
+ return TEX_ANTIBUILDER;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister par1IconRegister)
+ {
+ TEX_ANTIBUILDER = par1IconRegister.registerIcon(CORE.MODID + ":" + "blockAntiGrief");
+ }
+
+ public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
+ {
+ par3List.add(new ItemStack(par1, 1, 9));
+ }
+
+ public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
+ {
+ int meta = par1World.getBlockMetadata(x, y, z);
+ return false;
+ }
+
+ public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
+ {
+ int meta = world.getBlockMetadata(x, y, z);
+ return super.getExplosionResistance(par1Entity, world, x, y, z, explosionX, explosionY, explosionZ);
+ }
+
+ public float getBlockHardness(World world, int x, int y, int z)
+ {
+ int meta = world.getBlockMetadata(x, y, z);
+ return super.getBlockHardness(world, x, y, z);
+ }
+
+ public static boolean areNearbyLockBlocks(World world, int x, int y, int z)
+ {
+ boolean locked = false;
+ for (int dx = x - 2; dx <= x + 2; dx++) {
+ for (int dy = y - 2; dy <= y + 2; dy++) {
+ for (int dz = z - 2; dz <= z + 2; dz++) {
+ if ((world.getBlock(dx, dy, dz) == blockGriefSaver) && (world.getBlockMetadata(dx, dy, dz) == 4)) {
+ locked = true;
+ }
+ }
+ }
+ }
+ return locked;
+ }
+
+ public static void unlockBlock(World par1World, int x, int y, int z)
+ {
+ Block thereBlockID = par1World.getBlock(x, y, z);
+ int thereBlockMeta = par1World.getBlockMetadata(x, y, z);
+ if ((thereBlockID == blockGriefSaver) || (thereBlockMeta == 4))
+ {
+ changeToBlockMeta(par1World, x, y, z, 5);
+ par1World.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.click", 0.3F, 0.6F);
+ }
+ }
+
+ private static void changeToBlockMeta(World par1World, int x, int y, int z, int meta)
+ {
+ Block thereBlockID = par1World.getBlock(x, y, z);
+ if ((thereBlockID == blockGriefSaver))
+ {
+ par1World.setBlock(x, y, z, thereBlockID, meta, 3);
+ par1World.markBlockRangeForRenderUpdate(x, y, z, x, y, z);
+ par1World.notifyBlocksOfNeighborChange(x, y, z, thereBlockID);
+ }
+ }
+
+ public void onBlockAdded(World par1World, int x, int y, int z)
+ {
+ int meta = par1World.getBlockMetadata(x, y, z);
+ if (!par1World.isRemote) {
+
+ }
+ }
+
+ public void onNeighborBlockChange(World par1World, int x, int y, int z, Block myBlockID)
+ {
+ int meta = par1World.getBlockMetadata(x, y, z);
+ if (!par1World.isRemote)
+ {
+
+ }
+ }
+
+ public void updateTick(World par1World, int x, int y, int z, Random par5Random)
+ {
+ if (!par1World.isRemote)
+ {
+ int meta = par1World.getBlockMetadata(x, y, z);
+ }
+ }
+
+ private void letsBuild(World par1World, int x, int y, int z)
+ {
+
+ }
+
+ private boolean isInactiveTrapCharged(World par1World, int x, int y, int z)
+ {
+ return false;
+ }
+
+ private boolean isReactorReady(World world, int x, int y, int z)
+ {
+ if ((world.getBlock(x, y + 1, z) != Blocks.redstone_block) ||
+ (world.getBlock(x, y - 1, z) != Blocks.redstone_block) ||
+ (world.getBlock(x + 1, y, z) != Blocks.redstone_block) ||
+ (world.getBlock(x - 1, y, z) != Blocks.redstone_block) ||
+ (world.getBlock(x, y, z + 1) != Blocks.redstone_block) ||
+ (world.getBlock(x, y, z - 1) != Blocks.redstone_block)) {
+ return false;
+ }
+ return true;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(World par1World, int x, int y, int z, Random par5Random)
+ {
+ int meta = par1World.getBlockMetadata(x, y, z);
+ if ((meta == 3) || (meta == 1) || (meta == 9)) {
+ for (int i = 0; i < 1; i++) {
+ sparkle(par1World, x, y, z, par5Random);
+ }
+ }
+ }
+
+ public void sparkle(World world, int x, int y, int z, Random rand)
+ {
+ double offset = 0.0625D;
+ for (int side = 0; side < 6; side++)
+ {
+ double rx = x + rand.nextFloat();
+ double ry = y + rand.nextFloat();
+ double rz = z + rand.nextFloat();
+ if ((side == 0) && (!world.getBlock(x, y + 1, z).isOpaqueCube())) {
+ ry = y + 1 + offset;
+ }
+ if ((side == 1) && (!world.getBlock(x, y - 1, z).isOpaqueCube())) {
+ ry = y + 0 - offset;
+ }
+ if ((side == 2) && (!world.getBlock(x, y, z + 1).isOpaqueCube())) {
+ rz = z + 1 + offset;
+ }
+ if ((side == 3) && (!world.getBlock(x, y, z - 1).isOpaqueCube())) {
+ rz = z + 0 - offset;
+ }
+ if ((side == 4) && (!world.getBlock(x + 1, y, z).isOpaqueCube())) {
+ rx = x + 1 + offset;
+ }
+ if ((side == 5) && (!world.getBlock(x - 1, y, z).isOpaqueCube())) {
+ rx = x + 0 - offset;
+ }
+ if ((rx < x) || (rx > x + 1) || (ry < 0.0D) || (ry > y + 1) || (rz < z) || (rz > z + 1)) {
+ world.spawnParticle("reddust", rx, ry, rz, 0.0D, 0.0D, 0.0D);
+ }
+ }
+ }
+
+ public static void checkAndActivateVanishBlock(World world, int x, int y, int z)
+ {
+ Block thereID = world.getBlock(x, y, z);
+ int thereMeta = world.getBlockMetadata(x, y, z);
+ }
+
+ public static void changeToActiveVanishBlock(World par1World, int x, int y, int z, int meta)
+ {
+ changeToBlockMeta(par1World, x, y, z, meta);
+ par1World.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.pop", 0.3F, 0.6F);
+
+ Block thereBlockID = par1World.getBlock(x, y, z);
+ par1World.scheduleBlockUpdate(x, y, z, thereBlockID, getTickRateFor(thereBlockID, meta, par1World.rand));
+ }
+
+ private static int getTickRateFor(Block thereBlockID, int meta, Random rand)
+ {
+ return 15;
+ }
+
+ public int getLightValue(IBlockAccess world, int x, int y, int z)
+ {
+ Block blockID = world.getBlock(x, y, z);
+ int meta = world.getBlockMetadata(x, y, z);
+ if (blockID != this) {
+ return 0;
+ }
+ return 10;
+ }
+
+ public boolean hasTileEntity(int metadata)
+ {
+ return (metadata == 0);
+ }
+
+ public TileEntity createTileEntity(World world, int metadata)
+ {
+ if (metadata == 0) {
+ Utils.LOG_INFO("I have been created. [Antigriefer]"+this.getLocalizedName());
+ return new TileEntityReverter();
+ }
+ return null;
+ }
+
+ public Item getItemDropped(int meta, Random par2Random, int par3)
+ {
+ switch (meta)
+ {
+ case 0:
+ return null;
+ }
+ return Item.getItemFromBlock(this);
+ }
+
+ public int damageDropped(int meta)
+ {
+ return meta;
+ }
}
diff --git a/src/Java/gtPlusPlus/core/block/general/fluids/BlockFluidJackDaniels.java b/src/Java/gtPlusPlus/core/block/general/fluids/BlockFluidJackDaniels.java
index 768822dd6e..6096da7054 100644
--- a/src/Java/gtPlusPlus/core/block/general/fluids/BlockFluidJackDaniels.java
+++ b/src/Java/gtPlusPlus/core/block/general/fluids/BlockFluidJackDaniels.java
@@ -1,7 +1,5 @@
package gtPlusPlus.core.block.general.fluids;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
import net.minecraft.block.material.Material;
@@ -11,45 +9,43 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidClassic;
import net.minecraftforge.fluids.Fluid;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
public class BlockFluidJackDaniels extends BlockFluidClassic {
- @SideOnly(Side.CLIENT)
- protected IIcon stillIcon;
- @SideOnly(Side.CLIENT)
- protected IIcon flowingIcon;
-
- public BlockFluidJackDaniels(final Fluid fluid, final Material material) {
- super(fluid, material);
- this.setCreativeTab(AddToCreativeTab.tabMisc);
- }
-
- @Override
- public boolean canDisplace(final IBlockAccess world, final int x, final int y, final int z) {
- if (world.getBlock(x, y, z).getMaterial().isLiquid()) {
- return false;
- }
- return super.canDisplace(world, x, y, z);
- }
-
- @Override
- public boolean displaceIfPossible(final World world, final int x, final int y, final int z) {
- if (world.getBlock(x, y, z).getMaterial().isLiquid()) {
- return false;
- }
- return super.displaceIfPossible(world, x, y, z);
- }
-
- @Override
- public IIcon getIcon(final int side, final int meta) {
- return side == 0 || side == 1 ? this.stillIcon : this.flowingIcon;
- }
-
- @SideOnly(Side.CLIENT)
- @Override
- public void registerBlockIcons(final IIconRegister register) {
- this.stillIcon = register.registerIcon(CORE.MODID + ":fluids/fluid.jackdaniels");
- this.flowingIcon = register.registerIcon(CORE.MODID + ":fluids/fluid.jackdaniels");
- }
-
-}
+ @SideOnly(Side.CLIENT)
+ protected IIcon stillIcon;
+ @SideOnly(Side.CLIENT)
+ protected IIcon flowingIcon;
+
+ public BlockFluidJackDaniels(Fluid fluid, Material material) {
+ super(fluid, material);
+ setCreativeTab(AddToCreativeTab.tabMisc);
+ }
+
+ @Override
+ public IIcon getIcon(int side, int meta) {
+ return (side == 0 || side == 1)? stillIcon : flowingIcon;
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public void registerBlockIcons(IIconRegister register) {
+ stillIcon = register.registerIcon(CORE.MODID+":fluids/fluid.jackdaniels");
+ flowingIcon = register.registerIcon(CORE.MODID+":fluids/fluid.jackdaniels");
+ }
+
+ @Override
+ public boolean canDisplace(IBlockAccess world, int x, int y, int z) {
+ if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;
+ return super.canDisplace(world, x, y, z);
+ }
+
+ @Override
+ public boolean displaceIfPossible(World world, int x, int y, int z) {
+ if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;
+ return super.displaceIfPossible(world, x, y, z);
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java b/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java
index dbbc91c902..2832d4d0a4 100644
--- a/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java
+++ b/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java
@@ -1,33 +1,34 @@
package gtPlusPlus.core.block.machine;
-import gtPlusPlus.core.block.base.BasicBlock.BlockTypes;
import gtPlusPlus.core.block.base.MetaBlock;
+import gtPlusPlus.core.block.base.BasicBlock.BlockTypes;
import gtPlusPlus.core.lib.CORE;
import net.minecraft.block.material.Material;
import net.minecraft.world.IBlockAccess;
public class BlockGtFrameBox extends MetaBlock {
- private int[] colours;
- private int totalColours;
-
- public BlockGtFrameBox(final String unlocalizedName, final Material material, final BlockTypes blockTypeENUM,
- final boolean recolour, final int... colour) {
+ private int[] colours;
+ private int totalColours;
+
+ public BlockGtFrameBox(
+ String unlocalizedName, Material material,
+ BlockTypes blockTypeENUM, boolean recolour, int... colour) {
super(unlocalizedName, material, blockTypeENUM.getBlockSoundType());
- this.setBlockTextureName(CORE.MODID + ":" + "blockGtFrame");
- this.setHarvestLevel(blockTypeENUM.getHarvestTool(), 2);
- if (recolour && colour != null && colour.length > 0) {
- this.colours = colour;
- this.totalColours = this.colours.length;
- }
+ this.setBlockTextureName(CORE.MODID + ":" + "blockGtFrame");
+ this.setHarvestLevel(blockTypeENUM.getHarvestTool(), 2);
+ if (recolour && (colour != null && colour.length > 0)){
+ colours = colour;
+ totalColours = colours.length;
+ }
}
@Override
- public int colorMultiplier(final IBlockAccess p_149720_1_, final int p_149720_2_, final int p_149720_3_,
- final int p_149720_4_) {
- for (final int i : this.colours) {
-
- }
+ public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_,
+ int p_149720_3_, int p_149720_4_) {
+ for (int i : colours){
+
+ }
return super.colorMultiplier(p_149720_1_, p_149720_2_, p_149720_3_, p_149720_4_);
}
diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_Charger.java b/src/Java/gtPlusPlus/core/block/machine/Machine_Charger.java
index e88c5c5b6b..4f426b99c9 100644
--- a/src/Java/gtPlusPlus/core/block/machine/Machine_Charger.java
+++ b/src/Java/gtPlusPlus/core/block/machine/Machine_Charger.java
@@ -1,11 +1,12 @@
package gtPlusPlus.core.block.machine;
-import java.util.ArrayList;
-
import gtPlusPlus.GTplusplus;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.tileentities.machines.TileEntityCharger;
+
+import java.util.ArrayList;
+
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -16,67 +17,67 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import scala.util.Random;
-public class Machine_Charger extends BlockContainer {
- private static final String name = "Charging Machine";
-
- private final Random rand = new Random();
-
- public Machine_Charger(final String unlocalizedName) {
- super(Material.iron);
- // GameRegistry.registerBlock(this, unlocalizedName);
- this.setBlockName(unlocalizedName);
- this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName);
- this.setCreativeTab(AddToCreativeTab.tabMachines);
- }
-
- @Override
- public void breakBlock(final World world, final int x, final int y, final int z, final Block block,
- final int par6) {
- if (world.isRemote) {
- return;
- }
-
- final ArrayList drops = new ArrayList();
-
- final TileEntity teRaw = world.getTileEntity(x, y, z);
-
- if (teRaw != null && teRaw instanceof TileEntityCharger) {
- final TileEntityCharger te = (TileEntityCharger) teRaw;
-
- for (int i = 0; i < te.getSizeInventory(); i++) {
- final ItemStack stack = te.getStackInSlot(i);
-
- if (stack != null) {
- drops.add(stack.copy());
- }
- }
- }
-
- for (int i = 0; i < drops.size(); i++) {
- final EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, (ItemStack) drops.get(i));
- item.setVelocity((this.rand.nextDouble() - 0.5) * 0.25, this.rand.nextDouble() * 0.5 * 0.25,
- (this.rand.nextDouble() - 0.5) * 0.25);
- world.spawnEntityInWorld(item);
- }
- }
-
- @Override
- public TileEntity createNewTileEntity(final World world, final int par2) {
- return new TileEntityCharger();
- }
-
- @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 TileEntityCharger) {
- player.openGui(GTplusplus.instance, 1, world, x, y, z);
- return true;
- }
- return false;
- }
+public class Machine_Charger extends BlockContainer
+{
+ private static final String name = "Charging Machine";
+
+ private final Random rand = new Random();
+
+ public Machine_Charger(String unlocalizedName)
+ {
+ super(Material.iron);
+ //GameRegistry.registerBlock(this, unlocalizedName);
+ this.setBlockName(unlocalizedName);
+ this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz)
+ {
+ if (world.isRemote) return true;
+
+ TileEntity te = world.getTileEntity(x, y, z);
+ if (te != null && te instanceof TileEntityCharger)
+ {
+ player.openGui(GTplusplus.instance, 1, world, x, y, z);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void breakBlock(World world, int x, int y, int z, Block block, int par6)
+ {
+ if (world.isRemote) return;
+
+ ArrayList drops = new ArrayList();
+
+ TileEntity teRaw = world.getTileEntity(x, y, z);
+
+ if (teRaw != null && teRaw instanceof TileEntityCharger)
+ {
+ TileEntityCharger te = (TileEntityCharger) teRaw;
+
+ for (int i = 0; i < te.getSizeInventory(); i++)
+ {
+ ItemStack stack = te.getStackInSlot(i);
+
+ if (stack != null) drops.add(stack.copy());
+ }
+ }
+
+ for (int i = 0;i < drops.size();i++)
+ {
+ EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, (ItemStack) drops.get(i));
+ item.setVelocity((rand.nextDouble() - 0.5) * 0.25, rand.nextDouble() * 0.5 * 0.25, (rand.nextDouble() - 0.5) * 0.25);
+ world.spawnEntityInWorld(item);
+ }
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int par2)
+ {
+ return new TileEntityCharger();
+ }
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_NHG.java b/src/Java/gtPlusPlus/core/block/machine/Machine_NHG.java
index cfad3006b9..011e293000 100644
--- a/src/Java/gtPlusPlus/core/block/machine/Machine_NHG.java
+++ b/src/Java/gtPlusPlus/core/block/machine/Machine_NHG.java
@@ -1,11 +1,12 @@
package gtPlusPlus.core.block.machine;
-import java.util.ArrayList;
-
import gtPlusPlus.GTplusplus;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.tileentities.machines.TileEntityNHG;
+
+import java.util.ArrayList;
+
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -16,67 +17,67 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import scala.util.Random;
-public class Machine_NHG extends BlockContainer {
- private static final String name = "Nuclear Fueled Helium Generator";
-
- private final Random rand = new Random();
-
- public Machine_NHG(final String unlocalizedName) {
- super(Material.iron);
- // GameRegistry.registerBlock(this, unlocalizedName);
- this.setBlockName(unlocalizedName);
- this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName);
- this.setCreativeTab(AddToCreativeTab.tabMachines);
- }
-
- @Override
- public void breakBlock(final World world, final int x, final int y, final int z, final Block block,
- final int par6) {
- if (world.isRemote) {
- return;
- }
-
- final ArrayList drops = new ArrayList();
-
- final TileEntity teRaw = world.getTileEntity(x, y, z);
-
- if (teRaw != null && teRaw instanceof TileEntityNHG) {
- final TileEntityNHG te = (TileEntityNHG) teRaw;
-
- for (int i = 0; i < te.getSizeInventory(); i++) {
- final ItemStack stack = te.getStackInSlot(i);
-
- if (stack != null) {
- drops.add(stack.copy());
- }
- }
- }
-
- for (int i = 0; i < drops.size(); i++) {
- final EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, (ItemStack) drops.get(i));
- item.setVelocity((this.rand.nextDouble() - 0.5) * 0.25, this.rand.nextDouble() * 0.5 * 0.25,
- (this.rand.nextDouble() - 0.5) * 0.25);
- world.spawnEntityInWorld(item);
- }
- }
-
- @Override
- public TileEntity createNewTileEntity(final World world, final int par2) {
- return new TileEntityNHG();
- }
-
- @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 TileEntityNHG) {
- player.openGui(GTplusplus.instance, 0, world, x, y, z);
- return true;
- }
- return false;
- }
+public class Machine_NHG extends BlockContainer
+{
+ private static final String name = "Nuclear Fueled Helium Generator";
+
+ private final Random rand = new Random();
+
+ public Machine_NHG(String unlocalizedName)
+ {
+ super(Material.iron);
+ //GameRegistry.registerBlock(this, unlocalizedName);
+ this.setBlockName(unlocalizedName);
+ this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz)
+ {
+ if (world.isRemote) return true;
+
+ TileEntity te = world.getTileEntity(x, y, z);
+ if (te != null && te instanceof TileEntityNHG)
+ {
+ player.openGui(GTplusplus.instance, 0, world, x, y, z);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void breakBlock(World world, int x, int y, int z, Block block, int par6)
+ {
+ if (world.isRemote) return;
+
+ ArrayList drops = new ArrayList();
+
+ TileEntity teRaw = world.getTileEntity(x, y, z);
+
+ if (teRaw != null && teRaw instanceof TileEntityNHG)
+ {
+ TileEntityNHG te = (TileEntityNHG) teRaw;
+
+ for (int i = 0; i < te.getSizeInventory(); i++)
+ {
+ ItemStack stack = te.getStackInSlot(i);
+
+ if (stack != null) drops.add(stack.copy());
+ }
+ }
+
+ for (int i = 0;i < drops.size();i++)
+ {
+ EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, (ItemStack) drops.get(i));
+ item.setVelocity((rand.nextDouble() - 0.5) * 0.25, rand.nextDouble() * 0.5 * 0.25, (rand.nextDouble() - 0.5) * 0.25);
+ world.spawnEntityInWorld(item);
+ }
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int par2)
+ {
+ return new TileEntityNHG();
+ }
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_WireiusDeletus.java b/src/Java/gtPlusPlus/core/block/machine/Machine_WireiusDeletus.java
index e881d40d35..e964a9da01 100644
--- a/src/Java/gtPlusPlus/core/block/machine/Machine_WireiusDeletus.java
+++ b/src/Java/gtPlusPlus/core/block/machine/Machine_WireiusDeletus.java
@@ -1,6 +1,5 @@
package gtPlusPlus.core.block.machine;
-public class Machine_WireiusDeletus { // A Block that removes GT Cable and Wire
- // from it's inventory.
+public class Machine_WireiusDeletus { //A Block that removes GT Cable and Wire from it's inventory.
}
diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java
index 1921aa8000..ed986b756e 100644
--- a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java
+++ b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java
@@ -1,11 +1,5 @@
package gtPlusPlus.core.block.machine;
-import buildcraft.api.tools.IToolWrench;
-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 crazypants.enderio.api.tool.ITool;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
@@ -21,85 +15,96 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
+import buildcraft.api.tools.IToolWrench;
+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 crazypants.enderio.api.tool.ITool;
-public class Machine_Workbench extends BlockContainer {
- @SideOnly(Side.CLIENT)
- private IIcon textureTop;
- @SideOnly(Side.CLIENT)
- private IIcon textureBottom;
- @SideOnly(Side.CLIENT)
- private IIcon textureFront;
+public class Machine_Workbench extends BlockContainer
+{
+ @SideOnly(Side.CLIENT)
+ private IIcon textureTop;
+ @SideOnly(Side.CLIENT)
+ private IIcon textureBottom;
+ @SideOnly(Side.CLIENT)
+ private IIcon textureFront;
- @SuppressWarnings("deprecation")
- public Machine_Workbench() {
- super(Material.iron);
- this.setBlockName("blockWorkbenchGT");
- this.setCreativeTab(AddToCreativeTab.tabMachines);
- GameRegistry.registerBlock(this, "blockWorkbenchGT");
+ @SuppressWarnings("deprecation")
+ public Machine_Workbench()
+ {
+ super(Material.iron);
+ this.setBlockName("blockWorkbenchGT");
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ GameRegistry.registerBlock(this, "blockWorkbenchGT");
LanguageRegistry.addName(this, "Bronze Workbench");
+
+ }
- }
-
- @Override
- public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
- return new TileEntityWorkbench();
- }
+ /**
+ * Gets the block's texture. Args: side, meta
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int p_149691_1_, int p_149691_2_)
+ {
+ return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : (p_149691_1_ != 2 && p_149691_1_ != 4 ? this.blockIcon : this.textureFront));
+ }
- /**
- * Gets the block's texture. Args: side, meta
- */
- @Override
+ @Override
@SideOnly(Side.CLIENT)
- public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) {
- return p_149691_1_ == 1 ? this.textureTop
- : p_149691_1_ == 0 ? this.textureBottom
- : p_149691_1_ != 2 && p_149691_1_ != 4 ? this.blockIcon : this.textureFront;
- }
+ public void registerBlockIcons(IIconRegister p_149651_1_)
+ {
+ this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet");
+ this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_top_crafting");
+ this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side");
+ this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet");
+ }
- /**
- * 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) {
+ /**
+ * Called upon block activation (right click on the block.)
+ */
+ @Override
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz)
+ {
ItemStack heldItem = null;
- if (world.isRemote) {
- heldItem = PlayerUtils.getItemStackInPlayersHand();
- }
+ if (world.isRemote){
+ heldItem = PlayerUtils.getItemStackInPlayersHand();
+ }
boolean holdingWrench = false;
- if (heldItem != null) {
- if (heldItem.getItem() instanceof ItemToolWrench) {
+ if (heldItem != null){
+ if (heldItem.getItem() instanceof ItemToolWrench){
holdingWrench = true;
}
- else if (heldItem.getItem() instanceof IToolWrench) {
+ else if (heldItem.getItem() instanceof IToolWrench){
holdingWrench = true;
}
- else if (heldItem.getItem() instanceof ITool) {
+ else if (heldItem.getItem() instanceof ITool){
holdingWrench = true;
}
- /*
- * else if (heldItem.getItem() instanceof GT_MetaGenerated_Tool){
- * GT_MetaGenerated_Tool testTool = (GT_MetaGenerated_Tool)
- * heldItem.getItem(); if (testTool.canWrench(player, x, y, z)){
- * holdingWrench = true; } }
- */
+ /*else if (heldItem.getItem() instanceof GT_MetaGenerated_Tool){
+ GT_MetaGenerated_Tool testTool = (GT_MetaGenerated_Tool) heldItem.getItem();
+ if (testTool.canWrench(player, x, y, z)){
+ holdingWrench = true;
+ }
+ }*/
else {
holdingWrench = false;
}
}
- if (world.isRemote) {
- return true;
- }
+ if (world.isRemote) return true;
- final TileEntity te = world.getTileEntity(x, y, z);
- if (te != null && te instanceof TileEntityWorkbench) {
- if (!holdingWrench) {
+ TileEntity te = world.getTileEntity(x, y, z);
+ if (te != null && te instanceof TileEntityWorkbench)
+ {
+ if (!holdingWrench){
player.openGui(GTplusplus.instance, 3, world, x, y, z);
- return true;
+ return true;
}
Utils.LOG_INFO("Holding a Wrench, doing wrench things instead.");
}
@@ -107,11 +112,7 @@ public class Machine_Workbench extends BlockContainer {
}
@Override
- @SideOnly(Side.CLIENT)
- public void registerBlockIcons(final IIconRegister p_149651_1_) {
- this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet");
- this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_top_crafting");
- this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side");
- this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet");
+ public TileEntity createNewTileEntity(World world, int p_149915_2_) {
+ return new TileEntityWorkbench();
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java
index 20d6c8601c..2f061ea298 100644
--- a/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java
+++ b/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java
@@ -1,11 +1,5 @@
package gtPlusPlus.core.block.machine;
-import buildcraft.api.tools.IToolWrench;
-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 crazypants.enderio.api.tool.ITool;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
@@ -21,17 +15,25 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
+import buildcraft.api.tools.IToolWrench;
+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 crazypants.enderio.api.tool.ITool;
-public class Machine_WorkbenchAdvanced extends BlockContainer {
+public class Machine_WorkbenchAdvanced extends BlockContainer
+{
@SideOnly(Side.CLIENT)
- private IIcon textureTop;
+ private IIcon textureTop;
@SideOnly(Side.CLIENT)
- private IIcon textureBottom;
+ private IIcon textureBottom;
@SideOnly(Side.CLIENT)
- private IIcon textureFront;
+ private IIcon textureFront;
@SuppressWarnings("deprecation")
- public Machine_WorkbenchAdvanced() {
+ public Machine_WorkbenchAdvanced()
+ {
super(Material.iron);
this.setBlockName("blockWorkbenchGTAdvanced");
this.setCreativeTab(AddToCreativeTab.tabMachines);
@@ -40,61 +42,65 @@ public class Machine_WorkbenchAdvanced extends BlockContainer {
}
- @Override
- public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
- return new TileEntityWorkbenchAdvanced(128000, 2);
- }
-
/**
* 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 p_149691_1_ == 1 ? this.textureTop
- : p_149691_1_ == 0 ? this.textureBottom
- : p_149691_1_ != 2 && p_149691_1_ != 4 ? this.blockIcon : this.textureFront;
+ public IIcon getIcon(int p_149691_1_, int p_149691_2_)
+ {
+ return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : (p_149691_1_ != 2 && p_149691_1_ != 4 ? this.blockIcon : this.textureFront));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister p_149651_1_)
+ {
+ this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top");
+ this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "cover_crafting");
+ this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top");
+ this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top");
}
/**
* 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) {
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz)
+ {
- final ItemStack heldItem = PlayerUtils.getItemStackInPlayersHand(player);
- if (world.isRemote) {
- return true;
- }
+ ItemStack heldItem = PlayerUtils.getItemStackInPlayersHand(player);
+ if (world.isRemote) return true;
boolean holdingWrench = false;
- if (heldItem != null) {
- if (heldItem.getItem() instanceof ItemToolWrench) {
+ if (heldItem != null){
+ if (heldItem.getItem() instanceof ItemToolWrench){
holdingWrench = true;
}
- else if (heldItem.getItem() instanceof IToolWrench) {
+ else if (heldItem.getItem() instanceof IToolWrench){
holdingWrench = true;
}
- else if (heldItem.getItem() instanceof ITool) {
+ else if (heldItem.getItem() instanceof ITool){
holdingWrench = true;
}
- /*
- * else if (heldItem.getItem() instanceof GT_MetaGenerated_Tool){
- * GT_MetaGenerated_Tool testTool = (GT_MetaGenerated_Tool)
- * heldItem.getItem(); if (testTool.canWrench(player, x, y, z)){
- * holdingWrench = true; } }
- */
+ /*else if (heldItem.getItem() instanceof GT_MetaGenerated_Tool){
+ GT_MetaGenerated_Tool testTool = (GT_MetaGenerated_Tool) heldItem.getItem();
+ if (testTool.canWrench(player, x, y, z)){
+ holdingWrench = true;
+ }
+ }*/
else {
holdingWrench = false;
}
}
- final TileEntity te = world.getTileEntity(x, y, z);
- if (te != null && te instanceof TileEntityWorkbenchAdvanced) {
- if (!holdingWrench) {
+
+ TileEntity te = world.getTileEntity(x, y, z);
+ if (te != null && te instanceof TileEntityWorkbenchAdvanced)
+ {
+ if (!holdingWrench){
player.openGui(GTplusplus.instance, 4, world, x, y, z);
- return true;
+ return true;
}
Utils.LOG_INFO("Holding a Wrench, doing wrench things instead.");
}
@@ -102,11 +108,7 @@ public class Machine_WorkbenchAdvanced extends BlockContainer {
}
@Override
- @SideOnly(Side.CLIENT)
- public void registerBlockIcons(final IIconRegister p_149651_1_) {
- this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top");
- this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "cover_crafting");
- this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top");
- this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top");
+ public TileEntity createNewTileEntity(World world, int p_149915_2_) {
+ return new TileEntityWorkbenchAdvanced(128000, 2);
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/block/HeliumGenerator.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/block/HeliumGenerator.java
index 19e9b09e8f..7a76b09cca 100644
--- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/block/HeliumGenerator.java
+++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/block/HeliumGenerator.java
@@ -1,13 +1,12 @@
package gtPlusPlus.core.block.machine.heliumgen.block;
-import java.util.Random;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.core.block.machine.heliumgen.tileentity.TileEntityHeliumGenerator;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
+
+import java.util.Random;
+
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -22,145 +21,145 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
public class HeliumGenerator extends BlockContainer {
- private IIcon top, sides, front;
- private final Random randy = new Random();
-
- public HeliumGenerator() {
- super(Material.iron);
- this.setStepSound(Block.soundTypeMetal);
- this.setHardness(20.0F);
- this.setBlockName("helium_collector");
- this.setHarvestLevel("pickaxe", 3);
- this.setCreativeTab(AddToCreativeTab.tabMachines);
- }
-
- @Override
- public void breakBlock(final World world, final int x, final int y, final int z, final Block block, final int wut) {
- final TileEntityHeliumGenerator collector = (TileEntityHeliumGenerator) world.getTileEntity(x, y, z);
-
- if (collector != null) {
- int i = 0;
- for (i = 0; i < collector.getSizeInventory(); i++) {
-
- final ItemStack itemstack = collector.getStackInSlot(i);
-
- if (itemstack != null) {
- final float f = this.randy.nextFloat() * 0.8F + 0.1F;
- final float f1 = this.randy.nextFloat() * 0.8F + 0.1F;
- final float f2 = this.randy.nextFloat() * 0.8F + 0.1F;
-
- while (itemstack.stackSize > 0) {
- int j1 = this.randy.nextInt(21) + 10;
-
- if (j1 > itemstack.stackSize) {
- j1 = itemstack.stackSize;
- }
-
- itemstack.stackSize -= j1;
- final EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2,
- new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
-
- if (itemstack.hasTagCompound()) {
- entityitem.getEntityItem()
- .setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
- }
-
- final float f3 = 0.05F;
- entityitem.motionX = (float) this.randy.nextGaussian() * f3;
- entityitem.motionY = (float) this.randy.nextGaussian() * f3 + 0.2F;
- entityitem.motionZ = (float) this.randy.nextGaussian() * f3;
- world.spawnEntityInWorld(entityitem);
- }
- }
-
- world.func_147453_f(x, y, z, block);
- }
- }
-
- super.breakBlock(world, x, y, z, block, wut);
- }
-
- @Override
- public TileEntity createNewTileEntity(final World world, final int meta) {
- return new TileEntityHeliumGenerator();
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
- if (side == 1) {
- return this.top;
- }
- int facing = 2;
- final TileEntityHeliumGenerator machine = (TileEntityHeliumGenerator) world.getTileEntity(x, y, z);
- if (machine != null) {
- facing = machine.getFacing();
- }
- if (side == facing) {
- return this.front;
- }
- else {
- return this.sides;
- }
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public IIcon getIcon(final int side, final int metadata) {
- if (side == 1) {
- return this.top;
- }
- if (side == 3) {
- return this.front;
- }
- return this.sides;
- }
-
- @Override
- public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player,
- final int par6, final float par7, final float par8, final float par9) {
- if (world.isRemote) {
- return true;
- }
+ private IIcon top, sides, front;
+ private Random randy = new Random();
+
+ public HeliumGenerator(){
+ super(Material.iron);
+ setStepSound(Block.soundTypeMetal);
+ setHardness(20.0F);
+ setBlockName("helium_collector");
+ setHarvestLevel("pickaxe", 3);
+ setCreativeTab(AddToCreativeTab.tabMachines);
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public void registerBlockIcons (IIconRegister iconRegister)
+ {
+ this.top = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_SIDE");
+ this.sides = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_SIDE");
+ this.front = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_FRONT");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
+ if(side == 1)
+ return top;
+ int facing = 2;
+ TileEntityHeliumGenerator machine = (TileEntityHeliumGenerator)world.getTileEntity(x, y, z);
+ if(machine != null)
+ facing = machine.getFacing();
+ if(side == facing)
+ return front;
+ else
+ return sides;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon (int side, int metadata)
+ {
+ if(side == 1)
+ return top;
+ if(side == 3)
+ return front;
+ return sides;
+ }
+
+ @Override
+ public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
+ {
+ if (world.isRemote)
+ {
+ return true;
+ }
player.openGui(GTplusplus.instance, 2, world, x, y, z);
return true;
- }
-
- @Override
- public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase player,
- final ItemStack item) {
- final TileEntity tile = world.getTileEntity(x, y, z);
- if (tile instanceof TileEntityHeliumGenerator) {
- final TileEntityHeliumGenerator machine = (TileEntityHeliumGenerator) tile;
- final int l = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
-
- if (l == 0) {
- machine.setFacing((short) 2);
- }
-
- if (l == 1) {
- machine.setFacing((short) 5);
- }
-
- if (l == 2) {
- machine.setFacing((short) 3);
- }
-
- if (l == 3) {
- machine.setFacing((short) 4);
- }
- }
-
- }
-
- @SideOnly(Side.CLIENT)
- @Override
- public void registerBlockIcons(final IIconRegister iconRegister) {
- this.top = iconRegister.registerIcon(CORE.MODID + ":blockHeliumCollector_SIDE");
- this.sides = iconRegister.registerIcon(CORE.MODID + ":blockHeliumCollector_SIDE");
- this.front = iconRegister.registerIcon(CORE.MODID + ":blockHeliumCollector_FRONT");
- }
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int meta)
+ {
+ return new TileEntityHeliumGenerator();
+ }
+
+ @Override
+ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack item)
+ {
+ TileEntity tile = world.getTileEntity(x, y, z);
+ if(tile instanceof TileEntityHeliumGenerator) {
+ TileEntityHeliumGenerator machine = (TileEntityHeliumGenerator)tile;
+ int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
+
+ if (l == 0)
+ machine.setFacing((short) 2);
+
+ if (l == 1)
+ machine.setFacing((short) 5);
+
+ if (l == 2)
+ machine.setFacing((short) 3);
+
+ if (l == 3)
+ machine.setFacing((short) 4);
+ }
+
+ }
+
+ @Override
+ public void breakBlock(World world, int x, int y, int z, Block block, int wut)
+ {
+ TileEntityHeliumGenerator collector = (TileEntityHeliumGenerator)world.getTileEntity(x, y, z);
+
+ if (collector != null)
+ {
+ int i = 0;
+ for (i = 0; i < collector.getSizeInventory(); i++){
+
+ ItemStack itemstack = collector.getStackInSlot(i);
+
+ if (itemstack != null)
+ {
+ float f = this.randy.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.randy.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.randy.nextFloat() * 0.8F + 0.1F;
+
+ while (itemstack.stackSize > 0)
+ {
+ int j1 = this.randy.nextInt(21) + 10;
+
+ if (j1 > itemstack.stackSize)
+ {
+ j1 = itemstack.stackSize;
+ }
+
+ itemstack.stackSize -= j1;
+ EntityItem entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
+
+ if (itemstack.hasTagCompound())
+ {
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
+ }
+
+ float f3 = 0.05F;
+ entityitem.motionX = (double)((float)this.randy.nextGaussian() * f3);
+ entityitem.motionY = (double)((float)this.randy.nextGaussian() * f3 + 0.2F);
+ entityitem.motionZ = (double)((float)this.randy.nextGaussian() * f3);
+ world.spawnEntityInWorld(entityitem);
+ }
+ }
+
+ world.func_147453_f(x, y, z, block);
+ }
+ }
+
+ super.breakBlock(world, x, y, z, block, wut);
+ }
}
diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java
index a05eeeccbb..d701f6f125 100644
--- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java
+++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java
@@ -1,70 +1,75 @@
package gtPlusPlus.core.block.machine.heliumgen.container;
-import java.util.List;
-
import gtPlusPlus.core.block.machine.heliumgen.tileentity.TileEntityHeliumGenerator;
import ic2.core.ContainerBase;
import ic2.core.slot.SlotInvSlot;
+
+import java.util.List;
+
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotFurnace;
-public class ContainerHeliumGenerator extends ContainerBase<TileEntityHeliumGenerator> {
+public class ContainerHeliumGenerator
+extends ContainerBase<TileEntityHeliumGenerator>
+{
public short size;
- public ContainerHeliumGenerator(final InventoryPlayer player, final TileEntityHeliumGenerator machine) {
+ public ContainerHeliumGenerator(InventoryPlayer player, TileEntityHeliumGenerator machine)
+ {
super(machine);
- // Utils.LOG_WARNING("containerHeliumGenerator");
- final short sr = machine.getReactorSize();
+ //Utils.LOG_WARNING("containerHeliumGenerator");
+ short sr = machine.getReactorSize();
this.addSlotToContainer(new SlotFurnace(player.player, machine, 2, 80, 35));
this.size = sr;
int startX = 16;
int startY = 16;
int i = 0;
- for (i = 0; i < 9; i++) {
- final int x = i % this.size;
- final int y = i / this.size;
+ for (i = 0; i < 9; i++)
+ {
+ int x = i % this.size;
+ int y = i / this.size;
- this.addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y));
+ addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y));
}
startX = 108;
startY = 16;
- for (i = 9; i < 18; i++) {
- final int x = i % this.size;
- final int y = (i - 9) / this.size;
+ for (i = 9; i < 18; i++)
+ {
+ int x = i % this.size;
+ int y = (i-9) / this.size;
- this.addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y));
+ addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y));
}
- for (i = 0; i < 3; ++i) {
- for (int j = 0; j < 9; ++j) {
+ for (i = 0; i < 3; ++i)
+ {
+ for (int j = 0; j < 9; ++j)
+ {
this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
- for (i = 0; i < 9; ++i) {
+ for (i = 0; i < 9; ++i)
+ {
this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142));
}
- // addSlotToContainer(new SlotInvSlot(machine.coolantinputSlot, 0, 8,
- // 25));
- // addSlotToContainer(new SlotInvSlot(machine.hotcoolinputSlot, 0, 188,
- // 25));
- // addSlotToContainer(new SlotInvSlot(machine.coolantoutputSlot, 0, 8,
- // 115));
- // addSlotToContainer(new SlotInvSlot(machine.hotcoolantoutputSlot, 0,
- // 188, 115));
+ // addSlotToContainer(new SlotInvSlot(machine.coolantinputSlot, 0, 8, 25));
+ //addSlotToContainer(new SlotInvSlot(machine.hotcoolinputSlot, 0, 188, 25));
+ //addSlotToContainer(new SlotInvSlot(machine.coolantoutputSlot, 0, 8, 115));
+ //addSlotToContainer(new SlotInvSlot(machine.hotcoolantoutputSlot, 0, 188, 115));
}
@Override
- public List<String> getNetworkedFields() {
- final List<String> ret = super.getNetworkedFields();
+ public List<String> getNetworkedFields()
+ {
+ List<String> ret = super.getNetworkedFields();
ret.add("heat");
ret.add("maxHeat");
ret.add("EmitHeat");
- /*
- * ret.add("inputTank"); ret.add("outputTank");
- * ret.add("fluidcoolreactor");
- */
+ /*ret.add("inputTank");
+ ret.add("outputTank");
+ ret.add("fluidcoolreactor");*/
return ret;
- }
+ }
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java
index 707f1b8944..2106f144be 100644
--- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java
+++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java
@@ -1,9 +1,5 @@
package gtPlusPlus.core.block.machine.heliumgen.gui;
-import org.lwjgl.opengl.GL11;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.core.block.machine.heliumgen.container.ContainerHeliumGenerator;
import gtPlusPlus.core.block.machine.heliumgen.tileentity.TileEntityHeliumGenerator;
import gtPlusPlus.core.lib.CORE;
@@ -12,62 +8,65 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
-@SideOnly(Side.CLIENT)
-public class GUIHeliumGenerator extends GuiContainer {
- private static final ResourceLocation collectorGuiTexture = new ResourceLocation(CORE.MODID,
- "textures/gui/helium_collector_gui.png");
-
- public GUIHeliumGenerator(final InventoryPlayer player, final TileEntityHeliumGenerator machine) {
- super(new ContainerHeliumGenerator(player, machine));
- }
+import org.lwjgl.opengl.GL11;
- @Override
- protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_,
- final int p_146976_3_) {
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.getTextureManager().bindTexture(GUIHeliumGenerator.collectorGuiTexture);
- final int k = (this.width - this.xSize) / 2;
- final int l = (this.height - this.ySize) / 2;
- this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
- }
+@SideOnly(Side.CLIENT)
+public class GUIHeliumGenerator extends GuiContainer
+{
+ private static final ResourceLocation collectorGuiTexture = new ResourceLocation(CORE.MODID, "textures/gui/helium_collector_gui.png");
- /**
- * Draw the foreground layer for the GuiContainer (everything in front of
- * the items)
- */
- @Override
- protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
- final String s = StatCollector.translateToLocal("Helium Collector");
- this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
- this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2,
- 4210752);
+ public GUIHeliumGenerator(InventoryPlayer player, TileEntityHeliumGenerator machine)
+ {
+ super(new ContainerHeliumGenerator(player, machine));
+ }
- this.fontRendererObj.drawString(StatCollector.translateToLocal("|" + -1), 80, 35, 2);
+ /**
+ * Draw the foreground layer for the GuiContainer (everything in front of the items)
+ */
+ @Override
+ protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
+ {
+ String s = StatCollector.translateToLocal("Helium Collector");
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
+ this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
+
+ this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+-1), 80, 35, 2);
+
+ short sr = 3;
+ int size = sr;
+ int startX = 16;
+ int startY = 16;
+ int i = 0;
+ for (i = 0; i < 9; i++)
+ {
+ int x = i % size;
+ int y = i / size;
+ this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+i), startX + 18 * x, startY + 18 * y, 4210752);
+ //addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y));
+ }
+ startX = 108;
+ startY = 16;
+ for (i = 9; i < 18; i++)
+ {
+ int x = i % size;
+ int y = (i-9) / size;
+ this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+i), startX + 18 * x, startY + 18 * y, 4210752);
+ // addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y));
+ }
+
+ }
- final short sr = 3;
- final int size = sr;
- int startX = 16;
- int startY = 16;
- int i = 0;
- for (i = 0; i < 9; i++) {
- final int x = i % size;
- final int y = i / size;
- this.fontRendererObj.drawString(StatCollector.translateToLocal("|" + i), startX + 18 * x, startY + 18 * y,
- 4210752);
- // addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX
- // + 18 * x, startY + 18 * y));
- }
- startX = 108;
- startY = 16;
- for (i = 9; i < 18; i++) {
- final int x = i % size;
- final int y = (i - 9) / size;
- this.fontRendererObj.drawString(StatCollector.translateToLocal("|" + i), startX + 18 * x, startY + 18 * y,
- 4210752);
- // addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX
- // + 18 * x, startY + 18 * y));
- }
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
+ {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.getTextureManager().bindTexture(collectorGuiTexture);
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
- }
+ }
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/slots/InvSlotRadiation.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/slots/InvSlotRadiation.java
index b5eb8b7898..86507a2d64 100644
--- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/slots/InvSlotRadiation.java
+++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/slots/InvSlotRadiation.java
@@ -4,65 +4,75 @@ import gtPlusPlus.core.block.machine.heliumgen.tileentity.TileEntityHeliumGenera
import ic2.core.block.invslot.InvSlot;
import net.minecraft.item.ItemStack;
-public class InvSlotRadiation extends InvSlot {
- private final int rows = 6;
-
- private final int maxCols = 9;
-
- public InvSlotRadiation(final TileEntityHeliumGenerator base, final String name1, final int oldStartIndex1,
- final int count) {
+public class InvSlotRadiation extends InvSlot
+{
+ public InvSlotRadiation(TileEntityHeliumGenerator base, String name1, int oldStartIndex1, int count)
+ {
super(base, name1, oldStartIndex1, InvSlot.Access.IO, count);
- this.setStackSizeLimit(1);
+ setStackSizeLimit(1);
}
@Override
- public boolean accepts(final ItemStack itemStack) {
- return ((TileEntityHeliumGenerator) this.base).isUsefulItem(itemStack, true);
+ public boolean accepts(ItemStack itemStack)
+ {
+ return ((TileEntityHeliumGenerator)this.base).isUsefulItem(itemStack, true);
}
@Override
- public ItemStack get(final int index) {
- return super.get(this.mapIndex(index));
+ public int size()
+ {
+ //Utils.LOG_INFO("InvSlotRadiation/Size");
+ return 3 * 6;
}
- public ItemStack get(final int x, final int y) {
+ public int rawSize()
+ {
+ return super.size();
+ }
+
+ @Override
+ public ItemStack get(int index)
+ {
+ return super.get(mapIndex(index));
+ }
+
+ public ItemStack get(int x, int y)
+ {
return super.get(y * 9 + x);
}
- private int mapIndex(int index) {
- final int size = this.size();
- final int cols = size / 6;
- if (index < size) {
- final int row = index / cols;
- final int col = index % cols;
+ @Override
+ public void put(int index, ItemStack content)
+ {
+ super.put(mapIndex(index), content);
+ }
+
+ public void put(int x, int y, ItemStack content)
+ {
+ super.put(y * 9 + x, content);
+ }
+
+ private int mapIndex(int index)
+ {
+ int size = size();
+ int cols = size / 6;
+ if (index < size)
+ {
+ int row = index / cols;
+ int col = index % cols;
return row * 9 + col;
}
index -= size;
- final int remCols = 9 - cols;
+ int remCols = 9 - cols;
- final int row = index / remCols;
- final int col = cols + index % remCols;
+ int row = index / remCols;
+ int col = cols + index % remCols;
return row * 9 + col;
}
- public void put(final int x, final int y, final ItemStack content) {
- super.put(y * 9 + x, content);
- }
-
- @Override
- public void put(final int index, final ItemStack content) {
- super.put(this.mapIndex(index), content);
- }
-
- public int rawSize() {
- return super.size();
- }
- @Override
- public int size() {
- // Utils.LOG_INFO("InvSlotRadiation/Size");
- return 3 * 6;
- }
+ private final int rows = 6;
+ private final int maxCols = 9;
}
diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java
index 16c66d6802..5ffd70efc4 100644
--- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java
+++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java
@@ -1,7 +1,5 @@
package gtPlusPlus.core.block.machine.heliumgen.tileentity;
-import java.util.List;
-
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.block.machine.heliumgen.slots.InvSlotRadiation;
import gtPlusPlus.core.item.ModItems;
@@ -11,11 +9,17 @@ import ic2.api.Direction;
import ic2.api.reactor.IReactor;
import ic2.api.reactor.IReactorComponent;
import ic2.api.tile.IWrenchable;
-import ic2.core.*;
+import ic2.core.IC2;
+import ic2.core.IC2DamageSource;
+import ic2.core.Ic2Items;
import ic2.core.block.TileEntityInventory;
import ic2.core.init.MainConfig;
import ic2.core.item.reactor.ItemReactorHeatStorage;
+import ic2.core.network.NetworkManager;
import ic2.core.util.ConfigUtil;
+
+import java.util.List;
+
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
@@ -35,386 +39,433 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
-public class TileEntityHeliumGenerator extends TileEntityInventory implements IInventory, IReactor, IWrenchable {
-
- private ItemStack heliumStack;
- private int facing = 2;
- private int progress;
-
- public Block[][][] surroundings = new Block[5][5][5];
-
- public final InvSlotRadiation reactorSlot;
-
- public float output = 0.0F;
-
- /*
- * @Override public void readCustomNBT(NBTTagCompound tag) {
- * this.heliumStack =
- * ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Helium"));
- * this.progress = tag.getInteger("Progress"); this.facing =
- * tag.getShort("Facing"); this.heat = tag.getInteger("heat");
- * this.prevActive = (this.active = tag.getBoolean("active")); }
- *
- * @Override public void writeCustomNBT(NBTTagCompound tag) {
- * tag.setInteger("Progress", this.progress); tag.setShort("Facing", (short)
- * this.facing); tag.setInteger("heat", this.heat); tag.setBoolean("active",
- * this.active); if(heliumStack != null) { NBTTagCompound produce = new
- * NBTTagCompound(); heliumStack.writeToNBT(produce); tag.setTag("Helium",
- * produce); } else tag.removeTag("Helium"); }
- */
-
- public int updateTicker;
-
- public int heat = 5000;
+public class TileEntityHeliumGenerator extends TileEntityInventory implements IInventory ,IReactor, IWrenchable {
- public int maxHeat = 100000;
+ private ItemStack heliumStack;
+ private int facing = 2;
+ private int progress;
- public float hem = 1.0F;
+
+ public void update2Entity(){
+ Utils.LOG_WARNING("updateEntity");
+ if(++progress >= 40){
+ //if(++progress >= 300){
+ if(heliumStack == null)
+ heliumStack = ItemUtils.getSimpleStack(ModItems.itemHeliumBlob);
+ else if(heliumStack.getItem() == ModItems.itemHeliumBlob && heliumStack.stackSize < 64)
+ heliumStack.stackSize++;
+ progress = 0;
+ markDirty();
+ }
+ }
- private int EmitHeatbuffer = 0;
+ @Override
+ public short getFacing(){
+ return (short) facing;
+ }
- public int EmitHeat = 0;
+ @Override
+ public void setFacing(short dir){
+ facing = dir;
+ }
- private boolean redstone = false;
+ /*@Override
+ public void readCustomNBT(NBTTagCompound tag)
+ {
+ this.heliumStack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Helium"));
+ this.progress = tag.getInteger("Progress");
+ this.facing = tag.getShort("Facing");
+ this.heat = tag.getInteger("heat");
+ this.prevActive = (this.active = tag.getBoolean("active"));
+ }
- private final boolean fluidcoolreactor = false;
+ @Override
+ public void writeCustomNBT(NBTTagCompound tag)
+ {
+ tag.setInteger("Progress", this.progress);
+ tag.setShort("Facing", (short) this.facing);
+ tag.setInteger("heat", this.heat);
+ tag.setBoolean("active", this.active);
+ if(heliumStack != null) {
+ NBTTagCompound produce = new NBTTagCompound();
+ heliumStack.writeToNBT(produce);
+ tag.setTag("Helium", produce);
+ }
+ else
+ tag.removeTag("Helium");
+ }*/
- private boolean active = true;
- public boolean prevActive = false;
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
- public TileEntityHeliumGenerator() {
- this.updateTicker = IC2.random.nextInt(this.getTickRate());
- this.reactorSlot = new InvSlotRadiation(this, "helium_collector", 0, 54); // TODO
+ //this.heliumStack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("Helium"));
+ NBTTagList list = nbttagcompound.getTagList("Items", 10);
+ for (int i = 0; i < list.tagCount(); ++i) {
+ NBTTagCompound stackTag = list.getCompoundTagAt(i);
+ int slot = stackTag.getByte("Slot") & 255;
+ this.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(stackTag));
+ }
+ this.progress = nbttagcompound.getInteger("Progress");
+ this.facing = nbttagcompound.getShort("Facing");
+ this.heat = nbttagcompound.getInteger("heat");
+ this.output = nbttagcompound.getShort("output");
+ this.prevActive = (this.active = nbttagcompound.getBoolean("active"));
}
@Override
- public void addEmitHeat(final int heat) {
- this.EmitHeatbuffer += heat;
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+
+ nbttagcompound.setInteger("Progress", this.progress);
+ nbttagcompound.setShort("Facing", (short) this.facing);
+ nbttagcompound.setInteger("heat", this.heat);
+ nbttagcompound.setShort("output", (short)(int)getReactorEnergyOutput());
+ nbttagcompound.setBoolean("active", this.active);
+ /*if(heliumStack != null) {
+ NBTTagCompound produce = new NBTTagCompound();
+ heliumStack.writeToNBT(produce);
+ nbttagcompound.setTag("Helium", produce);
+ }
+ else
+ nbttagcompound.removeTag("Helium");*/
+ NBTTagList list = new NBTTagList();
+ for (int i = 0; i < this.getSizeInventory(); ++i) {
+ if (this.getStackInSlot(i) != null) {
+ NBTTagCompound stackTag = new NBTTagCompound();
+ stackTag.setByte("Slot", (byte) i);
+ this.getStackInSlot(i).writeToNBT(stackTag);
+ list.appendTag(stackTag);
+ }
+ }
+ nbttagcompound.setTag("Items", list);
}
+
@Override
- public int addHeat(final int amount) {
- this.heat += amount;
- return this.heat;
+ public Packet getDescriptionPacket() {
+ NBTTagCompound tag = new NBTTagCompound();
+ writeToNBT(tag);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, tag);
}
@Override
- public float addOutput(final float energy) {
- return this.output += energy;
+ public void onDataPacket(net.minecraft.network.NetworkManager net, S35PacketUpdateTileEntity packet) {
+ super.onDataPacket(net, packet);
+ readFromNBT(packet.func_148857_g());
}
- public boolean calculateHeatEffects() {
- Utils.LOG_WARNING("calculateHeatEffects");
- if (this.heat < 8000 || !IC2.platform.isSimulating()
- || ConfigUtil.getFloat(MainConfig.get(), "protection/reactorExplosionPowerLimit") <= 0.0F) {
- return false;
- }
- final float power = this.heat / this.maxHeat;
- if (power >= 1.0F) {
- this.explode();
- return true;
- }
- if (power >= 0.85F && this.worldObj.rand.nextFloat() <= 0.2F * this.hem) {
- final int[] coord = this.getRandCoord(2);
- if (coord != null) {
- final Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]);
- if (block.isAir(this.worldObj, coord[0], coord[1], coord[2])) {
- this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7);
- }
- else if (block.getBlockHardness(this.worldObj, coord[0], coord[1], coord[2]) >= 0.0F
- && this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null) {
- final Material mat = block.getMaterial();
- if (mat == Material.rock || mat == Material.iron || mat == Material.lava || mat == Material.ground
- || mat == Material.clay) {
- this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.flowing_lava, 15, 7);
- }
- else {
- this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7);
- }
- }
- }
- }
- if (power >= 0.7F) {
- final List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class,
- AxisAlignedBB.getBoundingBox(this.xCoord - 3, this.yCoord - 3, this.zCoord - 3, this.xCoord + 4,
- this.yCoord + 4, this.zCoord + 4));
- for (int l = 0; l < list1.size(); l++) {
- final Entity ent = (Entity) list1.get(l);
- ent.attackEntityFrom(IC2DamageSource.radiation, (int) (this.worldObj.rand.nextInt(4) * this.hem));
- }
- }
- if (power >= 0.5F && this.worldObj.rand.nextFloat() <= this.hem) {
- final int[] coord = this.getRandCoord(2);
- if (coord != null) {
- final Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]);
- if (block.getMaterial() == Material.water) {
- this.worldObj.setBlockToAir(coord[0], coord[1], coord[2]);
- }
- }
- }
- if (power >= 0.4F && this.worldObj.rand.nextFloat() <= this.hem) {
- final int[] coord = this.getRandCoord(2);
- if (coord != null && this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null) {
- final Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]);
- final Material mat = block.getMaterial();
- if (mat == Material.wood || mat == Material.leaves || mat == Material.cloth) {
- this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7);
- }
- }
- }
- return false;
- }
@Override
- public void closeInventory() {
+ public int getSizeInventory()
+ {
+ return 19;
}
- // IC2 Nuclear Code
+ @Override
+ public ItemStack getStackInSlot(int slot){
+ return heliumStack;
+ }
@Override
- public ItemStack decrStackSize(final int slot, final int decrement) {
+ public ItemStack decrStackSize(int slot, int decrement){
Utils.LOG_WARNING("decrStackSize");
- if (this.heliumStack == null) {
+ if(heliumStack == null)
return null;
- }
- if (decrement < this.heliumStack.stackSize) {
- final ItemStack take = this.heliumStack.splitStack(decrement);
- if (this.heliumStack.stackSize <= 0) {
- this.heliumStack = null;
- }
+ if(decrement < heliumStack.stackSize){
+ ItemStack take = heliumStack.splitStack(decrement);
+ if(heliumStack.stackSize <= 0)
+ heliumStack = null;
return take;
}
- final ItemStack take = this.heliumStack;
- this.heliumStack = null;
+ ItemStack take = heliumStack;
+ heliumStack = null;
return take;
}
- public void dropAllUnfittingStuff() {
- Utils.LOG_WARNING("dropAllUnfittingStuff");
- for (int i = 0; i < this.reactorSlot.size(); i++) {
- final ItemStack stack = this.reactorSlot.get(i);
- if (stack != null && !this.isUsefulItem(stack, false)) {
- this.reactorSlot.put(i, null);
- this.eject(stack);
- }
- }
- for (int i = this.reactorSlot.size(); i < this.reactorSlot.rawSize(); i++) {
- final ItemStack stack = this.reactorSlot.get(i);
- this.reactorSlot.put(i, null);
- this.eject(stack);
- }
- }
- public void eject(final ItemStack drop) {
- Utils.LOG_WARNING("eject");
- if (!IC2.platform.isSimulating() || drop == null) {
- return;
- }
- final float f = 0.7F;
- final double d = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D;
- final double d1 = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D;
- final double d2 = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D;
- final EntityItem entityitem = new EntityItem(this.worldObj, this.xCoord + d, this.yCoord + d1, this.zCoord + d2,
- drop);
- entityitem.delayBeforeCanPickup = 10;
- this.worldObj.spawnEntityInWorld(entityitem);
- }
@Override
- public void explode() {
- Utils.LOG_WARNING("Explosion");
- // TODO
+ public void openInventory() {}
+ @Override
+ public void closeInventory() {}
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer player)
+ {
+ return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) == this && player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D;
}
+
@Override
- public Packet getDescriptionPacket() {
- final NBTTagCompound tag = new NBTTagCompound();
- this.writeToNBT(tag);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, -999, tag);
+ public boolean isItemValidForSlot(int slot, ItemStack stack){
+ return false;
}
+
@Override
- public short getFacing() {
- return (short) this.facing;
+ public int getInventoryStackLimit(){
+ return 64;
}
+
@Override
- public int getHeat() {
- return this.heat;
+ public void setInventorySlotContents(int slot, ItemStack stack){
+ heliumStack = stack;
}
+
@Override
- public float getHeatEffectModifier() {
- return this.hem;
+ public ItemStack getStackInSlotOnClosing(int slot){
+ return null;
}
+
/**
* Returns the name of the inventory
*/
@Override
- public String getInventoryName() {
- // return "container.helium_collector";
- return "container.helium_collector";
- }
- @Override
- public int getInventoryStackLimit() {
- return 64;
- }
- @Override
- public ItemStack getItemAt(final int x, final int y) {
- Utils.LOG_WARNING("getItemAt");
- if (x < 0 || x >= this.getReactorSize() || y < 0 || y >= 6) {
- return null;
- }
- return this.reactorSlot.get(x, y);
- }
- @Override
- public int getMaxHeat() {
- return this.maxHeat;
- }
- public double getOfferedEnergy() {
- return this.getReactorEnergyOutput() * 5.0F * 1.0F;
+ public String getInventoryName()
+ {
+ //return "container.helium_collector";
+ return "container.helium_collector";
}
+ /**
+ * Returns if the inventory is named
+ */
@Override
- public ChunkCoordinates getPosition() {
- return new ChunkCoordinates(this.xCoord, this.yCoord, this.zCoord);
+ public boolean hasCustomInventoryName()
+ {
+ return false;
}
- public int[] getRandCoord(final int radius) {
- if (radius <= 0) {
- return null;
- }
- final int[] c = new int[3];
- c[0] = this.xCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius;
- c[1] = this.yCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius;
- c[2] = this.zCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius;
- if (c[0] == this.xCoord && c[1] == this.yCoord && c[2] == this.zCoord) {
- return null;
- }
- return c;
- }
+ //IC2 Nuclear Code
- @Override
- public float getReactorEnergyOutput() {
- return this.output;
- }
- @Override
- public double getReactorEUEnergyOutput() {
- return this.getOfferedEnergy();
- }
+ public Block[][][] surroundings = new Block[5][5][5];
+ public final InvSlotRadiation reactorSlot;
+ public float output = 0.0F;
+ public int updateTicker;
+ public int heat = 5000;
+ public int maxHeat = 100000;
+ public float hem = 1.0F;
+ private int EmitHeatbuffer = 0;
+ public int EmitHeat = 0;
+ private boolean redstone = false;
+ private boolean fluidcoolreactor = false;
+ private boolean active = true;
+ public boolean prevActive = false;
- public short getReactorSize() {
- // Utils.LOG_WARNING("getReactorSize");
+
+ public short getReactorSize()
+ {
+ //Utils.LOG_WARNING("getReactorSize");
if (this.worldObj == null) {
Utils.LOG_WARNING("getReactorSize == 9");
return 9;
}
short cols = 3;
- // Utils.LOG_WARNING("getReactorSize == "+cols);
- for (final Direction direction : Direction.directions) {
- final TileEntity target = direction.applyToTileEntity(this);
- if (target instanceof TileEntityHeliumGenerator) {
- cols = (short) (cols + 1);
- Utils.LOG_WARNING("getReactorSize =1= " + cols);
+ //Utils.LOG_WARNING("getReactorSize == "+cols);
+ for (Direction direction : Direction.directions)
+ {
+ TileEntity target = direction.applyToTileEntity(this);
+ if ((target instanceof TileEntityHeliumGenerator)) {
+ cols = (short)(cols + 1);
+ Utils.LOG_WARNING("getReactorSize =1= "+cols);
}
}
- // Utils.LOG_WARNING("getReactorSize == "+cols);
+ //Utils.LOG_WARNING("getReactorSize == "+cols);
return cols;
}
- @Override
- public int getSizeInventory() {
- return 19;
- }
-
- @Override
- public ItemStack getStackInSlot(final int slot) {
- return this.heliumStack;
- }
+ protected void updateEntityServer()
+ {
+ Utils.LOG_WARNING("updateEntityServer");
+ super.updateEntity();
- @Override
- public ItemStack getStackInSlotOnClosing(final int slot) {
- return null;
- }
+ if (this.updateTicker++ % getTickRate() != 0) {
+ return;
+ }
+ if (!this.worldObj.doChunksNearChunkExist(this.xCoord, this.yCoord, this.zCoord, 2))
+ {
+ this.output = 0.0F;
+ }
+ else
+ {
- @Override
- public int getTickRate() {
- return 20;
- }
+ dropAllUnfittingStuff();
- @Override
- public World getWorld() {
- return this.worldObj;
- }
+ this.output = 0.0F;
+ this.maxHeat = 10000;
+ this.hem = 1.0F;
- @Override
- public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
- return new ItemStack(ModBlocks.blockHeliumGenerator, 1);
- }
+ processChambers();
+ this.EmitHeatbuffer = 0;
+ if (calculateHeatEffects()) {
+ return;
+ }
+ setActive((this.heat >= 1000) || (this.output > 0.0F));
- @Override
- public float getWrenchDropRate() {
- return 1F;
+ markDirty();
+ }
+ ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "output");
}
- /**
- * Returns if the inventory is named
- */
@Override
- public boolean hasCustomInventoryName() {
- return false;
+ public void setActive(boolean active1)
+ {
+ Utils.LOG_WARNING("setActive");
+ this.active = active1;
+ if (this.prevActive != active1) {
+ ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "active");
+ }
+ this.prevActive = active1;
}
- @Override
- public boolean isFluidCooled() {
- Utils.LOG_WARNING("isFluidCooled");
- return false;
- }
+ public void dropAllUnfittingStuff()
+ {
+ Utils.LOG_WARNING("dropAllUnfittingStuff");
+ for (int i = 0; i < this.reactorSlot.size(); i++)
+ {
+ ItemStack stack = this.reactorSlot.get(i);
+ if ((stack != null) && (!isUsefulItem(stack, false)))
+ {
+ this.reactorSlot.put(i, null);
+ eject(stack);
+ }
+ }
+ for (int i = this.reactorSlot.size(); i < this.reactorSlot.rawSize(); i++)
+ {
+ ItemStack stack = this.reactorSlot.get(i);
- @Override
- public boolean isItemValidForSlot(final int slot, final ItemStack stack) {
- return false;
+ this.reactorSlot.put(i, null);
+ eject(stack);
+ }
}
- @Override
- public boolean isUseableByPlayer(final EntityPlayer player) {
- return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) == this
- && player.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D;
+ public void eject(ItemStack drop)
+ {
+ Utils.LOG_WARNING("eject");
+ if ((!IC2.platform.isSimulating()) || (drop == null)) {
+ return;
+ }
+ float f = 0.7F;
+ double d = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D;
+ double d1 = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D;
+ double d2 = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D;
+ EntityItem entityitem = new EntityItem(this.worldObj, this.xCoord + d, this.yCoord + d1, this.zCoord + d2, drop);
+ entityitem.delayBeforeCanPickup = 10;
+ this.worldObj.spawnEntityInWorld(entityitem);
}
- public boolean isUsefulItem(final ItemStack stack, final boolean forInsertion) {
- // Utils.LOG_WARNING("isUsefulItem");
- final Item item = stack.getItem();
- if (forInsertion && this.fluidcoolreactor && item instanceof ItemReactorHeatStorage
- && ((ItemReactorHeatStorage) item).getCustomDamage(stack) > 0) {
+ public boolean isUsefulItem(ItemStack stack, boolean forInsertion)
+ {
+ //Utils.LOG_WARNING("isUsefulItem");
+ Item item = stack.getItem();
+ if ((forInsertion) && (this.fluidcoolreactor) &&
+ ((item instanceof ItemReactorHeatStorage)) &&
+ (((ItemReactorHeatStorage)item).getCustomDamage(stack) > 0)) {
return false;
}
- if (item instanceof IReactorComponent) {
+ if ((item instanceof IReactorComponent)) {
return true;
}
- return item == Ic2Items.TritiumCell.getItem() || item == Ic2Items.reactorDepletedUraniumSimple.getItem()
- || item == Ic2Items.reactorDepletedUraniumDual.getItem()
- || item == Ic2Items.reactorDepletedUraniumQuad.getItem()
- || item == Ic2Items.reactorDepletedMOXSimple.getItem()
- || item == Ic2Items.reactorDepletedMOXDual.getItem()
- || item == Ic2Items.reactorDepletedMOXQuad.getItem();
+ return (item == Ic2Items.TritiumCell.getItem()) || (item == Ic2Items.reactorDepletedUraniumSimple.getItem()) || (item == Ic2Items.reactorDepletedUraniumDual.getItem()) || (item == Ic2Items.reactorDepletedUraniumQuad.getItem()) || (item == Ic2Items.reactorDepletedMOXSimple.getItem()) || (item == Ic2Items.reactorDepletedMOXDual.getItem()) || (item == Ic2Items.reactorDepletedMOXQuad.getItem());
}
- @Override
- public void onDataPacket(final net.minecraft.network.NetworkManager net, final S35PacketUpdateTileEntity packet) {
- super.onDataPacket(net, packet);
- this.readFromNBT(packet.func_148857_g());
+ public boolean calculateHeatEffects()
+ {
+ Utils.LOG_WARNING("calculateHeatEffects");
+ if ((this.heat < 8000) || (!IC2.platform.isSimulating()) || (ConfigUtil.getFloat(MainConfig.get(), "protection/reactorExplosionPowerLimit") <= 0.0F)) {
+ return false;
+ }
+ float power = this.heat / this.maxHeat;
+ if (power >= 1.0F)
+ {
+ explode();
+ return true;
+ }
+ if ((power >= 0.85F) && (this.worldObj.rand.nextFloat() <= 0.2F * this.hem))
+ {
+ int[] coord = getRandCoord(2);
+ if (coord != null)
+ {
+ Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]);
+ if (block.isAir(this.worldObj, coord[0], coord[1], coord[2]))
+ {
+ this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7);
+ }
+ else if ((block.getBlockHardness(this.worldObj, coord[0], coord[1], coord[2]) >= 0.0F) && (this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null))
+ {
+ Material mat = block.getMaterial();
+ if ((mat == Material.rock) || (mat == Material.iron) || (mat == Material.lava) || (mat == Material.ground) || (mat == Material.clay)) {
+ this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.flowing_lava, 15, 7);
+ } else {
+ this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7);
+ }
+ }
+ }
+ }
+ if (power >= 0.7F)
+ {
+ List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(this.xCoord - 3, this.yCoord - 3, this.zCoord - 3, this.xCoord + 4, this.yCoord + 4, this.zCoord + 4));
+ for (int l = 0; l < list1.size(); l++)
+ {
+ Entity ent = (Entity)list1.get(l);
+ ent.attackEntityFrom(IC2DamageSource.radiation, (int)(this.worldObj.rand.nextInt(4) * this.hem));
+ }
+ }
+ if ((power >= 0.5F) && (this.worldObj.rand.nextFloat() <= this.hem))
+ {
+ int[] coord = getRandCoord(2);
+ if (coord != null)
+ {
+ Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]);
+ if (block.getMaterial() == Material.water) {
+ this.worldObj.setBlockToAir(coord[0], coord[1], coord[2]);
+ }
+ }
+ }
+ if ((power >= 0.4F) && (this.worldObj.rand.nextFloat() <= this.hem))
+ {
+ int[] coord = getRandCoord(2);
+ if ((coord != null) &&
+ (this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null))
+ {
+ Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]);
+ Material mat = block.getMaterial();
+ if ((mat == Material.wood) || (mat == Material.leaves) || (mat == Material.cloth)) {
+ this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7);
+ }
+ }
+ }
+ return false;
}
- @Override
- public void openInventory() {
+ public int[] getRandCoord(int radius)
+ {
+ if (radius <= 0) {
+ return null;
+ }
+ int[] c = new int[3];
+ c[0] = (this.xCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius);
+ c[1] = (this.yCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius);
+ c[2] = (this.zCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius);
+ if ((c[0] == this.xCoord) && (c[1] == this.yCoord) && (c[2] == this.zCoord)) {
+ return null;
+ }
+ return c;
}
- public void processChambers() {
+ public void processChambers()
+ {
Utils.LOG_WARNING("processChambers");
- final int size = this.getReactorSize();
+ int size = getReactorSize();
for (int pass = 0; pass < 6; pass++) {
for (int y = 0; y < 3; y++) {
- for (int x = 0; x < size; x++) {
- final ItemStack stack = this.reactorSlot.get(x, y);
- if (stack != null && stack.getItem() instanceof IReactorComponent) {
- final IReactorComponent comp = (IReactorComponent) stack.getItem();
+ for (int x = 0; x < size; x++)
+ {
+ ItemStack stack = this.reactorSlot.get(x, y);
+ if ((stack != null) && ((stack.getItem() instanceof IReactorComponent)))
+ {
+ IReactorComponent comp = (IReactorComponent)stack.getItem();
comp.processChamber(this, stack, x, y, pass == 0);
}
}
@@ -423,170 +474,175 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
}
@Override
- public boolean produceEnergy() {
- Utils.LOG_WARNING("produceEnergy");
- return this.receiveredstone()
- && ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/generator") > 0.0F;
+ public ChunkCoordinates getPosition()
+ {
+ return new ChunkCoordinates(this.xCoord, this.yCoord, this.zCoord);
}
@Override
- public void readFromNBT(final NBTTagCompound nbttagcompound) {
- super.readFromNBT(nbttagcompound);
+ public World getWorld() {
+ return this.worldObj;
+ }
- // this.heliumStack =
- // ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("Helium"));
- final NBTTagList list = nbttagcompound.getTagList("Items", 10);
- for (int i = 0; i < list.tagCount(); ++i) {
- final NBTTagCompound stackTag = list.getCompoundTagAt(i);
- final int slot = stackTag.getByte("Slot") & 255;
- this.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(stackTag));
- }
- this.progress = nbttagcompound.getInteger("Progress");
- this.facing = nbttagcompound.getShort("Facing");
- this.heat = nbttagcompound.getInteger("heat");
- this.output = nbttagcompound.getShort("output");
- this.prevActive = this.active = nbttagcompound.getBoolean("active");
+ @Override
+ public int getHeat() {
+ return this.heat;
}
- public boolean receiveredstone() {
- Utils.LOG_WARNING("receiveRedstone");
- if (this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord) || this.redstone) {
- this.decrStackSize(-1, 1);
- return true;
- }
- return false;
+ @Override
+ public void setHeat(int heat1)
+ {
+ this.heat = heat1;
}
@Override
- public void setActive(final boolean active1) {
- Utils.LOG_WARNING("setActive");
- this.active = active1;
- if (this.prevActive != active1) {
- IC2.network.get().updateTileEntityField(this, "active");
- }
- this.prevActive = active1;
+ public int addHeat(int amount)
+ {
+ this.heat += amount;
+ return this.heat;
}
@Override
- public void setFacing(final short dir) {
- this.facing = dir;
+ public int getMaxHeat()
+ {
+ return this.maxHeat;
}
@Override
- public void setHeat(final int heat1) {
- this.heat = heat1;
+ public void setMaxHeat(int newMaxHeat)
+ {
+ this.maxHeat = newMaxHeat;
}
@Override
- public void setHeatEffectModifier(final float newHEM) {
- this.hem = newHEM;
+ public void addEmitHeat(int heat)
+ {
+ this.EmitHeatbuffer += heat;
}
@Override
- public void setInventorySlotContents(final int slot, final ItemStack stack) {
- this.heliumStack = stack;
+ public float getHeatEffectModifier()
+ {
+ return this.hem;
}
@Override
- public void setItemAt(final int x, final int y, final ItemStack item) {
- Utils.LOG_WARNING("setItemAt");
- if (x < 0 || x >= this.getReactorSize() || y < 0 || y >= 6) {
- return;
- }
- this.reactorSlot.put(x, y, item);
+ public void setHeatEffectModifier(float newHEM)
+ {
+ this.hem = newHEM;
}
@Override
- public void setMaxHeat(final int newMaxHeat) {
- this.maxHeat = newMaxHeat;
+ public float getReactorEnergyOutput()
+ {
+ return this.output;
}
@Override
- public void setRedstoneSignal(final boolean redstone) {
- this.redstone = redstone;
+ public double getReactorEUEnergyOutput()
+ {
+ return getOfferedEnergy();
}
- public void update2Entity() {
- Utils.LOG_WARNING("updateEntity");
- if (++this.progress >= 40) {
- // if(++progress >= 300){
- if (this.heliumStack == null) {
- this.heliumStack = ItemUtils.getSimpleStack(ModItems.itemHeliumBlob);
- }
- else if (this.heliumStack.getItem() == ModItems.itemHeliumBlob && this.heliumStack.stackSize < 64) {
- this.heliumStack.stackSize++;
- }
- this.progress = 0;
- this.markDirty();
- }
+ public double getOfferedEnergy()
+ {
+ return getReactorEnergyOutput() * 5.0F * 1.0F;
}
@Override
- protected void updateEntityServer() {
- Utils.LOG_WARNING("updateEntityServer");
- super.updateEntity();
+ public float addOutput(float energy)
+ {
+ return this.output += energy;
+ }
- if (this.updateTicker++ % this.getTickRate() != 0) {
- return;
+ @Override
+ public ItemStack getItemAt(int x, int y)
+ {
+ Utils.LOG_WARNING("getItemAt");
+ if ((x < 0) || (x >= getReactorSize()) || (y < 0) || (y >= 6)) {
+ return null;
}
- if (!this.worldObj.doChunksNearChunkExist(this.xCoord, this.yCoord, this.zCoord, 2)) {
- this.output = 0.0F;
+ return this.reactorSlot.get(x, y);
+ }
+
+ @Override
+ public void setItemAt(int x, int y, ItemStack item)
+ {
+ Utils.LOG_WARNING("setItemAt");
+ if ((x < 0) || (x >= getReactorSize()) || (y < 0) || (y >= 6)) {
+ return;
}
- else {
+ this.reactorSlot.put(x, y, item);
+ }
- this.dropAllUnfittingStuff();
+ public TileEntityHeliumGenerator() {
+ this.updateTicker = IC2.random.nextInt(getTickRate());
+ this.reactorSlot = new InvSlotRadiation(this, "helium_collector", 0, 54); //TODO
+ }
- this.output = 0.0F;
- this.maxHeat = 10000;
- this.hem = 1.0F;
+ @Override
+ public void explode() {
+ Utils.LOG_WARNING("Explosion");
+ //TODO
+ }
- this.processChambers();
- this.EmitHeatbuffer = 0;
- if (this.calculateHeatEffects()) {
- return;
- }
- this.setActive(this.heat >= 1000 || this.output > 0.0F);
+ @Override
+ public int getTickRate()
+ {
+ return 20;
+ }
- this.markDirty();
+ public boolean receiveredstone()
+ {
+ Utils.LOG_WARNING("receiveRedstone");
+ if ((this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord)) || (this.redstone)) {
+ decrStackSize(-1, 1);
+ return true;
}
- IC2.network.get().updateTileEntityField(this, "output");
+ return false;
+ }
+
+ @Override
+ public boolean produceEnergy()
+ {
+ Utils.LOG_WARNING("produceEnergy");
+ return (receiveredstone()) && (ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/generator") > 0.0F);
}
@Override
- public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
+ public void setRedstoneSignal(boolean redstone)
+ {
+ this.redstone = redstone;
+ }
+
+ @Override
+ public boolean isFluidCooled() {
+ Utils.LOG_WARNING("isFluidCooled");
+ return false;
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)
+ {
return true;
}
@Override
- public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final int side) {
+ public boolean wrenchCanRemove(EntityPlayer entityPlayer)
+ {
return true;
}
@Override
- public void writeToNBT(final NBTTagCompound nbttagcompound) {
- super.writeToNBT(nbttagcompound);
+ public float getWrenchDropRate()
+ {
+ return 1F;
+ }
- nbttagcompound.setInteger("Progress", this.progress);
- nbttagcompound.setShort("Facing", (short) this.facing);
- nbttagcompound.setInteger("heat", this.heat);
- nbttagcompound.setShort("output", (short) (int) this.getReactorEnergyOutput());
- nbttagcompound.setBoolean("active", this.active);
- /*
- * if(heliumStack != null) { NBTTagCompound produce = new
- * NBTTagCompound(); heliumStack.writeToNBT(produce);
- * nbttagcompound.setTag("Helium", produce); } else
- * nbttagcompound.removeTag("Helium");
- */
- final NBTTagList list = new NBTTagList();
- for (int i = 0; i < this.getSizeInventory(); ++i) {
- if (this.getStackInSlot(i) != null) {
- final NBTTagCompound stackTag = new NBTTagCompound();
- stackTag.setByte("Slot", (byte) i);
- this.getStackInSlot(i).writeToNBT(stackTag);
- list.appendTag(stackTag);
- }
- }
- nbttagcompound.setTag("Items", list);
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
+ {
+ return new ItemStack(ModBlocks.blockHeliumGenerator, 1);
}
}