From 0669f5eb9d5029a8b94ec552171b0837605f7747 Mon Sep 17 00:00:00 2001 From: draknyte1 Date: Fri, 4 Nov 2016 15:23:26 +1000 Subject: $ Cleaned up the entire project. > Much neat, very nices. --- src/Java/gtPlusPlus/core/block/ModBlocks.java | 53 +- .../gtPlusPlus/core/block/base/AdvancedBlock.java | 38 +- .../gtPlusPlus/core/block/base/BasicBlock.java | 80 +- .../core/block/base/BlockBaseModular.java | 188 +-- src/Java/gtPlusPlus/core/block/base/MetaBlock.java | 36 +- .../core/block/base/MultiTextureBlock.java | 47 +- .../gtPlusPlus/core/block/general/LightGlass.java | 143 +- .../core/block/general/antigrief/TowerDevice.java | 478 +++--- .../general/fluids/BlockFluidJackDaniels.java | 74 +- .../core/block/machine/BlockGtFrameBox.java | 33 +- .../core/block/machine/Machine_Charger.java | 126 +- .../gtPlusPlus/core/block/machine/Machine_NHG.java | 126 +- .../core/block/machine/Machine_WireiusDeletus.java | 3 +- .../core/block/machine/Machine_Workbench.java | 121 +- .../block/machine/Machine_WorkbenchAdvanced.java | 82 +- .../machine/heliumgen/block/HeliumGenerator.java | 270 ++-- .../container/ContainerHeliumGenerator.java | 64 +- .../machine/heliumgen/gui/GUIHeliumGenerator.java | 104 +- .../machine/heliumgen/slots/InvSlotRadiation.java | 88 +- .../tileentity/TileEntityHeliumGenerator.java | 845 +++++----- src/Java/gtPlusPlus/core/commands/CommandMath.java | 230 ++- .../gtPlusPlus/core/commands/CommandUtils.java | 8 +- src/Java/gtPlusPlus/core/common/CommonProxy.java | 123 +- .../core/common/compat/COMPAT_Baubles.java | 28 +- .../core/common/compat/COMPAT_BigReactors.java | 10 +- .../common/compat/COMPAT_CompactWindmills.java | 317 ++-- .../core/common/compat/COMPAT_EnderIO.java | 10 +- .../core/common/compat/COMPAT_ExtraUtils.java | 21 +- .../gtPlusPlus/core/common/compat/COMPAT_IC2.java | 83 +- .../core/common/compat/COMPAT_MorePlanets.java | 23 +- .../core/common/compat/COMPAT_PneumaticCraft.java | 12 +- .../core/common/compat/COMPAT_RFTools.java | 12 +- .../core/common/compat/COMPAT_SimplyJetpacks.java | 12 +- .../core/common/compat/COMPAT_Thaumcraft.java | 46 +- .../core/container/Container_BackpackBase.java | 231 ++- .../core/container/Container_Charger.java | 71 +- .../gtPlusPlus/core/container/Container_NHG.java | 100 +- .../core/container/Container_Workbench.java | 566 +++---- .../container/Container_WorkbenchAdvanced.java | 497 +++--- .../gtPlusPlus/core/creative/AddToCreativeTab.java | 30 +- .../creative/tabs/MiscUtilCreativeTabBlock.java | 2 +- .../creative/tabs/MiscUtilCreativeTabMachines.java | 5 +- .../creative/tabs/MiscUtilCreativeTabMisc.java | 2 +- .../creative/tabs/MiscUtilCreativeTabOther.java | 2 +- .../creative/tabs/MiscUtilCreativeTabTools.java | 2 +- .../gtPlusPlus/core/entity/EntityTeleportFX.java | 440 +++-- .../gtPlusPlus/core/fluids/BlockFluidBase.java | 159 +- .../core/fluids/FluidRegistryHandler.java | 79 +- src/Java/gtPlusPlus/core/fluids/GenericFluid.java | 113 +- .../gtPlusPlus/core/gui/beta/Gui_ID_Registry.java | 61 +- src/Java/gtPlusPlus/core/gui/beta/Gui_Types.java | 12 +- src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java | 51 +- .../gtPlusPlus/core/gui/item/GuiBaseBackpack.java | 147 +- .../gtPlusPlus/core/gui/machine/GUI_Charger.java | 71 +- src/Java/gtPlusPlus/core/gui/machine/GUI_NHG.java | 72 +- .../gtPlusPlus/core/gui/machine/GUI_Workbench.java | 81 +- .../core/gui/machine/GUI_WorkbenchAdvanced.java | 27 +- .../gtPlusPlus/core/handler/COMPAT_HANDLER.java | 143 +- .../core/handler/COMPAT_IntermodStaging.java | 25 +- .../gtPlusPlus/core/handler/CraftingManager.java | 14 +- src/Java/gtPlusPlus/core/handler/GuiHandler.java | 180 +-- .../handler/Recipes/LateRegistrationHandler.java | 30 +- .../core/handler/Recipes/RegistrationHandler.java | 26 +- .../core/handler/events/LoginEventHandler.java | 127 +- .../events/PickaxeBlockBreakEventHandler.java | 63 +- .../handler/events/UnbreakableBlockManager.java | 175 +- .../workbench/Workbench_CraftingHandler.java | 199 +-- .../handler/workbench/Workbench_RecipeSorter.java | 40 +- .../gtPlusPlus/core/interfaces/IGuiManager.java | 8 +- .../core/interfaces/IGuiManagerMiscUtils.java | 3 +- .../gtPlusPlus/core/interfaces/IItemBlueprint.java | 74 +- .../core/inventories/BaseInventoryBackpack.java | 252 ++- .../core/inventories/InventoryWorkbenchChest.java | 231 ++- .../inventories/InventoryWorkbenchCrafting.java | 256 ++- .../InventoryWorkbenchHoloCrafting.java | 180 +-- .../inventories/InventoryWorkbenchHoloSlots.java | 344 ++-- .../core/inventories/InventoryWorkbenchTools.java | 232 ++- .../InventoryWorkbenchToolsElectric.java | 234 ++- src/Java/gtPlusPlus/core/item/ModItems.java | 719 +++++---- src/Java/gtPlusPlus/core/item/base/BaseEuItem.java | 893 +++++----- .../core/item/base/BaseItemBackpack.java | 100 +- .../gtPlusPlus/core/item/base/BaseItemBrain.java | 104 +- .../core/item/base/BaseItemComponent.java | 187 +-- .../gtPlusPlus/core/item/base/BaseItemGeneric.java | 26 +- .../gtPlusPlus/core/item/base/BaseItemLoot.java | 130 +- .../core/item/base/BaseItemWithCharge.java | 62 +- .../core/item/base/BaseItemWithDamageValue.java | 24 +- .../gtPlusPlus/core/item/base/BasicSpawnEgg.java | 413 +++-- src/Java/gtPlusPlus/core/item/base/CoreItem.java | 119 +- .../core/item/base/bolts/BaseItemBolt.java | 4 +- .../core/item/base/cell/BaseItemCell.java | 41 +- .../core/item/base/dusts/BaseItemDust.java | 320 ++-- .../core/item/base/dusts/BaseItemDustAbstract.java | 35 +- .../core/item/base/dusts/BaseItemDustUnique.java | 120 +- .../item/base/dusts/decimal/BaseItemCentidust.java | 47 +- .../item/base/dusts/decimal/BaseItemDecidust.java | 47 +- .../core/item/base/foods/BaseItemFood.java | 31 +- .../core/item/base/foods/BaseItemHotFood.java | 82 +- .../core/item/base/gears/BaseItemGear.java | 6 +- .../core/item/base/ingots/BaseItemIngot.java | 120 +- .../core/item/base/ingots/BaseItemIngotHot.java | 61 +- .../core/item/base/itemblock/ItemBlockBase.java | 21 +- .../core/item/base/itemblock/ItemBlockFluid.java | 79 +- .../core/item/base/itemblock/ItemBlockGtBlock.java | 54 +- .../item/base/itemblock/ItemBlockGtFrameBox.java | 19 +- .../item/base/itemblock/ItemBlockTileEntity.java | 46 +- .../core/item/base/nugget/BaseItemNugget.java | 6 +- .../core/item/base/plates/BaseItemPlate.java | 15 +- .../core/item/base/plates/BaseItemPlateDouble.java | 10 +- .../core/item/base/rings/BaseItemRing.java | 4 +- .../core/item/base/rods/BaseItemRod.java | 25 +- .../core/item/base/rods/BaseItemRodLong.java | 45 +- .../core/item/base/rotors/BaseItemRotor.java | 4 +- .../core/item/base/screws/BaseItemScrew.java | 25 +- .../gtPlusPlus/core/item/effects/RarityEffect.java | 16 +- .../gtPlusPlus/core/item/effects/RarityEpic.java | 12 +- .../gtPlusPlus/core/item/effects/RarityRare.java | 12 +- .../core/item/effects/RarityUncommon.java | 10 +- .../core/item/general/BedLocator_Base.java | 102 +- .../gtPlusPlus/core/item/general/BufferCore.java | 91 +- .../core/item/general/ItemBlueprint.java | 377 ++--- .../core/item/general/ItemCloakingDevice.java | 293 ++-- .../core/item/general/ItemHealingDevice.java | 263 +-- .../core/item/general/NuclearFuelRodBase.java | 329 ++-- .../core/item/general/RF2EU_Battery.java | 359 ++--- .../core/item/general/fuelrods/FuelRod_Base.java | 297 ++-- .../item/general/fuelrods/FuelRod_Thorium.java | 4 +- src/Java/gtPlusPlus/core/item/init/ItemsFoods.java | 66 +- .../core/item/materials/MaterialHandler.java | 4 +- .../core/item/tool/misc/SandstoneHammer.java | 64 +- .../core/item/tool/staballoy/MultiPickaxeBase.java | 258 +-- .../core/item/tool/staballoy/MultiSpadeBase.java | 128 +- .../core/item/tool/staballoy/StaballoyAxe.java | 491 +++--- .../core/item/tool/staballoy/StaballoyPickaxe.java | 509 +++--- .../core/item/tool/staballoy/StaballoySpade.java | 466 +++--- src/Java/gtPlusPlus/core/lib/CORE.java | 180 ++- src/Java/gtPlusPlus/core/lib/LoadedMods.java | 262 +-- src/Java/gtPlusPlus/core/material/ALLOY.java | 1268 ++++++++++----- src/Java/gtPlusPlus/core/material/ELEMENT.java | 171 +- src/Java/gtPlusPlus/core/material/Material.java | 598 ++++--- .../core/material/MaterialGenerator.java | 82 +- .../gtPlusPlus/core/material/MaterialStack.java | 98 +- src/Java/gtPlusPlus/core/proxy/ClientProxy.java | 101 +- src/Java/gtPlusPlus/core/proxy/ServerProxy.java | 14 +- .../core/recipe/Gregtech_Recipe_Adder.java | 144 +- .../gtPlusPlus/core/recipe/RECIPES_GREGTECH.java | 607 +++---- .../gtPlusPlus/core/recipe/RECIPES_General.java | 60 +- .../core/recipe/RECIPES_LaserEngraver.java | 34 +- .../gtPlusPlus/core/recipe/RECIPES_MTWRAPPER.java | 216 ++- .../core/recipe/RECIPES_MachineComponents.java | 621 +++---- .../gtPlusPlus/core/recipe/RECIPES_Machines.java | 1259 +++++++-------- .../gtPlusPlus/core/recipe/RECIPES_Shapeless.java | 61 +- src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java | 317 ++-- .../gtPlusPlus/core/recipe/RECIPE_Batteries.java | 69 +- .../gtPlusPlus/core/recipe/RECIPE_CONSTANTS.java | 218 +-- .../gtPlusPlus/core/recipe/ShapedRecipeObject.java | 39 +- src/Java/gtPlusPlus/core/slots/SlotBlueprint.java | 22 +- src/Java/gtPlusPlus/core/slots/SlotCrafting.java | 282 ++-- src/Java/gtPlusPlus/core/slots/SlotFrame.java | 12 +- src/Java/gtPlusPlus/core/slots/SlotGeneric.java | 12 +- src/Java/gtPlusPlus/core/slots/SlotGtTool.java | 22 +- .../gtPlusPlus/core/slots/SlotGtToolElectric.java | 74 +- .../gtPlusPlus/core/slots/SlotItemBackpackInv.java | 9 +- src/Java/gtPlusPlus/core/slots/SlotNoInput.java | 12 +- src/Java/gtPlusPlus/core/slots/SlotOutput.java | 92 +- src/Java/gtPlusPlus/core/slots/SlotRTG.java | 12 +- .../core/tileentities/ModTileEntities.java | 20 +- .../core/tileentities/base/TILE_ENTITY_BASE.java | 33 +- .../tileentities/general/TileEntityReverter.java | 466 +++--- .../tileentities/machines/TileEntityCharger.java | 215 ++- .../core/tileentities/machines/TileEntityNHG.java | 715 ++++---- .../tileentities/machines/TileEntityWorkbench.java | 189 ++- .../machines/TileEntityWorkbenchAdvanced.java | 288 ++-- src/Java/gtPlusPlus/core/util/BaseHandler.java | 8 +- src/Java/gtPlusPlus/core/util/ClassUtils.java | 79 +- src/Java/gtPlusPlus/core/util/Log.java | 41 +- src/Java/gtPlusPlus/core/util/LoggingUtils.java | 55 +- src/Java/gtPlusPlus/core/util/Quality.java | 87 +- src/Java/gtPlusPlus/core/util/Utils.java | 711 ++++---- .../gtPlusPlus/core/util/UtilsChatFormatting.java | 266 ++- src/Java/gtPlusPlus/core/util/UtilsRarity.java | 29 +- src/Java/gtPlusPlus/core/util/UtilsText.java | 24 +- .../gtPlusPlus/core/util/array/ArrayUtils.java | 16 +- src/Java/gtPlusPlus/core/util/array/Pair.java | 28 +- src/Java/gtPlusPlus/core/util/array/Triplet.java | 38 +- .../core/util/debug/DEBUG_BLOCK_ShapeSpawner.java | 145 +- .../gtPlusPlus/core/util/debug/DEBUG_INIT.java | 27 +- .../core/util/debug/DEBUG_ITEM_ShapeSpawner.java | 43 +- .../util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java | 1700 +++++++++++--------- .../core/util/debug/DEBUG_ScreenOverlay.java | 54 +- .../core/util/debug/DEBUG_TimerThread.java | 68 +- .../core/util/debug/UtilityGL11Debug.java | 853 ++++++---- .../gtPlusPlus/core/util/entity/EntityUtils.java | 85 +- src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java | 42 +- .../gtPlusPlus/core/util/fluid/FluidUtils.java | 529 +++--- .../gregtech/recipehandlers/GregtechRecipe.java | 69 +- src/Java/gtPlusPlus/core/util/item/ItemUtils.java | 672 ++++---- .../core/util/materials/MaterialUtils.java | 331 ++-- src/Java/gtPlusPlus/core/util/math/MathUtils.java | 372 +++-- .../core/util/networking/NetworkUtils.java | 42 +- .../util/particles/EntityParticleFXMysterious.java | 19 +- .../gtPlusPlus/core/util/player/PlayerCache.java | 261 +-- .../gtPlusPlus/core/util/player/PlayerUtils.java | 170 +- .../gtPlusPlus/core/util/player/UtilsMining.java | 204 +-- .../gtPlusPlus/core/util/recipe/RecipeUtils.java | 635 +++++--- .../core/util/recipe/shapeless/ShapelessUtils.java | 43 +- .../core/util/reflect/ClientProxyFinder.java | 43 +- .../core/util/reflect/ReflectionUtils.java | 75 +- src/Java/gtPlusPlus/core/util/wrapper/var.java | 116 +- 209 files changed, 17938 insertions(+), 16722 deletions(-) (limited to 'src/Java/gtPlusPlus/core') diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index 2e6a7c3e07..69ecb9ed5b 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -13,47 +13,48 @@ import net.minecraftforge.fluids.Fluid; 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 MatterFabricatorEffectBlock; - - public static Fluid fluidJackDaniels = new Fluid("fluidJackDaniels"); - public static Block blockFluidJackDaniels; - public static Block blockCasings2Misc; + 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 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"); - registerBlocks(); + ModBlocks.registerBlocks(); } - public static void registerBlocks(){ + public static void registerBlocks() { Utils.LOG_INFO("Registering Blocks."); - GameRegistry.registerBlock(MatterFabricatorEffectBlock = new LightGlass(Material.glass, false).setHardness(0.1F).setBlockTextureName(CORE.MODID + ":" + "blockMFEffect").setStepSound(Block.soundTypeGlass), "blockMFEffect"); + GameRegistry.registerBlock( + ModBlocks.MatterFabricatorEffectBlock = new LightGlass(Material.glass, false).setHardness(0.1F) + .setBlockTextureName(CORE.MODID + ":" + "blockMFEffect").setStepSound(Block.soundTypeGlass), + "blockMFEffect"); - //Fluids + // Fluids FluidRegistryHandler.registerFluids(); - //Workbench - blockWorkbench = new Machine_Workbench().setHardness(1.5F); - blockWorkbenchAdvanced = new Machine_WorkbenchAdvanced().setHardness(2.5F); + // Workbench + ModBlocks.blockWorkbench = new Machine_Workbench().setHardness(1.5F); + ModBlocks.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 b7ac24a71b..0160da883f 100644 --- a/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java +++ b/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java @@ -9,23 +9,25 @@ import net.minecraft.world.World; public class AdvancedBlock extends Block { - 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; - } + 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; + } } diff --git a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java index c95f37d9c5..64ee68224e 100644 --- a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java +++ b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java @@ -8,45 +8,43 @@ import net.minecraft.block.material.Material; public class BasicBlock extends Block { - 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; - } - - } - + 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); + } + } diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java index 5d003fc2a3..f389f5bf32 100644 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java @@ -13,137 +13,141 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.world.IBlockAccess; -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(String unlocalizedName, String blockMaterial, BlockTypes blockType, int colour) { - super(blockType.getTexture()+unlocalizedName, Material.iron); + public BlockBaseModular(final String unlocalizedName, final String blockMaterial, final BlockTypes blockType, + final 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(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(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("=========================================="); } - - if (thisBlockType == BlockTypes.STANDARD.name().toUpperCase()){ - LanguageRegistry.addName(this, "Block of "+blockMaterial); - //Utils.LOG_INFO("Registered Block in Language Registry as: "+"Block of "+blockMaterial); + + 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); } - 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 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 { LanguageRegistry.addName(this, 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); + // Utils.LOG_INFO("Registered Block in Language Registry as: + // "+blockMaterial); } - 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"); + + // 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); + } + 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 { - 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 - @SideOnly(Side.CLIENT) - public int getRenderBlockPass() - { - if (thisBlock == BlockTypes.FRAME){ - return 1; + public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) { + + if (this.blockColour == 0) { + return MathUtils.generateSingularRandomHexValue(); } - return 0; + + return this.blockColour; } - - /*@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; - }*/ - + /* + * @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; } + */ + public String GetProperName() { - String tempIngot; - if (thisBlock == BlockTypes.STANDARD){ - tempIngot = "Block of "+thisBlockMaterial; + String tempIngot; + if (this.thisBlock == BlockTypes.STANDARD) { + tempIngot = "Block of " + this.thisBlockMaterial; } - else if (thisBlock == BlockTypes.FRAME){ - tempIngot = thisBlockMaterial + " Frame Box"; + else if (this.thisBlock == BlockTypes.FRAME) { + tempIngot = this.thisBlockMaterial + " Frame Box"; } else { - tempIngot = getUnlocalizedName().replace("tile.blockGt", "ingot"); + tempIngot = this.getUnlocalizedName().replace("tile.blockGt", "ingot"); } return tempIngot; } - @Override - public boolean isOpaqueCube() - { - return false; - } - + /** + * Returns which pass should this block be rendered on. 0 for solids and 1 + * for alpha + */ @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iIcon) - { - this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + thisBlock.getTexture()); + public int getRenderBlockPass() { + if (this.thisBlock == BlockTypes.FRAME) { + return 1; + } + return 0; } @Override - public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4){ - - if (this.blockColour == 0){ + public int getRenderColor(final int aMeta) { + if (this.blockColour == 0) { return MathUtils.generateSingularRandomHexValue(); } - + return this.blockColour; } - - @Override - public int getRenderColor(int aMeta) { - 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()); + } } diff --git a/src/Java/gtPlusPlus/core/block/base/MetaBlock.java b/src/Java/gtPlusPlus/core/block/base/MetaBlock.java index 4009c36726..3763b71448 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(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 + 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 diff --git a/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java b/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java index 4f022bae6d..9953dfa991 100644 --- a/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java +++ b/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java @@ -7,30 +7,29 @@ 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(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]; - } + + 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); + } + } } \ 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 873752d8a3..9b4d8bf1b8 100644 --- a/src/Java/gtPlusPlus/core/block/general/LightGlass.java +++ b/src/Java/gtPlusPlus/core/block/general/LightGlass.java @@ -13,17 +13,15 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -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 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 LightGlass(Material mat, boolean bool) - { + public LightGlass(final Material mat, final boolean bool) { super("blockMFEffect", mat, bool); this.setCreativeTab(AddToCreativeTab.tabBlock); this.setBlockName("blockMFEffect"); @@ -34,94 +32,99 @@ public class LightGlass extends BlockBreakable } /** - * Returns the quantity of items to drop on block destruction. + * Return true if a player with Silk Touch can harvest this block directly, + * and not its normal drops. */ @Override - public int quantityDropped(Random rand) - { - return 0; + 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; } /** - * 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; } /** - * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + * Returns the quantity of items to drop on block destruction. */ @Override - public boolean renderAsNormalBlock() - { - return true; + public int quantityDropped(final Random rand) { + return 0; } /** - * Return true if a player with Silk Touch can harvest this block directly, and not its normal drops. + * A randomly called display update to be able to add particles or other + * items for display */ @Override - protected boolean canSilkHarvest() - { - return false; + @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"); + } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iIcon) - { + public void registerBlockIcons(final 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; - } - /** - * A randomly called display update to be able to add particles or other items for display + * If this block doesn't render as an ordinary block it will return False + * (examples: signs, buttons, stairs, etc) */ @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, int posX, int posY, int posZ, Random random){ - Utils.spawnFX(world, posX, posY, posZ, "smoke", "cloud"); - + public boolean renderAsNormalBlock() { + return true; } } \ 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 ab5417a0e5..2f659b7806 100644 --- a/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java +++ b/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java @@ -1,12 +1,11 @@ package gtPlusPlus.core.block.general.antigrief; -import static gtPlusPlus.core.block.ModBlocks.blockGriefSaver; - 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 gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.general.TileEntityReverter; @@ -27,250 +26,239 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class TowerDevice extends Block { - 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); + 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; } - public void loadNBTData(NBTTagCompound aNBT) { - bUnbreakable = aNBT.getBoolean("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 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 6a8c89064f..768822dd6e 100644 --- a/src/Java/gtPlusPlus/core/block/general/fluids/BlockFluidJackDaniels.java +++ b/src/Java/gtPlusPlus/core/block/general/fluids/BlockFluidJackDaniels.java @@ -14,38 +14,42 @@ import net.minecraftforge.fluids.Fluid; public class BlockFluidJackDaniels extends BlockFluidClassic { - @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); - } - -} + @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"); + } + +} diff --git a/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java b/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java index 6de87e522b..dbbc91c902 100644 --- a/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java +++ b/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java @@ -8,27 +8,26 @@ import net.minecraft.world.IBlockAccess; public class BlockGtFrameBox extends MetaBlock { - private int[] colours; - private int totalColours; - - public BlockGtFrameBox( - String unlocalizedName, Material material, - BlockTypes blockTypeENUM, boolean recolour, int... colour) { + private int[] colours; + private int totalColours; + + public BlockGtFrameBox(final String unlocalizedName, final Material material, final BlockTypes blockTypeENUM, + final boolean recolour, final int... colour) { super(unlocalizedName, material, blockTypeENUM.getBlockSoundType()); - this.setBlockTextureName(CORE.MODID + ":" + "blockGtFrame"); - this.setHarvestLevel(blockTypeENUM.getHarvestTool(), 2); - if (recolour && (colour != null && colour.length > 0)){ - colours = colour; - totalColours = colours.length; - } + 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; + } } @Override - public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, - int p_149720_3_, int p_149720_4_) { - for (int i : colours){ - - } + 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) { + + } 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 43a38d0b52..e88c5c5b6b 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_Charger.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_Charger.java @@ -16,67 +16,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(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(); - } +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; + } } \ 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 72cfc91826..cfad3006b9 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_NHG.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_NHG.java @@ -16,67 +16,67 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.worl