From 76719d65a90d98e228a914774d3b11ed9f01ac8e Mon Sep 17 00:00:00 2001 From: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Date: Mon, 4 Sep 2023 03:05:22 +0100 Subject: Clean-up v2 (#729) * Remove test items from NEI with no texture * Add number formatting to hand pumps * Remove heavy plates (no recipes & completely unused). * Remove helium generator (no texture, no recipe) * Remove fire pit and fire starter (no use, no recipe, no textures) * Remove giant chicken and associated unused stuff, has no texture and is unobtainable. Used to be relevant but isn't anymore. * Remove villagers with silly trades like 1 motor + 1 hull = 1 hull. Why? * Remove trade bench, no recipe, missing textures. Unused. * Remove farm processors, no texture, no recipe. Unused. * Remove MAX tier components, these exist in GT now, have no recipe here and are unused. * Hide untextured light block from NEI * Update buildscript * Remove unused backpacks, no recipe and contains dupe bugs. Bad. * Remove eatotronic, universal toolbox and magic tool bag. All 3 are missing textures and uncraftable. * Remove eatotronic, universal toolbox and magic tool bag. All 3 are missing textures and uncraftable. part 2 * Remove dragon catcher (what?), no texture, no recipe, unused. * Remove empty item, does nothing, has no recipe, no idea why it is here. * Empty item v2 removal * Revert "Empty item v2 removal" This reverts commit 75bcd3ccfaf55bbfe2c12b2e4167d5c37636030d. * Revert "Remove empty item, does nothing, has no recipe, no idea why it is here." This reverts commit e41a9f484392776331c58530ab1faa5ef978ef36. * Remove debug square. No recipe, unused. * Number formatting overflow covers * Remove JVM garbage collection block. Unused, no recipe. * Remove nanotubes, no recipe for them. Unused. * Remove "git" item, doesn't seem to work. Has no recipe. * Remove uncraftable food with awful textures. * Remove "bat king" mob, unused content. Does not spawn. * Remove uncraftable doors with bad textures. Unused content. * Remove uncraftable, unlocalised redstone stuff that crashes game when placed. * Remove weird spawner item. No recipe, does not exist in world. * Remove sunnarium bit, no recipe, no usage. * Remove unused modularity table and some misc uncraftable, unused items. * Remove Interconnecting Storage Crate, no recipe, unused. * Delete worse debug power gen, this already exists as part of GT. Unneeded duplication. * Delete unused placeholder circuit * Delete uncraftable generator hatches. * Spotless * Remove XP tank thing, unused and uncraftable. * Remove null item, this fluid registry only seemed to register one null fluid. All others exist? * Remove EU -> RF battery. Unused in GTNH. * Remove some shelf nonsense, why is this in this mod? * Remove some weird random tools. These have no realistic usage in GTNH. * Remove firemaker. Useless in GTNH. * Removed helium blob. Deprecated item, not used anymore, uncraftable. * spotlessApply (#730) Co-authored-by: GitHub GTNH Actions <> * Stop modulators generating unused blocks with no textures * Remove more unused untextured casings * Remove more unused untextured casings * Remove more unused untextured casings * Remove more unused untextured casings * Remove more unused untextured casings * Remove some weird methods and uncraftable mining parts, probably part of deprecated multiblock. * spotlessApply (#732) Co-authored-by: GitHub GTNH Actions <> * Remove gem shards, unused. * Remove unused atoms * Remove unused gum * Remove unused elements/materials * Bye bye * Remove some unused reflection stuff * Remove control cores, obsolete now. * Remove mob killing thing with no texture and no recipe. * Remove uncraftable covers * Remove pizza gloves * Net and rope removal, unused * Remove force crop * Removal of some old event stuff * Remove unused nuclear chem items * Remove player safe, mostly because of the horrible event code that was intercepting every block break. I can't see any real usage of this via discord. * Remove Force material and associated other nonsense. Also remove some nuclear chem stuff. * Remove force for realsies * Skookum Chooker purge. * Remove some enderio compat, these plates/dusts are added via GT5 anyway now. This is obsolete. * spotlessApply (#733) Co-authored-by: GitHub GTNH Actions <> * Unused textures * Bump dep * Revert "Remove force for realsies" This reverts commit 0d288912a99f9dabce56d2a2623d4d3510f4804e. * Revert "Remove Force material and associated other nonsense. Also remove some nuclear chem stuff." This reverts commit 3455e6e916defe1f2aef923be6f9696a6cf3095b. * Remove nuclear items that are unused * spotlessApply (#734) Co-authored-by: GitHub GTNH Actions <> --------- Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Co-authored-by: Connor Colenso Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/main/java/gtPlusPlus/core/block/ModBlocks.java | 65 +-- .../gtPlusPlus/core/block/general/BlockNet.java | 37 -- .../core/block/general/BlockSuperLight.java | 2 - .../core/block/general/BlockTankXpConverter.java | 156 ------- .../gtPlusPlus/core/block/general/FirePit.java | 238 ---------- .../gtPlusPlus/core/block/general/LightGlass.java | 7 +- .../gtPlusPlus/core/block/general/PlayerDoors.java | 485 --------------------- .../general/redstone/BlockGenericRedstone.java | 366 ---------------- .../redstone/BlockGenericRedstoneDetector.java | 142 ------ .../general/redstone/BlockGenericRedstoneTest.java | 211 --------- .../java/gtPlusPlus/core/block/machine/EggBox.java | 149 ------- .../core/block/machine/HeliumGenerator.java | 90 ---- .../block/machine/Machine_ModularityTable.java | 101 ----- .../core/block/machine/Machine_TradeTable.java | 87 ---- .../block/machine/bedrock/Mining_Head_Fake.java | 173 -------- .../block/machine/bedrock/Mining_Pipe_Fake.java | 131 ------ 16 files changed, 4 insertions(+), 2436 deletions(-) delete mode 100644 src/main/java/gtPlusPlus/core/block/general/BlockNet.java delete mode 100644 src/main/java/gtPlusPlus/core/block/general/BlockTankXpConverter.java delete mode 100644 src/main/java/gtPlusPlus/core/block/general/FirePit.java delete mode 100644 src/main/java/gtPlusPlus/core/block/general/PlayerDoors.java delete mode 100644 src/main/java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java delete mode 100644 src/main/java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java delete mode 100644 src/main/java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java delete mode 100644 src/main/java/gtPlusPlus/core/block/machine/EggBox.java delete mode 100644 src/main/java/gtPlusPlus/core/block/machine/HeliumGenerator.java delete mode 100644 src/main/java/gtPlusPlus/core/block/machine/Machine_ModularityTable.java delete mode 100644 src/main/java/gtPlusPlus/core/block/machine/Machine_TradeTable.java delete mode 100644 src/main/java/gtPlusPlus/core/block/machine/bedrock/Mining_Head_Fake.java delete mode 100644 src/main/java/gtPlusPlus/core/block/machine/bedrock/Mining_Pipe_Fake.java (limited to 'src/main/java/gtPlusPlus/core/block') diff --git a/src/main/java/gtPlusPlus/core/block/ModBlocks.java b/src/main/java/gtPlusPlus/core/block/ModBlocks.java index 9957ae3f92..5058ac51cd 100644 --- a/src/main/java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/main/java/gtPlusPlus/core/block/ModBlocks.java @@ -1,37 +1,24 @@ package gtPlusPlus.core.block; import net.minecraft.block.Block; -import net.minecraft.block.material.Material; import net.minecraftforge.fluids.Fluid; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.general.BlockCompressedObsidian; -import gtPlusPlus.core.block.general.BlockNet; -import gtPlusPlus.core.block.general.BlockTankXpConverter; -import gtPlusPlus.core.block.general.FirePit; import gtPlusPlus.core.block.general.FluidTankInfinite; import gtPlusPlus.core.block.general.HellFire; import gtPlusPlus.core.block.general.LightGlass; import gtPlusPlus.core.block.general.MiningExplosives; -import gtPlusPlus.core.block.general.PlayerDoors; import gtPlusPlus.core.block.general.antigrief.BlockWitherProof; -import gtPlusPlus.core.block.general.redstone.BlockGenericRedstoneDetector; -import gtPlusPlus.core.block.general.redstone.BlockGenericRedstoneTest; import gtPlusPlus.core.block.machine.CircuitProgrammer; import gtPlusPlus.core.block.machine.DecayablesChest; -import gtPlusPlus.core.block.machine.EggBox; import gtPlusPlus.core.block.machine.FishTrap; -import gtPlusPlus.core.block.machine.HeliumGenerator; -import gtPlusPlus.core.block.machine.Machine_ModularityTable; import gtPlusPlus.core.block.machine.Machine_PestKiller; import gtPlusPlus.core.block.machine.Machine_PooCollector; import gtPlusPlus.core.block.machine.Machine_ProjectTable; import gtPlusPlus.core.block.machine.Machine_RoundRobinator; import gtPlusPlus.core.block.machine.Machine_SuperJukebox; -import gtPlusPlus.core.block.machine.Machine_TradeTable; import gtPlusPlus.core.block.machine.VolumetricFlaskSetter; -import gtPlusPlus.core.block.machine.bedrock.Mining_Head_Fake; -import gtPlusPlus.core.block.machine.bedrock.Mining_Pipe_Fake; import gtPlusPlus.core.fluids.FluidRegistryHandler; public final class ModBlocks { @@ -39,18 +26,9 @@ public final class ModBlocks { public static Block blockRoundRobinator; public static Block blockCircuitProgrammer; public static Block blockVolumetricFlaskSetter; - public static Block blockFakeMiningPipe; - public static Block blockFakeMiningHead; public static Block blockFishTrap; public static Block blockDecayablesChest; - public static Block blockEggBox; - - // 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 blockCasings2Misc; @@ -64,32 +42,18 @@ public final class ModBlocks { public static Block blockCustomMachineCasings; public static Block blockCustomPipeGearCasings; - public static Block blockMetaTileEntity; - public static Block blockHeliumGenerator; - public static Block blockNHG; - public static Block blockCharger; - public static Block MatterFabricatorEffectBlock; public static Fluid fluidSludge = new Fluid("fluid.sludge"); public static Block blockFluidSludge; - public static Block blockFirePit; - - public static Block blockOreFluorite; - public static Block blockMiningExplosive; public static Block blockHellfire; public static Block blockInfiniteFLuidTank; public static Block blockProjectTable; - public static Block blockTradeTable; - public static Block blockModularTable; - public static Block blockWitherGuard; - public static Block blockXpConverter; public static Block blockCompressedObsidian; - public static Block blockNet; public static Block blockPlayerDoorWooden; public static Block blockPlayerDoorIron; @@ -97,8 +61,6 @@ public final class ModBlocks { public static Block blockPlayerDoorCustom_Ice; public static Block blockPlayerDoorCustom_Cactus; - public static Block blockCustomMobSpawner; - public static Block blockCustomSuperLight; public static Block blockCustomJukebox; public static Block blockPooCollector; @@ -120,41 +82,18 @@ public final class ModBlocks { FluidRegistryHandler.registerFluids(); // Workbench - blockHeliumGenerator = new HeliumGenerator(); - blockFirePit = new FirePit(); blockFishTrap = new FishTrap(); blockInfiniteFLuidTank = new FluidTankInfinite(); blockMiningExplosive = new MiningExplosives(); blockHellfire = new HellFire(); blockProjectTable = new Machine_ProjectTable(); - blockTradeTable = new Machine_TradeTable(); - blockModularTable = new Machine_ModularityTable(); blockWitherGuard = new BlockWitherProof(); - blockXpConverter = new BlockTankXpConverter(); blockCompressedObsidian = new BlockCompressedObsidian(); - blockNet = new BlockNet(); - - blockFakeMiningPipe = new Mining_Pipe_Fake(); - blockFakeMiningHead = new Mining_Head_Fake(); blockCircuitProgrammer = new CircuitProgrammer(); blockDecayablesChest = new DecayablesChest(); - blockEggBox = new EggBox(); - - blockPlayerDoorWooden = new PlayerDoors(Material.wood, "door_wood", true); - blockPlayerDoorIron = new PlayerDoors(Material.iron, "door_iron", true); - blockPlayerDoorCustom_Glass = new PlayerDoors(Material.glass, "door_glass", false); - blockPlayerDoorCustom_Ice = new PlayerDoors(Material.ice, "door_ice", false); - blockPlayerDoorCustom_Cactus = new PlayerDoors( - Material.cactus, - "door_cactus", - false, - 0.6f, - Block.soundTypeGrass, - "Cactus"); - - // blockCustomSuperLight = new BlockSuperLight(); + blockCustomJukebox = new Machine_SuperJukebox(); blockPooCollector = new Machine_PooCollector(); @@ -165,7 +104,5 @@ public final class ModBlocks { blockVolumetricFlaskSetter = new VolumetricFlaskSetter(); - new BlockGenericRedstoneDetector(); - new BlockGenericRedstoneTest(); } } diff --git a/src/main/java/gtPlusPlus/core/block/general/BlockNet.java b/src/main/java/gtPlusPlus/core/block/general/BlockNet.java deleted file mode 100644 index c462021374..0000000000 --- a/src/main/java/gtPlusPlus/core/block/general/BlockNet.java +++ /dev/null @@ -1,37 +0,0 @@ -package gtPlusPlus.core.block.general; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.Random; - -import net.minecraft.block.BlockWeb; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.Item; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.ModItems; - -public class BlockNet extends BlockWeb { - - public BlockNet() { - this.setCreativeTab(AddToCreativeTab.tabBlock); - this.setLightOpacity(1); - this.setHardness(4.0F); - this.setBlockName("blockNet"); - GameRegistry.registerBlock(this, "blockNet"); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister iIcon) { - this.blockIcon = iIcon.registerIcon(GTPlusPlus.ID + ":" + "net"); - } - - @Override - public Item getItemDropped(final int p_149650_1_, final Random p_149650_2_, final int p_149650_3_) { - return ModItems.itemRope; - } -} diff --git a/src/main/java/gtPlusPlus/core/block/general/BlockSuperLight.java b/src/main/java/gtPlusPlus/core/block/general/BlockSuperLight.java index a9c309d5c7..f62fc50a69 100644 --- a/src/main/java/gtPlusPlus/core/block/general/BlockSuperLight.java +++ b/src/main/java/gtPlusPlus/core/block/general/BlockSuperLight.java @@ -179,7 +179,6 @@ public class BlockSuperLight extends BlockContainer { else if (enable && aLight == 0) { aBlocksToUpdate.put(new BlockPos(xOff, yOff, zOff, this.worldObj)); if (aBlockGet instanceof BlockAir) { - Logger.INFO("Lit air."); this.worldObj.setBlock( xOff, yOff, @@ -188,7 +187,6 @@ public class BlockSuperLight extends BlockContainer { 0, 3); } - // aBlockGet.setLightLevel(15); aLitCounter++; } // Turning Lights off diff --git a/src/main/java/gtPlusPlus/core/block/general/BlockTankXpConverter.java b/src/main/java/gtPlusPlus/core/block/general/BlockTankXpConverter.java deleted file mode 100644 index 57b70c1927..0000000000 --- a/src/main/java/gtPlusPlus/core/block/general/BlockTankXpConverter.java +++ /dev/null @@ -1,156 +0,0 @@ -package gtPlusPlus.core.block.general; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.Random; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.itemblock.ItemBlockEntityBase; - -public class BlockTankXpConverter extends BlockContainer { - - @SideOnly(Side.CLIENT) - private IIcon textureTop; - - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - public BlockTankXpConverter() { - super(Material.iron); - this.setBlockName("blockTankXpConverter"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, ItemBlockEntityBase.class, "blockTankXpConverter"); - this.generateRainbowMap(); - if (!this.getTickRandomly()) { - this.setTickRandomly(true); - } - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int ordinalSide, final int meta) { - return ordinalSide == 1 ? this.textureTop - : (ordinalSide == 0 ? this.textureBottom - : ((ordinalSide != 2) && (ordinalSide != 4) ? this.blockIcon : this.textureFront)); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) { - this.blockIcon = p_149651_1_.registerIcon(GTPlusPlus.ID + ":" + "SwirlGray"); - this.textureTop = p_149651_1_.registerIcon(GTPlusPlus.ID + ":" + "SwirlGray"); - this.textureBottom = p_149651_1_.registerIcon(GTPlusPlus.ID + ":" + "SwirlGray"); - this.textureFront = p_149651_1_.registerIcon(GTPlusPlus.ID + ":" + "SwirlGray"); - } - - /** - * 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) { - - return true; - - /* - * if (world.isRemote) { return true; } else { boolean mDidScrewDriver = false; // Check For Screwdriver try { - * final ItemStack mHandStack = PlayerUtils.getItemStackInPlayersHand(world, player.getDisplayName()); final - * Item mHandItem = mHandStack.getItem(); if (((mHandItem instanceof GT_MetaGenerated_Tool_01) && - * ((mHandItem.getDamage(mHandStack) == 22) || (mHandItem.getDamage(mHandStack) == 150)))) { final - * TileEntityXpConverter tile = (TileEntityXpConverter) world.getTileEntity(x, y, z); if (tile != null) { - * mDidScrewDriver = true; tile.onScrewdriverRightClick((byte) side, player, x, y, z); } } } catch (final - * Throwable t) { mDidScrewDriver = false; } if (!mDidScrewDriver) { try { final TileEntityXpConverter tile = - * (TileEntityXpConverter) world.getTileEntity(x, y, z); if (tile != null) { tile.onRightClick((byte) side, - * player, x, y, z); } } catch (final Throwable t) { } final TileEntityXpConverter tank = - * (TileEntityXpConverter) world.getTileEntity(x, y, z); if (tank != null) { if (tank.tankEssence.getFluid() != - * null) { PlayerUtils.messagePlayer(player, "This tank contains " + tank.tankEssence.getFluidAmount() + "L of " - * + tank.tankEssence.getFluid().getLocalizedName()); } if (tank.tankLiquidXp.getFluid() != null) { - * PlayerUtils.messagePlayer(player, "This tank contains " + tank.tankLiquidXp.getFluidAmount() + "L of " + - * tank.tankLiquidXp.getFluid().getLocalizedName()); } if ((tank.tankEssence.getFluid() != null) && - * (tank.tankLiquidXp.getFluid() != null)) { PlayerUtils.messagePlayer(player, "This is worth " + - * EnchantingUtils.getLevelForLiquid(tank.tankLiquidXp.getFluidAmount()) + " levels."); } } } } return true; - */ } - - @Override - public int getRenderBlockPass() { - return 1; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - // return new TileEntityXpConverter(); - return null; - } - - @Override - public void onBlockAdded(final World world, final int x, final int y, final int z) { - super.onBlockAdded(world, x, y, z); - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, - final int z) { - return false; - } - - private final boolean generateRainbowMap() { - return true; - } - - @Override - public int getBlockColor() { - return super.getBlockColor(); - } - - @Override - public int colorMultiplier(final IBlockAccess p_149720_1_, final int p_149720_2_, final int p_149720_3_, - final int p_149720_4_) { - return super.colorMultiplier(p_149720_1_, p_149720_2_, p_149720_3_, p_149720_4_); - } - - @Override - public void updateTick(final World world, final int x, final int y, final int z, final Random rand) { - // this.mRainbowTick++; - super.updateTick(world, x, y, z, rand); - } - - @Override - public void randomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) { - // this.mRainbowTick++; - super.randomDisplayTick(world, x, y, z, rand); - } - - @Override - public int tickRate(final World p_149738_1_) { - return 20; - } - - @Override - public int getLightValue() { - return 6; - } -} diff --git a/src/main/java/gtPlusPlus/core/block/general/FirePit.java b/src/main/java/gtPlusPlus/core/block/general/FirePit.java deleted file mode 100644 index 4b4390bc78..0000000000 --- a/src/main/java/gtPlusPlus/core/block/general/FirePit.java +++ /dev/null @@ -1,238 +0,0 @@ -package gtPlusPlus.core.block.general; - -import static net.minecraftforge.common.util.ForgeDirection.DOWN; -import static net.minecraftforge.common.util.ForgeDirection.EAST; -import static net.minecraftforge.common.util.ForgeDirection.NORTH; -import static net.minecraftforge.common.util.ForgeDirection.SOUTH; -import static net.minecraftforge.common.util.ForgeDirection.UP; -import static net.minecraftforge.common.util.ForgeDirection.WEST; - -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; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.block.base.BasicBlock; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.tileentities.general.TileEntityFirepit; - -public class FirePit extends BasicBlock { - - private static IIcon[] TEXTURE; - public static final int META_ANTIBUILDER = 2; - private int meta; - - public FirePit() { - super("blockFirePit", Material.wood); - this.setBlockName("blockFirePit"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setHardness(10.0F); - this.setResistance(35.0F); - this.setStepSound(Block.soundTypeWood); - GameRegistry.registerBlock(this, "blockFirePit"); - } - - @Override - public int tickRate(final World aParWorld) { - return 30; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int i) { - return new TileEntityFirepit(); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister par1IconRegister) { - TEXTURE = new IIcon[] { par1IconRegister.registerIcon(this.getTextureName() + "_layer_0"), - par1IconRegister.registerIcon(this.getTextureName() + "_layer_1") }; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) { - par3List.add(new ItemStack(par1, 1, 2)); - } - - @Override - public void updateTick(final World par1World, final int x, final int y, final int z, final Random par5Random) { - if (!par1World.isRemote) { - // Sets meta. - this.meta = par1World.getBlockMetadata(x, y, z); - // If Raining, Put out. - if (par1World.isRaining() - && (par1World.canLightningStrikeAt(x, y, z) || par1World.canLightningStrikeAt(x - 1, y, z) - || par1World.canLightningStrikeAt(x + 1, y, z) - || par1World.canLightningStrikeAt(x, y, z - 1) - || par1World.canLightningStrikeAt(x, y, z + 1))) { - // Fire goes out - par1World.setBlockMetadataWithNotify(x, y, z, 1, 4); - } - if (isNeighborBurning(par1World, x, y, z)) { - // Fire can ignite from a nearby flame source. - par1World.setBlockMetadataWithNotify(x, y, z, 2, 4); - } - } - } - - @Override - public Item getItemDropped(final int meta, final Random par2Random, final int par3) { - switch (meta) { - case 0: - return null; - default: - break; - } - return Item.getItemFromBlock(this); - } - - @Override - public int damageDropped(final int meta) { - return meta; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public int getRenderType() { - return -1; - } - - @Override - @SideOnly(Side.CLIENT) - public int getRenderBlockPass() { - return 1; - } - - @Override - public boolean renderAsNormalBlock() { - return false; - } - - /* - * @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World aParWorld, int x, int y, int z){ return - * null; } - */ - - @Override - protected boolean canSilkHarvest() { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(final World p_149734_1_, final int p_149734_2_, final int p_149734_3_, - final int p_149734_4_, final Random p_149734_5_) { - int l; - float f; - float f1; - float f2; - if (this.meta == 2) { - if (p_149734_5_.nextInt(24) == 0) { - p_149734_1_.playSound( - p_149734_2_ + 0.5F, - p_149734_3_ + 0.5F, - p_149734_4_ + 0.5F, - "fire.fire", - 1.0F + p_149734_5_.nextFloat(), - (p_149734_5_.nextFloat() * 0.7F) + 0.3F, - false); - } - } - if (this.meta == 2) { - if (!World.doesBlockHaveSolidTopSurface(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) - && !Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_, UP)) { - if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_, EAST)) { - for (l = 0; l < 2; ++l) { - f = p_149734_2_ + (p_149734_5_.nextFloat() * 0.1F); - f1 = p_149734_3_ + p_149734_5_.nextFloat(); - f2 = p_149734_4_ + p_149734_5_.nextFloat(); - p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - } - } - if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_, WEST)) { - for (l = 0; l < 2; ++l) { - f = p_149734_2_ + 1 - (p_149734_5_.nextFloat() * 0.1F); - f1 = p_149734_3_ + p_149734_5_.nextFloat(); - f2 = p_149734_4_ + p_149734_5_.nextFloat(); - p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - } - } - if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1, SOUTH)) { - for (l = 0; l < 2; ++l) { - f = p_149734_2_ + p_149734_5_.nextFloat(); - f1 = p_149734_3_ + p_149734_5_.nextFloat(); - f2 = p_149734_4_ + (p_149734_5_.nextFloat() * 0.1F); - p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - } - } - if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1, NORTH)) { - for (l = 0; l < 2; ++l) { - f = p_149734_2_ + p_149734_5_.nextFloat(); - f1 = p_149734_3_ + p_149734_5_.nextFloat(); - f2 = p_149734_4_ + 1 - (p_149734_5_.nextFloat() * 0.1F); - p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - } - } - if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_, DOWN)) { - for (l = 0; l < 2; ++l) { - f = p_149734_2_ + p_149734_5_.nextFloat(); - f1 = p_149734_3_ + 1 - (p_149734_5_.nextFloat() * 0.1F); - f2 = p_149734_4_ + p_149734_5_.nextFloat(); - p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - } - } - } else { - if (this.meta == 2) { - for (l = 0; l < 3; ++l) { - f = p_149734_2_ + p_149734_5_.nextFloat(); - f1 = p_149734_3_ + (p_149734_5_.nextFloat() * 0.5F) + 0.5F; - f2 = p_149734_4_ + p_149734_5_.nextFloat(); - p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - } - } - } - } - } - - @SideOnly(Side.CLIENT) - public static IIcon getFireIcon(final int p_149840_1_) { - return FirePit.TEXTURE[p_149840_1_]; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int ordinalSide, final int meta) { - return FirePit.TEXTURE[0]; - } - - private static boolean isNeighborBurning(final World world, final int x, final int y, final int z) { - return canCatchFire(world, x + 1, y, z, WEST) || canCatchFire(world, x - 1, y, z, EAST) - || canCatchFire(world, x, y - 1, z, UP) - || canCatchFire(world, x, y + 1, z, DOWN) - || canCatchFire(world, x, y, z - 1, SOUTH) - || canCatchFire(world, x, y, z + 1, NORTH); - } - - public static boolean canCatchFire(final World world, final int x, final int y, final int z, - final ForgeDirection face) { - return world.getBlock(x, y, z).isFireSource(world, x, y, z, face); - } -} diff --git a/src/main/java/gtPlusPlus/core/block/general/LightGlass.java b/src/main/java/gtPlusPlus/core/block/general/LightGlass.java index 4bc120678f..64b2455e41 100644 --- a/src/main/java/gtPlusPlus/core/block/general/LightGlass.java +++ b/src/main/java/gtPlusPlus/core/block/general/LightGlass.java @@ -7,9 +7,11 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockAir; import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import codechicken.nei.api.API; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -28,7 +30,6 @@ public class LightGlass extends BlockAir { private int hex; public LightGlass(final boolean bool) { - // super("blockMFEffect", Material.air, bool); super(); this.setCreativeTab(AddToCreativeTab.tabBlock); this.setBlockName("blockMFEffect"); @@ -38,9 +39,7 @@ public class LightGlass extends BlockAir { setStepSound(Block.soundTypeGlass); GameRegistry.registerBlock(this, "blockMFEffect"); - /* - * this.setLightOpacity(0); this.setTickRandomly(true); this.setResistance(1); - */ + API.hideItem(new ItemStack(this)); } /** diff --git a/src/main/java/gtPlusPlus/core/block/general/PlayerDoors.java b/src/main/java/gtPlusPlus/core/block/general/PlayerDoors.java deleted file mode 100644 index d5cd3ef2fa..0000000000 --- a/src/main/java/gtPlusPlus/core/block/general/PlayerDoors.java +++ /dev/null @@ -1,485 +0,0 @@ -package gtPlusPlus.core.block.general; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.HashMap; -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockDoor; -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.IconFlipped; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.IIcon; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.item.base.itemblock.ItemBlockDoor; -import gtPlusPlus.core.tileentities.general.TileEntityPlayerDoorBase; -import gtPlusPlus.core.util.Utils; - -public class PlayerDoors extends BlockDoor implements ITileEntityProvider { - - @SideOnly(Side.CLIENT) - private IIcon[] aTextureUpper; - - @SideOnly(Side.CLIENT) - private IIcon[] aTextureLower; - - private static final HashMap mDoorMap = new HashMap(); - - public PlayerDoors(Material aMaterial, String aTextureName, boolean vanillaType) { - this(aMaterial, aTextureName, vanillaType, 0f, null, null); - } - - public PlayerDoors(Material aMaterial, String aTextureName, boolean vanillaType, float aHardness, - SoundType aStepSound, String aBlockExtensionName) { - super(aMaterial); - this.disableStats(); - this.isBlockContainer = true; - if (mDoorMap.get(aMaterial) == null) { - mDoorMap.put(aMaterial, this); - } - float f = 0.5F; - float f1 = 1.0F; - this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); - - this.setBlockName("playerDoor_" + aTextureName); - if (aMaterial == Material.wood) { - setHardness(3.0F); - setStepSound(soundTypeWood); - setBlockName("playerDoor" + "Wood"); - this.setHarvestLevel("axe", 1); - } else if (aMaterial == Material.iron) { - setHardness(5.0F); - setStepSound(Block.soundTypeMetal); - setBlockName("playerDoor" + "Iron"); - this.setHarvestLevel("pickaxe", 1); - - } else if (aMaterial == Material.glass) { - setHardness(0.1F); - setStepSound(Block.soundTypeGlass); - setBlockName("playerDoor" + "Glass"); - this.setHarvestLevel("pickaxe", 1); - - } else if (aMaterial == Material.ice) { - setHardness(0.5F); - setStepSound(Block.soundTypeSnow); - setBlockName("playerDoor" + "Ice"); - this.setHarvestLevel("pickaxe", 1); - } else { - setHardness(aHardness); - setStepSound(aStepSound); - setBlockName("playerDoor" + aBlockExtensionName); - this.setHarvestLevel("axe", 1); - } - this.setBlockTextureName(vanillaType ? aTextureName : GTPlusPlus.ID + ":" + aTextureName); - GameRegistry.registerBlock(this, ItemBlockDoor.class, Utils.sanitizeString(this.getUnlocalizedName())); - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int ordinalSide, int meta) { - return this.aTextureLower[0]; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess aAccess, int p_149673_2_, int p_149673_3_, int p_149673_4_, int p_149673_5_) { - if (p_149673_5_ != 1 && p_149673_5_ != 0) { - int i1 = this.getState(aAccess, p_149673_2_, p_149673_3_, p_149673_4_); - int j1 = i1 & 3; - boolean flag = (i1 & 4) != 0; - boolean flag1 = false; - boolean flag2 = (i1 & 8) != 0; - - if (flag) { - if (j1 == 0 && p_149673_5_ == 2) { - flag1 = !flag1; - } else if (j1 == 1 && p_149673_5_ == 5) { - flag1 = !flag1; - } else if (j1 == 2 && p_149673_5_ == 3) { - flag1 = !flag1; - } else if (j1 == 3 && p_149673_5_ == 4) { - flag1 = !flag1; - } - } else { - if (j1 == 0 && p_149673_5_ == 5) { - flag1 = !flag1; - } else if (j1 == 1 && p_149673_5_ == 3) { - flag1 = !flag1; - } else if (j1 == 2 && p_149673_5_ == 4) { - flag1 = !flag1; - } else if (j1 == 3 && p_149673_5_ == 2) { - flag1 = !flag1; - } - - if ((i1 & 16) != 0) { - flag1 = !flag1; - } - } - - return flag2 ? this.aTextureUpper[flag1 ? 1 : 0] : this.aTextureLower[flag1 ? 1 : 0]; - } else { - return this.aTextureLower[0]; - } - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister p_149651_1_) { - this.aTextureUpper = new IIcon[2]; - this.aTextureLower = new IIcon[2]; - this.aTextureUpper[0] = p_149651_1_.registerIcon(this.getTextureName() + "_upper"); - this.aTextureLower[0] = p_149651_1_.registerIcon(this.getTextureName() + "_lower"); - this.aTextureUpper[1] = new IconFlipped(this.aTextureUpper[0], true, false); - this.aTextureLower[1] = new IconFlipped(this.aTextureLower[0], true, false); - } - - @Override - public boolean getBlocksMovement(IBlockAccess aAccess, int aX, int aY, int aZ) { - int l = this.getState(aAccess, aX, aY, aZ); - return (l & 4) != 0; - } - - /** - * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) - */ - @Override - public boolean renderAsNormalBlock() { - return false; - } - - /** - * The type of render function that is called for this block - */ - @Override - public int getRenderType() { - return 7; - } - - /** - * Returns the bounding box of the wired rectangular prism to render. - */ - @Override - @SideOnly(Side.CLIENT) - public AxisAlignedBB getSelectedBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - this.setBlockBoundsBasedOnState(aWorld, aX, aY, aZ); - return super.getSelectedBoundingBoxFromPool(aWorld, aX, aY, aZ); - } - - /** - * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been - * cleared to be reused) - */ - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - this.setBlockBoundsBasedOnState(aWorld, aX, aY, aZ); - return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); - } - - /** - * Updates the blocks bounds based on its current state. Args: world, x, y, z - */ - @Override - public void setBlockBoundsBasedOnState(IBlockAccess aAccess, int aX, int aY, int aZ) { - this.setBounds(this.getState(aAccess, aX, aY, aZ)); - } - - @Override - public int func_150013_e(IBlockAccess p_150013_1_, int p_150013_2_, int p_150013_3_, int p_150013_4_) { - return this.getState(p_150013_1_, p_150013_2_, p_150013_3_, p_150013_4_) & 3; - } - - @Override - public boolean func_150015_f(IBlockAccess p_150015_1_, int p_150015_2_, int p_150015_3_, int p_150015_4_) { - return (this.getState(p_150015_1_, p_150015_2_, p_150015_3_, p_150015_4_) & 4) != 0; - } - - private void setBounds(int aState) { - float f = 0.1875F; - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); - int j = aState & 3; - boolean flag = (aState & 4) != 0; - boolean flag1 = (aState & 16) != 0; - - if (j == 0) { - if (flag) { - if (!flag1) { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); - } else { - this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); - } - } else { - this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); - } - } else if (j == 1) { - if (flag) { - if (!flag1) { - this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } else { - this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); - } - } else { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); - } - } else if (j == 2) { - if (flag) { - if (!flag1) { - this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); - } else { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); - } - } else { - this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } - } else if (j == 3) { - if (flag) { - if (!flag1) { - this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); - } else { - this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } - } else { - this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); - } - } - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int p_149727_6_, - float p_149727_7_, float p_149727_8_, float p_149727_9_) { - if (this.blockMaterial == Material.iron) { - return false; // Allow items to interact with the door - } else { - int i1 = this.getState(aWorld, aX, aY, aZ); - int j1 = i1 & 7; - j1 ^= 4; - - if ((i1 & 8) == 0) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, j1, 2); - aWorld.markBlockRangeForRenderUpdate(aX, aY, aZ, aX, aY, aZ); - } else { - aWorld.setBlockMetadataWithNotify(aX, aY - 1, aZ, j1, 2); - aWorld.markBlockRangeForRenderUpdate(aX, aY - 1, aZ, aX, aY, aZ); - } - - aWorld.playAuxSFXAtEntity(aPlayer, 1003, aX, aY, aZ, 0); - return true; - } - } - - @Override - public void func_150014_a(World aWorld, int aX, int aY, int aZ, boolean aFlag) { - int l = this.getState(aWorld, aX, aY, aZ); - boolean flag1 = (l & 4) != 0; - - if (flag1 != aFlag) { - int i1 = l & 7; - i1 ^= 4; - - if ((l & 8) == 0) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, i1, 2); - aWorld.markBlockRangeForRenderUpdate(aX, aY, aZ, aX, aY, aZ); - } else { - aWorld.setBlockMetadataWithNotify(aX, aY - 1, aZ, i1, 2); - aWorld.markBlockRangeForRenderUpdate(aX, aY - 1, aZ, aX, aY, aZ); - } - - aWorld.playAuxSFXAtEntity((EntityPlayer) null, 1003, aX, aY, aZ, 0); - } - } - - /** - * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are - * their own) Args: x, y, z, neighbor Block - */ - @Override - public void onNeighborBlockChange(World aWorld, int aX, int aY, int aZ, Block aNeighbour) { - int l = aWorld.getBlockMetadata(aX, aY, aZ); - - if ((l & 8) == 0) { - boolean flag = false; - - if (aWorld.getBlock(aX, aY + 1, aZ) != this) { - aWorld.setBlockToAir(aX, aY, aZ); - flag = true; - } - - if (!World.doesBlockHaveSolidTopSurface(aWorld, aX, aY - 1, aZ)) { - aWorld.setBlockToAir(aX, aY, aZ); - flag = true; - - if (aWorld.getBlock(aX, aY + 1, aZ) == this) { - aWorld.setBlockToAir(aX, aY + 1, aZ); - } - } - - if (flag) { - if (!aWorld.isRemote) { - this.dropBlockAsItem(aWorld, aX, aY, aZ, l, 0); - } - } else { - boolean flag1 = aWorld.isBlockIndirectlyGettingPowered(aX, aY, aZ) - || aWorld.isBlockIndirectlyGettingPowered(aX, aY + 1, aZ); - - if ((flag1 || aNeighbour.canProvidePower()) && aNeighbour != this) { - this.func_150014_a(aWorld, aX, aY, aZ, flag1); - } - } - } else { - if (aWorld.getBlock(aX, aY - 1, aZ) != this) { - aWorld.setBlockToAir(aX, aY, aZ); - } - - if (aNeighbour != this) { - this.onNeighborBlockChange(aWorld, aX, aY - 1, aZ, aNeighbour); - } - } - } - - @Override - public Item getItemDropped(int p_149650_1_, Random aRand, int p_149650_3_) { - if ((p_149650_1_ & 8) != 0) { - return null; - } else { - Block b = mDoorMap.get(this.blockMaterial); - if (b != null) { - return Item.getItemFromBlock(b); - } - } - return null; - } - - /** - * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world, - * x, y, z, startVec, endVec - */ - @Override - public MovingObjectPosition collisionRayTrace(World p_149731_1_, int p_149731_2_, int p_149731_3_, int p_149731_4_, - Vec3 p_149731_5_, Vec3 p_149731_6_) { - this.setBlockBoundsBasedOnState(p_149731_1_, p_149731_2_, p_149731_3_, p_149731_4_); - return super.collisionRayTrace(p_149731_1_, p_149731_2_, p_149731_3_, p_149731_4_, p_149731_5_, p_149731_6_); - } - - /** - * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z - */ - @Override - public boolean canPlaceBlockAt(World aWorld, int aX, int aY, int aZ) { - boolean aHeight = (aY < aWorld.getHeight() - 1); - boolean aSolidTopSurface = World.doesBlockHaveSolidTopSurface(aWorld, aX, aY - 1, aZ); - - boolean aCanPlace = aWorld.getBlock(aX, aY, aZ).isReplaceable(aWorld, aX, aY, aZ); - boolean aCanPlace2 = aWorld.getBlock(aX, aY, aZ).isReplaceable(aWorld, aX, aY + 1, aZ); - - // Logger.INFO(""+aY+"/"+aWorld.getHeight()+" | Trying to place door. Good - // height? "+aHeight+" | Solid top surface? "+aSolidTopSurface+" | Can Place? - // "+aCanPlace+"|"+aCanPlace2); - - return aHeight && aSolidTopSurface && aCanPlace && aCanPlace2; - } - - /** - * Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility - * and stop pistons - */ - @Override - public int getMobilityFlag() { - return 1; - } - - public int getState(IBlockAccess aAccess, int aX, int aY, int aZ) { - int l = aAccess.getBlockMetadata(aX, aY, aZ); - boolean flag = (l & 8) != 0; - int i1; - int j1; - - if (flag) { - i1 = aAccess.getBlockMetadata(aX, aY - 1, aZ); - j1 = l; - } else { - i1 = l; - j1 = aAccess.getBlockMetadata(aX, aY + 1, aZ); - } - - boolean flag1 = (j1 & 1) != 0; - return i1 & 7 | (flag ? 8 : 0) | (flag1 ? 16 : 0); - } - - /** - * Gets an item for the block being called on. Args: world, x, y, z - */ - @Override - @SideOnly(Side.CLIENT) - public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { - Block b = mDoorMap.get(this.blockMaterial); - if (b != null) { - return Item.getItemFromBlock(b); - } - // return this.blockMaterial == Material.iron ? Items.iron_door : - // Items.wooden_door; - return null; - } - - /** - * Called when the block is attempted to be harvested - */ - @Override - public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, - EntityPlayer p_149681_6_) { - if (p_149681_6_.capabilities.isCreativeMode && (p_149681_5_ & 8) != 0 - && p_149681_1_.getBlock(p_149681_2_, p_149681_3_ - 1, p_149681_4_) == this) { - p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ - 1, p_149681_4_); - } - } - - /** - * Called whenever the block is added into the world. Args: world, x, y, z - */ - @Override - public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) { - super.onBlockAdded(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_); - } - - @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, - int p_149749_6_) { - super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); - p_149749_1_.removeTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); - } - - @Override - public boolean onBlockEventReceived(World p_149696_1_, int p_149696_2_, int p_149696_3_, int p_149696_4_, - int p_149696_5_, int p_149696_6_) { - super.onBlockEventReceived(p_149696_1_, p_149696_2_, p_149696_3_, p_149696_4_, p_149696_5_, p_149696_6_); - TileEntity tileentity = p_149696_1_.getTileEntity(p_149696_2_, p_149696_3_, p_149696_4_); - return tileentity != null ? tileentity.receiveClientEvent(p_149696_5_, p_149696_6_) : false; - } - - @Override - public TileEntity createNewTileEntity(World world, int metadata) { - return new TileEntityPlayerDoorBase(this, metadata); - } - - @Override - public TileEntity createTileEntity(World world, int metadata) { - return new TileEntityPlayerDoorBase(this, metadata); - } -} diff --git a/src/main/java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java b/src/main/java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java deleted file mode 100644 index 2d2a407057..0000000000 --- a/src/main/java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java +++ /dev/null @@ -1,366 +0,0 @@ -package gtPlusPlus.core.block.general.redstone; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.common.items.GT_MetaGenerated_Tool_01; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.itemblock.ItemBlockMeta; -import gtPlusPlus.core.tileentities.general.redstone.TileEntityRedstoneHandler; -import gtPlusPlus.core.util.minecraft.InventoryUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; - -public abstract class BlockGenericRedstone extends BlockContainer { - - public BlockGenericRedstone(String aUnlocalizedSuffix, String aDisplayName) { - super(Material.redstoneLight); - this.setBlockName("blockGenericRedstone." + aUnlocalizedSuffix); - this.setHardness(3f); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, ItemBlockMeta.class, "blockGenericRedstone." + aUnlocalizedSuffix); - } - - private final HashMap> mTextures = new HashMap>(); - - /** - * A map of the textures used for this blocks. The key is the meta, then each internal map holds textures tied to - * each forge direction. Do not use unknown direction. - * - * @return - */ - public HashMap> getTextureArray() { - return mTextures; - } - - public abstract void generateTextureArray(final IIconRegister iicon); - - @Override - @SideOnly(Side.CLIENT) - public final void registerBlockIcons(final IIconRegister iicon) { - generateTextureArray(iicon); - this.blockIcon = iicon.registerIcon("redstone_block"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, - final int side, final float lx, final float ly, final float lz) { - - if (world.isRemote) { - return true; - } - - boolean mDidTool = false; - // Check For Tools - try { - final ItemStack mHandStack = PlayerUtils.getItemStackInPlayersHand(world, player.getDisplayName()); - final Item mHandItem = mHandStack.getItem(); - if (ItemUtils.isItemGregtechTool(mHandStack)) { - - Logger.INFO("Found Tool in players hand!"); - - final TileEntityRedstoneHandler tile = (TileEntityRedstoneHandler) world.getTileEntity(x, y, z); - if (tile != null) { - if (tile.isScrewdriverable()) { - if (ItemUtils.isToolScrewdriver(mHandStack)) { - mDidTool = tile.onScrewdriverRMB(); - PlayerUtils.messagePlayer( - player, - "Adjusted Light level by 0.0625f. " + tile.getLightBrightness()); - } - } - if (tile.isMalletable()) { - if (ItemUtils.isToolMallet(mHandStack)) { - mDidTool = tile.onMalletRMB(); - PlayerUtils.messagePlayer(player, "Light Mode active: " + mDidTool); - } - } - if (tile.isWrenchable()) { - if (ItemUtils.isToolWrench(mHandStack)) { - mDidTool = tile.onWrenchRMB(); - } - } - } - } - } catch (final Throwable t) {} - if (mDidTool) { - return true; - } - - return false; - } - - @Override - public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { - - boolean mDidTool = false; - // Check For Tools - try { - final ItemStack mHandStack = PlayerUtils.getItemStackInPlayersHand(aWorld, aPlayer.getDisplayName()); - final Item mHandItem = mHandStack.getItem(); - if (mHandItem instanceof GT_MetaGenerated_Tool_01) { - - final TileEntityRedstoneHandler tile = (TileEntityRedstoneHandler) aWorld.getTileEntity(aX, aY, aZ); - if (tile != null) { - if (tile.isScrewdriverable()) { - if (ItemUtils.isToolScrewdriver(mHandStack)) { - mDidTool = tile.onScrewdriverLMB(); - } - } - if (tile.isMalletable()) { - if (ItemUtils.isToolMallet(mHandStack)) { - mDidTool = tile.onMalletLMB(); - } - } - if (tile.isWrenchable()) { - if (ItemUtils.isToolWrench(mHandStack)) { - mDidTool = tile.onWrenchLMB(); - } - } - } - } - } catch (Throwable t) {} - - if (!mDidTool && !aPlayer.capabilities.isCreativeMode) { - super.onBlockClicked(aWorld, aX, aY, aZ, aPlayer); - } else { - return; - } - } - - @Override - public abstract TileEntity createNewTileEntity(final World world, final int p_149915_2_); - - @Override - public void breakBlock(final World world, final int x, final int y, final int z, final Block block, - final int number) { - InventoryUtils.dropInventoryItems(world, x, y, z, block); - super.breakBlock(world, x, y, z, block, number); - } - - @Override - public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase entity, - final ItemStack stack) { - if (stack.hasDisplayName()) { - ((TileEntityRedstoneHandler) world.getTileEntity(x, y, z)).setCustomName(stack.getDisplayName()); - } - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, - final int z) { - return false; - } - - @Override - public int getLightValue() { - return super.getLightValue(); - } - - @Override - public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, - float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) { - // TODO Auto-generated method stub - return super.onBlockPlaced( - p_149660_1_, - p_149660_2_, - p_149660_3_, - p_149660_4_, - p_149660_5_, - p_149660_6_, - p_149660_7_, - p_149660_8_, - p_149660_9_); - } - - @Override - public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) { - TileEntityRedstoneHandler aThis = getTileEntity(world, x, y, z); - if (aThis != null) { - return aThis.isProvidingWeakPower(world, x, y, z, side); - } - return 0; - } - - @Override - public boolean canProvidePower() { - return false; - } - - @Override - public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) { - TileEntityRedstoneHandler aThis = getTileEntity(world, x, y, z); - if (aThis != null) { - return aThis.isProvidingStrongPower(world, x, y, z, side); - } - return 0; - } - - @Override - public boolean hasComparatorInputOverride() { - // TODO Auto-generated method stub - return super.hasComparatorInputOverride(); - } - - @Override - public int getComparatorInputOverride(World p_149736_1_, int p_149736_2_, int p_149736_3_, int p_149736_4_, - int p_149736_5_) { - // TODO Auto-generated method stub - return super.getComparatorInputOverride(p_149736_1_, p_149736_2_, p_149736_3_, p_149736_4_, p_149736_5_); - } - - @Override - public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) { - TileEntityRedstoneHandler aThis = getTileEntity(world, x, y, z); - if (aThis != null) { - return aThis.canConnectRedstone(world, x, y, z, side); - } - return false; - } - - @Override - public boolean shouldCheckWeakPower(IBlockAccess world, int x, int y, int z, int side) { - TileEntityRedstoneHandler aThis = getTileEntity(world, x, y, z); - if (aThis != null) { - return aThis.shouldCheckWeakPower(world, x, y, z, side); - } - return isNormalCube(); - } - - @Override - public boolean getWeakChanges(IBlockAccess world, int x, int y, int z) { - TileEntityRedstoneHandler aThis = getTileEntity(world, x, y, z); - if (aThis != null) { - return aThis.getWeakChanges(world, x, y, z); - } - return false; - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public abstract IIcon getIcon(final int ordinalSide, final int meta); - - @Override - public int damageDropped(final int damage) { - return damage; - } - - @Override - public abstract void getSubBlocks(final Item item, final CreativeTabs tab, final List list); - - /** - * Called whenever the block is added into the world. Args: world, x, y, z - */ - @Override - public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { - TileEntityRedstoneHandler aThis = getTileEntity(aWorld, aX, aY, aZ); - - if (!aWorld.isRemote) { - if (aThis.hasUpdatedRecently() && !aWorld.isBlockIndirectlyGettingPowered(aX, aY, aZ)) { - aWorld.scheduleBlockUpdate(aX, aY, aZ, this, 4); - } else if (!aThis.hasUpdatedRecently() && aWorld.isBlockIndirectlyGettingPowered(aX, aY, aZ)) { - aWorld.setBlock(aX, aY, aZ, Blocks.lit_redstone_lamp, 0, 2); - } - } - } - - /** - * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are - * their own) Args: x, y, z, neighbor Block - */ - @Override - public void onNeighborBlockChange(World aWorld, int aX, int aY, int aZ, Block p_149695_5_) { - - TileEntityRedstoneHandler aThis = getTileEntity(aWorld, aX, aY, aZ); - - if (!aWorld.isRemote) { - if (aThis.hasUpdatedRecently() && !aWorld.isBlockIndirectlyGettingPowered(aX, aY, aZ)) { - aWorld.scheduleBlockUpdate(aX, aY, aZ, this, 4); - } else if (!aThis.hasUp