From e8e899fb8ec40fc2a8094e3a1f65527af23b11e4 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 2 Apr 2019 14:47:39 +1000 Subject: + Added some basis for new redstone things. --- .../general/redstone/BlockGenericRedstone.java | 349 +++++++++++++++++++++ .../redstone/BlockGenericRedstoneDetector.java | 112 +++++++ .../redstone/BlockGenericRedstoneEmitter.java | 5 + 3 files changed, 466 insertions(+) create mode 100644 src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java create mode 100644 src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java create mode 100644 src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneEmitter.java (limited to 'src/Java/gtPlusPlus/core/block') diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java new file mode 100644 index 0000000000..14dac32b63 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java @@ -0,0 +1,349 @@ +package gtPlusPlus.core.block.general.redstone; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Random; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.common.items.GT_MetaGenerated_Tool_01; +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.PlayerUtils; +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; + +public abstract class BlockGenericRedstone extends BlockContainer { + + + @SuppressWarnings("deprecation") + 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); + LanguageRegistry.addName(this, aDisplayName); + + } + + + 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 abstract HashMap> getTextureArray(); + + + @Override + @SideOnly(Side.CLIENT) + public final void registerBlockIcons(final IIconRegister p_149651_1_) { + this.blockIcon = p_149651_1_.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 (mHandItem instanceof GT_MetaGenerated_Tool_01) { + + final TileEntityRedstoneHandler tile = (TileEntityRedstoneHandler) world.getTileEntity(x, y, z); + if (tile != null) { + if (tile.isScrewdriverable()) { + if ((mHandItem.getDamage(mHandStack) == 22) || (mHandItem.getDamage(mHandStack) == 150)){ + mDidTool = tile.onScrewdriverRMB(); + } + } + if (tile.isMalletable()) { + if ((mHandItem.getDamage(mHandStack) == 24) || (mHandItem.getDamage(mHandStack) == 154)){ + mDidTool = tile.onMalletRMB(); + } + } + if (tile.isWrenchable()) { + if ((mHandItem.getDamage(mHandStack) == 26) || (mHandItem.getDamage(mHandStack) == 164)){ + 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 ((mHandItem.getDamage(mHandStack) == 22) || (mHandItem.getDamage(mHandStack) == 150)){ + mDidTool = tile.onScrewdriverLMB(); + } + } + if (tile.isMalletable()) { + if ((mHandItem.getDamage(mHandStack) == 24) || (mHandItem.getDamage(mHandStack) == 154)){ + mDidTool = tile.onMalletLMB(); + } + } + if (tile.isWrenchable()) { + if ((mHandItem.getDamage(mHandStack) == 26) || (mHandItem.getDamage(mHandStack) == 164)){ + mDidTool = tile.onWrenchLMB(); + } + } + } + } + } + catch (Throwable t) {} + + if (!mDidTool) { + 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 false; + } + + @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 side, 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 + */ + 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 + */ + 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.hasUpdatedRecently() && aWorld.isBlockIndirectlyGettingPowered(aX, aY, aZ)) { + aWorld.setBlock(aX, aY, aZ, Blocks.lit_redstone_lamp, 0, 2); + } + } + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World aWorld, int aX, int aY, int aZ, Random p_149674_5_) { + if (!aWorld.isRemote && !aWorld.isBlockIndirectlyGettingPowered(aX, aY, aZ)) { + // aWorld.setBlock(aX, aY, aZ, Blocks.redstone_lamp, 0, 2); + } + } + + public TileEntityRedstoneHandler getTileEntity(IBlockAccess world, int aX, int aY, int aZ) { + TileEntity aTemp = world.getTileEntity(aX, aY, aZ); + if (aTemp != null) { + if (aTemp instanceof TileEntityRedstoneHandler) { + TileEntityRedstoneHandler g = (TileEntityRedstoneHandler) aTemp; + if (g != null) { + return g; + } + } + } + return null; + } + + + /** + * Gets an item for the block being called on. Args: world, x, y, z + */ + @SideOnly(Side.CLIENT) + @Override + public abstract Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_); + + /** + * Returns an item stack containing a single instance of the current block type. + * 'i' is the block's subtype/damage and is ignored for blocks which do not + * support subtypes. Blocks which cannot be harvested should return null. + */ + @Override + protected abstract ItemStack createStackedBlock(int p_149644_1_); + + @Override + public abstract ArrayList getDrops(final World world, final int x, final int y, final int z, final int metadata, final int fortune); + + @Override + public abstract Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_); + + +} \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java new file mode 100644 index 0000000000..3e7816f83a --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java @@ -0,0 +1,112 @@ +package gtPlusPlus.core.block.general.redstone; + +import java.util.List; +import java.util.Random; + +import gtPlusPlus.core.tileentities.general.redstone.TileEntityRedstoneHandler; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockGenericRedstoneDetector extends BlockGenericRedstone { + + public BlockGenericRedstoneDetector() { + super("detector", "Redstone Detector"); + setTickRandomly(true); + } + + @Override + public TileEntity createNewTileEntity(World world, int p_149915_2_) { + return new TileEntityRedstoneDetector(); + } + + public class TileEntityRedstoneDetector extends TileEntityRedstoneHandler { + public TileEntityRedstoneDetector() { + super(0); + } + } + + @Override + public void registerBlockIcons(IIconRegister p_149651_1_) { + // TODO Auto-generated method stub + super.registerBlockIcons(p_149651_1_); + } + + @Override + public int getLightValue() { + // TODO Auto-generated method stub + return super.getLightValue(); + } + + @Override + public int isProvidingWeakPower(IBlockAccess p_149709_1_, int p_149709_2_, int p_149709_3_, int p_149709_4_, + int p_149709_5_) { + return 0; + } + + @Override + public boolean canProvidePower() { + return false; + } + + @Override + public int isProvidingStrongPower(IBlockAccess p_149748_1_, int p_149748_2_, int p_149748_3_, int p_149748_4_, + int p_149748_5_) { + return 0; + } + + @Override + public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) { + // TODO Auto-generated method stub + super.getSubBlocks(p_149666_1_, p_149666_2_, p_149666_3_); + } + + @Override + public int getLightValue(IBlockAccess world, int x, int y, int z) { + // TODO Auto-generated method stub + return super.getLightValue(world, x, y, z); + } + + @Override + public boolean shouldCheckWeakPower(IBlockAccess world, int x, int y, int z, int side) { + // TODO Auto-generated method stub + return super.shouldCheckWeakPower(world, x, y, z, side); + } + + @Override + public void updateTick(World aWorld, int aX, int aY, int aZ, Random aRand) { + + TileEntity aThisTile = aWorld.getTileEntity(aX, aY, aZ); + if (aThisTile != null) { + TileEntityRedstoneHandler aRedstoneTile = (TileEntityRedstoneHandler) aThisTile; + aRedstoneTile.setCurrentTextureArray(null); + } + + + super.updateTick(aWorld, aX, aY, aZ, aRand); + } + + @Override + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected ItemStack createStackedBlock(int p_149644_1_) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneEmitter.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneEmitter.java new file mode 100644 index 0000000000..df8a929302 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneEmitter.java @@ -0,0 +1,5 @@ +package gtPlusPlus.core.block.general.redstone; + +public class BlockGenericRedstoneEmitter { + +} -- cgit From f6a126e4467c5bf7ab72249c7fc55df3bc574d94 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 2 Apr 2019 15:39:02 +1000 Subject: + Added TexturePackages. $ More work on redstone systems. --- src/Java/gtPlusPlus/core/block/ModBlocks.java | 3 + .../general/redstone/BlockGenericRedstone.java | 25 ++++- .../redstone/BlockGenericRedstoneDetector.java | 113 +++++++++++---------- 3 files changed, 84 insertions(+), 57 deletions(-) (limited to 'src/Java/gtPlusPlus/core/block') diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index 2b04356f52..8471c13351 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -11,6 +11,7 @@ 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.machine.CircuitProgrammer; import gtPlusPlus.core.block.machine.DecayablesChest; import gtPlusPlus.core.block.machine.FishTrap; @@ -140,6 +141,8 @@ public final class ModBlocks { blockCustomJukebox = new Machine_SuperJukebox(); blockPooCollector = new Machine_PooCollector(); + + new BlockGenericRedstoneDetector(); } diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java index 14dac32b63..3197d149c8 100644 --- a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java +++ b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java @@ -53,13 +53,18 @@ public abstract class BlockGenericRedstone extends BlockContainer { * 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 abstract HashMap> getTextureArray(); + public HashMap> getTextureArray() { + return mTextures; + } + + public abstract void generateTextureArray(final IIconRegister iicon); @Override @SideOnly(Side.CLIENT) - public final void registerBlockIcons(final IIconRegister p_149651_1_) { - this.blockIcon = p_149651_1_.registerIcon("redstone_block"); + public final void registerBlockIcons(final IIconRegister iicon) { + generateTextureArray(iicon); + this.blockIcon = iicon.registerIcon("redstone_block"); } @@ -305,8 +310,18 @@ public abstract class BlockGenericRedstone extends BlockContainer { * Ticks the block if it's been scheduled */ public void updateTick(World aWorld, int aX, int aY, int aZ, Random p_149674_5_) { - if (!aWorld.isRemote && !aWorld.isBlockIndirectlyGettingPowered(aX, aY, aZ)) { - // aWorld.setBlock(aX, aY, aZ, Blocks.redstone_lamp, 0, 2); + TileEntityRedstoneHandler aTile = getTileEntity(aWorld, aX, aY, aZ); + // Client side handling + if (aTile != null) { + this.setLightLevel(aTile.getLightBrightness()); + } + // Only continue on server + if (aWorld.isRemote) { + return; + } + if (aTile != null) { + if (aTile.isGettingIndirectlyPowered()) { + } } } diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java index 3e7816f83a..7728b29a7c 100644 --- a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java +++ b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java @@ -1,17 +1,21 @@ package gtPlusPlus.core.block.general.redstone; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Random; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.general.redstone.TileEntityRedstoneHandler; -import net.minecraft.block.Block; +import gtPlusPlus.core.util.minecraft.ItemUtils; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; +import net.minecraft.util.IIcon; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; public class BlockGenericRedstoneDetector extends BlockGenericRedstone { @@ -32,81 +36,86 @@ public class BlockGenericRedstoneDetector extends BlockGenericRedstone { } @Override - public void registerBlockIcons(IIconRegister p_149651_1_) { - // TODO Auto-generated method stub - super.registerBlockIcons(p_149651_1_); - } - - @Override - public int getLightValue() { - // TODO Auto-generated method stub - return super.getLightValue(); + public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List aList) { + aList.add(ItemUtils.getSimpleStack(this)); } - @Override - public int isProvidingWeakPower(IBlockAccess p_149709_1_, int p_149709_2_, int p_149709_3_, int p_149709_4_, - int p_149709_5_) { - return 0; - } @Override - public boolean canProvidePower() { - return false; - } - - @Override - public int isProvidingStrongPower(IBlockAccess p_149748_1_, int p_149748_2_, int p_149748_3_, int p_149748_4_, - int p_149748_5_) { - return 0; + public void updateTick(World aWorld, int aX, int aY, int aZ, Random aRand) { + super.updateTick(aWorld, aX, aY, aZ, aRand); } @Override - public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) { + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { // TODO Auto-generated method stub - super.getSubBlocks(p_149666_1_, p_149666_2_, p_149666_3_); + return ItemUtils.getSimpleStack(this).getItem(); } @Override - public int getLightValue(IBlockAccess world, int x, int y, int z) { + public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { // TODO Auto-generated method stub - return super.getLightValue(world, x, y, z); + return ItemUtils.getSimpleStack(this).getItem(); } @Override - public boolean shouldCheckWeakPower(IBlockAccess world, int x, int y, int z, int side) { - // TODO Auto-generated method stub - return super.shouldCheckWeakPower(world, x, y, z, side); - } + protected ItemStack createStackedBlock(int p_149644_1_) { + return ItemUtils.simpleMetaStack(this, p_149644_1_, 1); + } + + public void generateTextureArray(final IIconRegister iicon) { + HashMap> aTextures = new HashMap>(); - @Override - public void updateTick(World aWorld, int aX, int aY, int aZ, Random aRand) { - TileEntity aThisTile = aWorld.getTileEntity(aX, aY, aZ); - if (aThisTile != null) { - TileEntityRedstoneHandler aRedstoneTile = (TileEntityRedstoneHandler) aThisTile; - aRedstoneTile.setCurrentTextureArray(null); + //New Block for Each Meta + int aMeta = 0; + { + HashMap aTempMap = new HashMap(); + aTempMap.put(ForgeDirection.UP, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.DOWN, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.NORTH, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.SOUTH, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.EAST, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.WEST, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTextures.put(aMeta++, aTempMap); } - - super.updateTick(aWorld, aX, aY, aZ, aRand); } @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { - // TODO Auto-generated method stub - return null; + public IIcon getIcon(int side, int meta) { + HashMap aTemp = getTextureArray().get(meta); + if (aTemp != null) { + IIcon aSide = aTemp.get(ForgeDirection.getOrientation(side)); + if (aSide != null) { + return aSide; + } + else { + //Smart calculate missing sides + if (side <= 1) { + for (int ss = 0; ss < 2; ss++) { + aSide = aTemp.get(ForgeDirection.getOrientation(side)); + if (aSide != null) { + return aSide; + } + } + } + for (int ss = 2; ss < 6; ss++) { + aSide = aTemp.get(ForgeDirection.getOrientation(side)); + if (aSide != null) { + return aSide; + } + } + } + } + return blockIcon; } @Override - protected ItemStack createStackedBlock(int p_149644_1_) { - // TODO Auto-generated method stub - return null; + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { + ArrayList aDrops = new ArrayList(); + aDrops.add(ItemUtils.getSimpleStack(this)); + return aDrops; } } -- cgit From 70a0df8a68725c16f0c0b959639b8e82cbbcf3a0 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 2 Apr 2019 17:44:13 +1000 Subject: % Work work --- src/Java/gtPlusPlus/core/block/ModBlocks.java | 4 +- .../general/redstone/BlockGenericRedstone.java | 24 ++- .../redstone/BlockGenericRedstoneDetector.java | 10 + .../general/redstone/BlockGenericRedstoneTest.java | 205 +++++++++++++++++++++ 4 files changed, 232 insertions(+), 11 deletions(-) create mode 100644 src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java (limited to 'src/Java/gtPlusPlus/core/block') diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index 8471c13351..b904b04556 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -12,6 +12,7 @@ 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.FishTrap; @@ -141,8 +142,9 @@ public final class ModBlocks { blockCustomJukebox = new Machine_SuperJukebox(); blockPooCollector = new Machine_PooCollector(); - + new BlockGenericRedstoneDetector(); + new BlockGenericRedstoneTest(); } diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java index 3197d149c8..a021a39ac8 100644 --- a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java +++ b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java @@ -10,10 +10,12 @@ import cpw.mods.fml.common.registry.LanguageRegistry; 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; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; @@ -86,20 +88,22 @@ public abstract class BlockGenericRedstone extends BlockContainer { final Item mHandItem = mHandStack.getItem(); if (mHandItem instanceof GT_MetaGenerated_Tool_01) { + Logger.INFO("Found Tool in players hand!"); + final TileEntityRedstoneHandler tile = (TileEntityRedstoneHandler) world.getTileEntity(x, y, z); if (tile != null) { - if (tile.isScrewdriverable()) { - if ((mHandItem.getDamage(mHandStack) == 22) || (mHandItem.getDamage(mHandStack) == 150)){ + if (tile.isScrewdriverable() || player.capabilities.isCreativeMode) { + if (ItemUtils.isToolScrewdriver(mHandStack)){ mDidTool = tile.onScrewdriverRMB(); } } - if (tile.isMalletable()) { - if ((mHandItem.getDamage(mHandStack) == 24) || (mHandItem.getDamage(mHandStack) == 154)){ + if (tile.isMalletable() || player.capabilities.isCreativeMode) { + if (ItemUtils.isToolMallet(mHandStack)){ mDidTool = tile.onMalletRMB(); } } - if (tile.isWrenchable()) { - if ((mHandItem.getDamage(mHandStack) == 26) || (mHandItem.getDamage(mHandStack) == 164)){ + if (tile.isWrenchable() || player.capabilities.isCreativeMode) { + if (ItemUtils.isToolWrench(mHandStack)){ mDidTool = tile.onWrenchRMB(); } } @@ -129,17 +133,17 @@ public abstract class BlockGenericRedstone extends BlockContainer { final TileEntityRedstoneHandler tile = (TileEntityRedstoneHandler) aWorld.getTileEntity(aX, aY, aZ); if (tile != null) { if (tile.isScrewdriverable()) { - if ((mHandItem.getDamage(mHandStack) == 22) || (mHandItem.getDamage(mHandStack) == 150)){ + if (ItemUtils.isToolScrewdriver(mHandStack)){ mDidTool = tile.onScrewdriverLMB(); } } if (tile.isMalletable()) { - if ((mHandItem.getDamage(mHandStack) == 24) || (mHandItem.getDamage(mHandStack) == 154)){ + if (ItemUtils.isToolMallet(mHandStack)){ mDidTool = tile.onMalletLMB(); } } if (tile.isWrenchable()) { - if ((mHandItem.getDamage(mHandStack) == 26) || (mHandItem.getDamage(mHandStack) == 164)){ + if (ItemUtils.isToolWrench(mHandStack)){ mDidTool = tile.onWrenchLMB(); } } @@ -148,7 +152,7 @@ public abstract class BlockGenericRedstone extends BlockContainer { } catch (Throwable t) {} - if (!mDidTool) { + if (!mDidTool && !aPlayer.capabilities.isCreativeMode) { super.onBlockClicked(aWorld, aX, aY, aZ, aPlayer); } else { diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java index 7728b29a7c..43247110f1 100644 --- a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java +++ b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java @@ -32,6 +32,16 @@ public class BlockGenericRedstoneDetector extends BlockGenericRedstone { public class TileEntityRedstoneDetector extends TileEntityRedstoneHandler { public TileEntityRedstoneDetector() { super(0); + } + + @Override + protected Class getTileEntityClass() { + return this.getClass(); + } + + @Override + protected String getTileEntityNameForRegistration() { + return "TileEntityRedstoneDetector"; } } diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java new file mode 100644 index 0000000000..f2a5c3f36a --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java @@ -0,0 +1,205 @@ +package gtPlusPlus.core.block.general.redstone; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Random; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.general.redstone.TileEntityRedstoneHandler; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +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; + +public class BlockGenericRedstoneTest extends BlockGenericRedstone { + + public BlockGenericRedstoneTest() { + super("test", "Redstone Test"); + setTickRandomly(true); + } + + @Override + public TileEntity createNewTileEntity(World world, int p_149915_2_) { + return new TileEntityRedstoneTest(); + } + + public class TileEntityRedstoneTest extends TileEntityRedstoneHandler { + public TileEntityRedstoneTest() { + super(2); + } + + @Override + public boolean isScrewdriverable() { + return true; + } + + @Override + public boolean onScrewdriverLMB() { + // TODO Auto-generated method stub + return super.onScrewdriverLMB(); + } + + @Override + public boolean onScrewdriverRMB() { + if (this.mLightValue + 1 <= 1) { + this.mLightValue += 1; + } + else { + this.mLightValue = 0; + } + Logger.INFO("Screwdriver | "+this.getLightBrightness()); + this.markForUpdate(); + return super.onScrewdriverRMB(); + } + + @Override + public boolean isMalletable() { + return true; + } + + @Override + public boolean onMalletLMB() { + // TODO Auto-generated method stub + return super.onMalletLMB(); + } + + @Override + public boolean onMalletRMB() { + this.mLightMode = Utils.invertBoolean(mLightMode); + return super.onMalletRMB(); + } + + @Override + public boolean isWrenchable() { + return true; + } + + @Override + public boolean onWrenchLMB() { + // TODO Auto-generated method stub + return super.onWrenchLMB(); + } + + @Override + public boolean onWrenchRMB() { + // TODO Auto-generated method stub + return super.onWrenchRMB(); + } + + @Override + protected Class getTileEntityClass() { + return this.getClass(); + } + + @Override + protected String getTileEntityNameForRegistration() { + // TODO Auto-generated method stub + return "TileEntityRedstoneTest"; + } + + @Override + public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) { + // TODO Auto-generated method stub + return super.isProvidingWeakPower(world, x, y, z, side); + } + + @Override + public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) { + // TODO Auto-generated method stub + return super.isProvidingStrongPower(world, x, y, z, side); + } + } + + @Override + public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List aList) { + aList.add(ItemUtils.getSimpleStack(this)); + } + + + @Override + public void updateTick(World aWorld, int aX, int aY, int aZ, Random aRand) { + super.updateTick(aWorld, aX, aY, aZ, aRand); + } + + @Override + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + // TODO Auto-generated method stub + return ItemUtils.getSimpleStack(this).getItem(); + } + + @Override + public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { + // TODO Auto-generated method stub + return ItemUtils.getSimpleStack(this).getItem(); + } + + @Override + protected ItemStack createStackedBlock(int p_149644_1_) { + return ItemUtils.simpleMetaStack(this, p_149644_1_, 1); + } + + public void generateTextureArray(final IIconRegister iicon) { + HashMap> aTextures = new HashMap>(); + + + //New Block for Each Meta + int aMeta = 0; + { + HashMap aTempMap = new HashMap(); + aTempMap.put(ForgeDirection.UP, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.DOWN, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.NORTH, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.SOUTH, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.EAST, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.WEST, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTextures.put(aMeta++, aTempMap); + } + + } + + @Override + public IIcon getIcon(int side, int meta) { + HashMap aTemp = getTextureArray().get(meta); + if (aTemp != null) { + IIcon aSide = aTemp.get(ForgeDirection.getOrientation(side)); + if (aSide != null) { + return aSide; + } + else { + //Smart calculate missing sides + if (side <= 1) { + for (int ss = 0; ss < 2; ss++) { + aSide = aTemp.get(ForgeDirection.getOrientation(side)); + if (aSide != null) { + return aSide; + } + } + } + for (int ss = 2; ss < 6; ss++) { + aSide = aTemp.get(ForgeDirection.getOrientation(side)); + if (aSide != null) { + return aSide; + } + } + } + } + return blockIcon; + } + + @Override + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { + ArrayList aDrops = new ArrayList(); + aDrops.add(ItemUtils.getSimpleStack(this)); + return aDrops; + } + +} -- cgit From af61708010aef717ecc3537fa115547acb9aa9c7 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 2 Apr 2019 18:20:28 +1000 Subject: $ More fixes. --- .../block/general/redstone/BlockGenericRedstone.java | 8 +++++--- .../general/redstone/BlockGenericRedstoneTest.java | 17 ++++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) (limited to 'src/Java/gtPlusPlus/core/block') diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java index a021a39ac8..65d89c0577 100644 --- a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java +++ b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java @@ -92,17 +92,19 @@ public abstract class BlockGenericRedstone extends BlockContainer { final TileEntityRedstoneHandler tile = (TileEntityRedstoneHandler) world.getTileEntity(x, y, z); if (tile != null) { - if (tile.isScrewdriverable() || player.capabilities.isCreativeMode) { + if (tile.isScrewdriverable()) { if (ItemUtils.isToolScrewdriver(mHandStack)){ mDidTool = tile.onScrewdriverRMB(); + PlayerUtils.messagePlayer(player, "Adjusted Light level by 0.0625f. "+tile.getLightBrightness()); } } - if (tile.isMalletable() || player.capabilities.isCreativeMode) { + if (tile.isMalletable()) { if (ItemUtils.isToolMallet(mHandStack)){ mDidTool = tile.onMalletRMB(); + PlayerUtils.messagePlayer(player, "Light Mode active: "+mDidTool); } } - if (tile.isWrenchable() || player.capabilities.isCreativeMode) { + if (tile.isWrenchable()) { if (ItemUtils.isToolWrench(mHandStack)){ mDidTool = tile.onWrenchRMB(); } diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java index f2a5c3f36a..ad59a83d0c 100644 --- a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java +++ b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java @@ -10,6 +10,7 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.general.redstone.TileEntityRedstoneHandler; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.world.explosions.ExplosionHandler; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -50,15 +51,14 @@ public class BlockGenericRedstoneTest extends BlockGenericRedstone { @Override public boolean onScrewdriverRMB() { - if (this.mLightValue + 1 <= 1) { - this.mLightValue += 1; + if (this.mLightValue + 0.0625f <= 1) { + this.mLightValue += 0.0625f; } else { this.mLightValue = 0; } - Logger.INFO("Screwdriver | "+this.getLightBrightness()); this.markForUpdate(); - return super.onScrewdriverRMB(); + return true; } @Override @@ -75,7 +75,8 @@ public class BlockGenericRedstoneTest extends BlockGenericRedstone { @Override public boolean onMalletRMB() { this.mLightMode = Utils.invertBoolean(mLightMode); - return super.onMalletRMB(); + this.markForUpdate(); + return mLightMode; } @Override @@ -91,8 +92,10 @@ public class BlockGenericRedstoneTest extends BlockGenericRedstone { @Override public boolean onWrenchRMB() { - // TODO Auto-generated method stub - return super.onWrenchRMB(); + Logger.INFO("Found Wrench"); + ExplosionHandler explode = new ExplosionHandler(); + explode.createExplosion(this.worldObj, null, this.xCoord, this.yCoord, this.zCoord, 1f, false, true); + return true; } @Override -- cgit From 60b9e2b720abca8908a1ac2a7f5767af08bccaf9 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 8 Apr 2019 14:12:52 +1000 Subject: % Allowed Skookum Choocher as a valid Wrench and Hard Hammer. $ Fixed infinite loop between TE and Block functions. --- .../gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Java/gtPlusPlus/core/block') diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java index 65d89c0577..b84c96be99 100644 --- a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java +++ b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java @@ -86,7 +86,7 @@ public abstract class BlockGenericRedstone extends BlockContainer { try { final ItemStack mHandStack = PlayerUtils.getItemStackInPlayersHand(world, player.getDisplayName()); final Item mHandItem = mHandStack.getItem(); - if (mHandItem instanceof GT_MetaGenerated_Tool_01) { + if (ItemUtils.isItemGregtechTool(mHandStack)) { Logger.INFO("Found Tool in players hand!"); @@ -250,7 +250,7 @@ public abstract class BlockGenericRedstone extends BlockContainer { if (aThis != null) { return aThis.shouldCheckWeakPower(world, x, y, z, side); } - return false; + return isNormalCube(); } @Override -- cgit From 08e93930faa225c4bcd91115160e91671aaa4884 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 8 Apr 2019 16:41:11 +1000 Subject: $ Finished work on HazmatUtils.java. < Reverted the changes to GeneralTooltipEventHandler.java. --- .../core/block/general/redstone/BlockGenericRedstoneTest.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src/Java/gtPlusPlus/core/block') diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java index ad59a83d0c..0f1f983cd0 100644 --- a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java +++ b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java @@ -45,7 +45,6 @@ public class BlockGenericRedstoneTest extends BlockGenericRedstone { @Override public boolean onScrewdriverLMB() { - // TODO Auto-generated method stub return super.onScrewdriverLMB(); } @@ -68,7 +67,6 @@ public class BlockGenericRedstoneTest extends BlockGenericRedstone { @Override public boolean onMalletLMB() { - // TODO Auto-generated method stub return super.onMalletLMB(); } @@ -86,7 +84,6 @@ public class BlockGenericRedstoneTest extends BlockGenericRedstone { @Override public boolean onWrenchLMB() { - // TODO Auto-generated method stub return super.onWrenchLMB(); } @@ -105,23 +102,21 @@ public class BlockGenericRedstoneTest extends BlockGenericRedstone { @Override protected String getTileEntityNameForRegistration() { - // TODO Auto-generated method stub return "TileEntityRedstoneTest"; } @Override public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) { - // TODO Auto-generated method stub return super.isProvidingWeakPower(world, x, y, z, side); } @Override public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) { - // TODO Auto-generated method stub return super.isProvidingStrongPower(world, x, y, z, side); } } + @SuppressWarnings("unchecked") @Override public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List aList) { aList.add(ItemUtils.getSimpleStack(this)); @@ -135,13 +130,11 @@ public class BlockGenericRedstoneTest extends BlockGenericRedstone { @Override public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { - // TODO Auto-generated method stub return ItemUtils.getSimpleStack(this).getItem(); } @Override public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { - // TODO Auto-generated method stub return ItemUtils.getSimpleStack(this).getItem(); } -- cgit From 95747970ad7d142a2a981119bdfafca5ab5b27d2 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Wed, 17 Apr 2019 10:35:07 +1000 Subject: + Added rmb information to Energy Buffers to show current Amperage. % Migrated getFieldFromGregtechProxy() from Meta_GT_Proxy.java to StaticFields59.java. $ Fixed hardness/resistance on a few blocks. $ Fixed bad handling of Item Entities by Fluid Collectors. --- src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java | 2 ++ src/Java/gtPlusPlus/core/block/machine/FishTrap.java | 1 + src/Java/gtPlusPlus/core/block/machine/Machine_PooCollector.java | 2 ++ 3 files changed, 5 insertions(+) (limited to 'src/Java/gtPlusPlus/core/block') diff --git a/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java b/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java index 1600d9944f..6ae1a52aba 100644 --- a/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java +++ b/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java @@ -51,6 +51,8 @@ public class CircuitProgrammer extends BlockContainer implements ITileTooltip @SuppressWarnings("deprecation") public CircuitProgrammer(){ super(Material.iron); + this.setHardness(5f); + this.setResistance(1f); this.setBlockName("blockCircuitProgrammer"); this.setCreativeTab(AddToCreativeTab.tabMachines); GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockCircuitProgrammer"); diff --git a/src/Java/gtPlusPlus/core/block/machine/FishTrap.java b/src/Java/gtPlusPlus/core/block/machine/FishTrap.java index b5e78f23ef..037ec61ced 100644 --- a/src/Java/gtPlusPlus/core/block/machine/FishTrap.java +++ b/src/Java/gtPlusPlus/core/block/machine/FishTrap.java @@ -51,6 +51,7 @@ public class FishTrap extends BlockContainer implements ITileTooltip super(Material.iron); this.setBlockName("blockFishTrap"); this.setHardness(5f); + this.setResistance(1f); this.setCreativeTab(AddToCreativeTab.tabMachines); GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockFishTrap"); LanguageRegistry.addName(this, "Fish Catcher"); diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_PooCollector.java b/src/Java/gtPlusPlus/core/block/machine/Machine_PooCollector.java index 23fdfe9733..945cf7b581 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_PooCollector.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_PooCollector.java @@ -38,6 +38,8 @@ public class Machine_PooCollector extends BlockContainer { public Machine_PooCollector() { super(Material.iron); + this.setHardness(5f); + this.setResistance(1f); this.setBlockName("blockPooCollector"); this.setCreativeTab(AddToCreativeTab.tabMachines); GameRegistry.registerBlock(this, ItemBlockMeta.class,"blockPooCollector"); -- cgit