Jump to content

PeterRDevries

Forge Modder
  • Posts

    169
  • Joined

  • Last visited

Everything posted by PeterRDevries

  1. wait you have an item and that places a block and that block create a te? or do you have only a block?
  2. Okay so I have this for one of my items ItemStack sample = new ItemStack(BlocksItems.Sample, 1); sample.stackTagCompound.setString("Researched", "yes"); then if you would send the itemstack via the constructor to the tileentity New TileEntityItem(ItemStack sample); then you could read your data in the tileentity using private ItemStack sample; public TileEntityItem(ItemStack item) { this.sample = item; } public static void yourmethod(){ sample.stackTagCompound.getstring("Researched"); } hope this helps you abit
  3. package net.minecraft.block; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.HashSet; import java.util.Random; import java.util.Set; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.Direction; import net.minecraft.util.IIcon; import net.minecraft.world.ChunkPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockRedstoneWire extends Block { private boolean field_150181_a = true; private Set field_150179_b = new HashSet(); @SideOnly(Side.CLIENT) private IIcon field_150182_M; @SideOnly(Side.CLIENT) private IIcon field_150183_N; @SideOnly(Side.CLIENT) private IIcon field_150184_O; @SideOnly(Side.CLIENT) private IIcon field_150180_P; private static final String __OBFID = "CL_00000295"; public BlockRedstoneWire() { super(Material.circuits); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F); } /** * 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) */ public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { return null; } /** * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. */ public boolean isOpaqueCube() { return false; } /** * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) */ public boolean renderAsNormalBlock() { return false; } /** * The type of render function that is called for this block */ public int getRenderType() { return 5; } /** * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called * when first determining what to render. */ @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_) { return 8388608; } /** * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z */ public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { return World.doesBlockHaveSolidTopSurface(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) || p_149742_1_.getBlock(p_149742_2_, p_149742_3_ - 1, p_149742_4_) == Blocks.glowstone; } private void func_150177_e(World p_150177_1_, int p_150177_2_, int p_150177_3_, int p_150177_4_) { this.func_150175_a(p_150177_1_, p_150177_2_, p_150177_3_, p_150177_4_, p_150177_2_, p_150177_3_, p_150177_4_); ArrayList arraylist = new ArrayList(this.field_150179_b); this.field_150179_b.clear(); for (int l = 0; l < arraylist.size(); ++l) { ChunkPosition chunkposition = (ChunkPosition)arraylist.get(l); p_150177_1_.notifyBlocksOfNeighborChange(chunkposition.chunkPosX, chunkposition.chunkPosY, chunkposition.chunkPosZ, this); } } private void func_150175_a(World p_150175_1_, int p_150175_2_, int p_150175_3_, int p_150175_4_, int p_150175_5_, int p_150175_6_, int p_150175_7_) { int k1 = p_150175_1_.getBlockMetadata(p_150175_2_, p_150175_3_, p_150175_4_); byte b0 = 0; int i3 = this.func_150178_a(p_150175_1_, p_150175_5_, p_150175_6_, p_150175_7_, b0); this.field_150181_a = false; int l1 = p_150175_1_.getStrongestIndirectPower(p_150175_2_, p_150175_3_, p_150175_4_); this.field_150181_a = true; if (l1 > 0 && l1 > i3 - 1) { i3 = l1; } int i2 = 0; for (int j2 = 0; j2 < 4; ++j2) { int k2 = p_150175_2_; int l2 = p_150175_4_; if (j2 == 0) { k2 = p_150175_2_ - 1; } if (j2 == 1) { ++k2; } if (j2 == 2) { l2 = p_150175_4_ - 1; } if (j2 == 3) { ++l2; } if (k2 != p_150175_5_ || l2 != p_150175_7_) { i2 = this.func_150178_a(p_150175_1_, k2, p_150175_3_, l2, i2); } if (p_150175_1_.getBlock(k2, p_150175_3_, l2).isNormalCube() && !p_150175_1_.getBlock(p_150175_2_, p_150175_3_ + 1, p_150175_4_).isNormalCube()) { if ((k2 != p_150175_5_ || l2 != p_150175_7_) && p_150175_3_ >= p_150175_6_) { i2 = this.func_150178_a(p_150175_1_, k2, p_150175_3_ + 1, l2, i2); } } else if (!p_150175_1_.getBlock(k2, p_150175_3_, l2).isNormalCube() && (k2 != p_150175_5_ || l2 != p_150175_7_) && p_150175_3_ <= p_150175_6_) { i2 = this.func_150178_a(p_150175_1_, k2, p_150175_3_ - 1, l2, i2); } } if (i2 > i3) { i3 = i2 - 1; } else if (i3 > 0) { --i3; } else { i3 = 0; } if (l1 > i3 - 1) { i3 = l1; } if (k1 != i3) { p_150175_1_.setBlockMetadataWithNotify(p_150175_2_, p_150175_3_, p_150175_4_, i3, 2); this.field_150179_b.add(new ChunkPosition(p_150175_2_, p_150175_3_, p_150175_4_)); this.field_150179_b.add(new ChunkPosition(p_150175_2_ - 1, p_150175_3_, p_150175_4_)); this.field_150179_b.add(new ChunkPosition(p_150175_2_ + 1, p_150175_3_, p_150175_4_)); this.field_150179_b.add(new ChunkPosition(p_150175_2_, p_150175_3_ - 1, p_150175_4_)); this.field_150179_b.add(new ChunkPosition(p_150175_2_, p_150175_3_ + 1, p_150175_4_)); this.field_150179_b.add(new ChunkPosition(p_150175_2_, p_150175_3_, p_150175_4_ - 1)); this.field_150179_b.add(new ChunkPosition(p_150175_2_, p_150175_3_, p_150175_4_ + 1)); } } private void func_150172_m(World p_150172_1_, int p_150172_2_, int p_150172_3_, int p_150172_4_) { if (p_150172_1_.getBlock(p_150172_2_, p_150172_3_, p_150172_4_) == this) { p_150172_1_.notifyBlocksOfNeighborChange(p_150172_2_, p_150172_3_, p_150172_4_, this); p_150172_1_.notifyBlocksOfNeighborChange(p_150172_2_ - 1, p_150172_3_, p_150172_4_, this); p_150172_1_.notifyBlocksOfNeighborChange(p_150172_2_ + 1, p_150172_3_, p_150172_4_, this); p_150172_1_.notifyBlocksOfNeighborChange(p_150172_2_, p_150172_3_, p_150172_4_ - 1, this); p_150172_1_.notifyBlocksOfNeighborChange(p_150172_2_, p_150172_3_, p_150172_4_ + 1, this); p_150172_1_.notifyBlocksOfNeighborChange(p_150172_2_, p_150172_3_ - 1, p_150172_4_, this); p_150172_1_.notifyBlocksOfNeighborChange(p_150172_2_, p_150172_3_ + 1, p_150172_4_, this); } } /** * Called whenever the block is added into the world. Args: world, x, y, z */ 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_); if (!p_149726_1_.isRemote) { this.func_150177_e(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_); p_149726_1_.notifyBlocksOfNeighborChange(p_149726_2_, p_149726_3_ + 1, p_149726_4_, this); p_149726_1_.notifyBlocksOfNeighborChange(p_149726_2_, p_149726_3_ - 1, p_149726_4_, this); this.func_150172_m(p_149726_1_, p_149726_2_ - 1, p_149726_3_, p_149726_4_); this.func_150172_m(p_149726_1_, p_149726_2_ + 1, p_149726_3_, p_149726_4_); this.func_150172_m(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_ - 1); this.func_150172_m(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_ + 1); if (p_149726_1_.getBlock(p_149726_2_ - 1, p_149726_3_, p_149726_4_).isNormalCube()) { this.func_150172_m(p_149726_1_, p_149726_2_ - 1, p_149726_3_ + 1, p_149726_4_); } else { this.func_150172_m(p_149726_1_, p_149726_2_ - 1, p_149726_3_ - 1, p_149726_4_); } if (p_149726_1_.getBlock(p_149726_2_ + 1, p_149726_3_, p_149726_4_).isNormalCube()) { this.func_150172_m(p_149726_1_, p_149726_2_ + 1, p_149726_3_ + 1, p_149726_4_); } else { this.func_150172_m(p_149726_1_, p_149726_2_ + 1, p_149726_3_ - 1, p_149726_4_); } if (p_149726_1_.getBlock(p_149726_2_, p_149726_3_, p_149726_4_ - 1).isNormalCube()) { this.func_150172_m(p_149726_1_, p_149726_2_, p_149726_3_ + 1, p_149726_4_ - 1); } else { this.func_150172_m(p_149726_1_, p_149726_2_, p_149726_3_ - 1, p_149726_4_ - 1); } if (p_149726_1_.getBlock(p_149726_2_, p_149726_3_, p_149726_4_ + 1).isNormalCube()) { this.func_150172_m(p_149726_1_, p_149726_2_, p_149726_3_ + 1, p_149726_4_ + 1); } else { this.func_150172_m(p_149726_1_, p_149726_2_, p_149726_3_ - 1, p_149726_4_ + 1); } } } 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_); if (!p_149749_1_.isRemote) { p_149749_1_.notifyBlocksOfNeighborChange(p_149749_2_, p_149749_3_ + 1, p_149749_4_, this); p_149749_1_.notifyBlocksOfNeighborChange(p_149749_2_, p_149749_3_ - 1, p_149749_4_, this); p_149749_1_.notifyBlocksOfNeighborChange(p_149749_2_ + 1, p_149749_3_, p_149749_4_, this); p_149749_1_.notifyBlocksOfNeighborChange(p_149749_2_ - 1, p_149749_3_, p_149749_4_, this); p_149749_1_.notifyBlocksOfNeighborChange(p_149749_2_, p_149749_3_, p_149749_4_ + 1, this); p_149749_1_.notifyBlocksOfNeighborChange(p_149749_2_, p_149749_3_, p_149749_4_ - 1, this); this.func_150177_e(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_); this.func_150172_m(p_149749_1_, p_149749_2_ - 1, p_149749_3_, p_149749_4_); this.func_150172_m(p_149749_1_, p_149749_2_ + 1, p_149749_3_, p_149749_4_); this.func_150172_m(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_ - 1); this.func_150172_m(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_ + 1); if (p_149749_1_.getBlock(p_149749_2_ - 1, p_149749_3_, p_149749_4_).isNormalCube()) { this.func_150172_m(p_149749_1_, p_149749_2_ - 1, p_149749_3_ + 1, p_149749_4_); } else { this.func_150172_m(p_149749_1_, p_149749_2_ - 1, p_149749_3_ - 1, p_149749_4_); } if (p_149749_1_.getBlock(p_149749_2_ + 1, p_149749_3_, p_149749_4_).isNormalCube()) { this.func_150172_m(p_149749_1_, p_149749_2_ + 1, p_149749_3_ + 1, p_149749_4_); } else { this.func_150172_m(p_149749_1_, p_149749_2_ + 1, p_149749_3_ - 1, p_149749_4_); } if (p_149749_1_.getBlock(p_149749_2_, p_149749_3_, p_149749_4_ - 1).isNormalCube()) { this.func_150172_m(p_149749_1_, p_149749_2_, p_149749_3_ + 1, p_149749_4_ - 1); } else { this.func_150172_m(p_149749_1_, p_149749_2_, p_149749_3_ - 1, p_149749_4_ - 1); } if (p_149749_1_.getBlock(p_149749_2_, p_149749_3_, p_149749_4_ + 1).isNormalCube()) { this.func_150172_m(p_149749_1_, p_149749_2_, p_149749_3_ + 1, p_149749_4_ + 1); } else { this.func_150172_m(p_149749_1_, p_149749_2_, p_149749_3_ - 1, p_149749_4_ + 1); } } } private int func_150178_a(World p_150178_1_, int p_150178_2_, int p_150178_3_, int p_150178_4_, int p_150178_5_) { if (p_150178_1_.getBlock(p_150178_2_, p_150178_3_, p_150178_4_) != this) { return p_150178_5_; } else { int i1 = p_150178_1_.getBlockMetadata(p_150178_2_, p_150178_3_, p_150178_4_); return i1 > p_150178_5_ ? i1 : p_150178_5_; } } /** * 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 p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) { if (!p_149695_1_.isRemote) { boolean flag = this.canPlaceBlockAt(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_); if (flag) { this.func_150177_e(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_); } else { this.dropBlockAsItem(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, 0, 0); p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_); } super.onNeighborBlockChange(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, p_149695_5_); } } public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Items.redstone; } public int isProvidingStrongPower(IBlockAccess p_149748_1_, int p_149748_2_, int p_149748_3_, int p_149748_4_, int p_149748_5_) { return !this.field_150181_a ? 0 : this.isProvidingWeakPower(p_149748_1_, p_149748_2_, p_149748_3_, p_149748_4_, p_149748_5_); } public int isProvidingWeakPower(IBlockAccess p_149709_1_, int p_149709_2_, int p_149709_3_, int p_149709_4_, int p_149709_5_) { if (!this.field_150181_a) { return 0; } else { int i1 = p_149709_1_.getBlockMetadata(p_149709_2_, p_149709_3_, p_149709_4_); if (i1 == 0) { return 0; } else if (p_149709_5_ == 1) { return i1; } else { boolean flag = func_150176_g(p_149709_1_, p_149709_2_ - 1, p_149709_3_, p_149709_4_, 1) || !p_149709_1_.getBlock(p_149709_2_ - 1, p_149709_3_, p_149709_4_).isNormalCube() && func_150176_g(p_149709_1_, p_149709_2_ - 1, p_149709_3_ - 1, p_149709_4_, -1); boolean flag1 = func_150176_g(p_149709_1_, p_149709_2_ + 1, p_149709_3_, p_149709_4_, 3) || !p_149709_1_.getBlock(p_149709_2_ + 1, p_149709_3_, p_149709_4_).isNormalCube() && func_150176_g(p_149709_1_, p_149709_2_ + 1, p_149709_3_ - 1, p_149709_4_, -1); boolean flag2 = func_150176_g(p_149709_1_, p_149709_2_, p_149709_3_, p_149709_4_ - 1, 2) || !p_149709_1_.getBlock(p_149709_2_, p_149709_3_, p_149709_4_ - 1).isNormalCube() && func_150176_g(p_149709_1_, p_149709_2_, p_149709_3_ - 1, p_149709_4_ - 1, -1); boolean flag3 = func_150176_g(p_149709_1_, p_149709_2_, p_149709_3_, p_149709_4_ + 1, 0) || !p_149709_1_.getBlock(p_149709_2_, p_149709_3_, p_149709_4_ + 1).isNormalCube() && func_150176_g(p_149709_1_, p_149709_2_, p_149709_3_ - 1, p_149709_4_ + 1, -1); if (!p_149709_1_.getBlock(p_149709_2_, p_149709_3_ + 1, p_149709_4_).isNormalCube()) { if (p_149709_1_.getBlock(p_149709_2_ - 1, p_149709_3_, p_149709_4_).isNormalCube() && func_150176_g(p_149709_1_, p_149709_2_ - 1, p_149709_3_ + 1, p_149709_4_, -1)) { flag = true; } if (p_149709_1_.getBlock(p_149709_2_ + 1, p_149709_3_, p_149709_4_).isNormalCube() && func_150176_g(p_149709_1_, p_149709_2_ + 1, p_149709_3_ + 1, p_149709_4_, -1)) { flag1 = true; } if (p_149709_1_.getBlock(p_149709_2_, p_149709_3_, p_149709_4_ - 1).isNormalCube() && func_150176_g(p_149709_1_, p_149709_2_, p_149709_3_ + 1, p_149709_4_ - 1, -1)) { flag2 = true; } if (p_149709_1_.getBlock(p_149709_2_, p_149709_3_, p_149709_4_ + 1).isNormalCube() && func_150176_g(p_149709_1_, p_149709_2_, p_149709_3_ + 1, p_149709_4_ + 1, -1)) { flag3 = true; } } return !flag2 && !flag1 && !flag && !flag3 && p_149709_5_ >= 2 && p_149709_5_ <= 5 ? i1 : (p_149709_5_ == 2 && flag2 && !flag && !flag1 ? i1 : (p_149709_5_ == 3 && flag3 && !flag && !flag1 ? i1 : (p_149709_5_ == 4 && flag && !flag2 && !flag3 ? i1 : (p_149709_5_ == 5 && flag1 && !flag2 && !flag3 ? i1 : 0)))); } } } /** * Can this block provide power. Only wire currently seems to have this change based on its state. */ public boolean canProvidePower() { return this.field_150181_a; } /** * Returns true if redstone wire can connect to the specified block. Params: World, X, Y, Z, side (not a normal * notch-side, this can be 0, 1, 2, 3 or -1) */ public static boolean isPowerProviderOrWire(IBlockAccess p_150174_0_, int p_150174_1_, int p_150174_2_, int p_150174_3_, int p_150174_4_) { Block block = p_150174_0_.getBlock(p_150174_1_, p_150174_2_, p_150174_3_); if (block == Blocks.redstone_wire) { return true; } else if (!Blocks.unpowered_repeater.func_149907_e(block)) { return block.canConnectRedstone(p_150174_0_, p_150174_1_, p_150174_2_, p_150174_3_, p_150174_4_); } else { int i1 = p_150174_0_.getBlockMetadata(p_150174_1_, p_150174_2_, p_150174_3_); return p_150174_4_ == (i1 & 3) || p_150174_4_ == Direction.rotateOpposite[i1 & 3]; } } /** * A randomly called display update to be able to add particles or other items for display */ @SideOnly(Side.CLIENT) public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_) { int l = p_149734_1_.getBlockMetadata(p_149734_2_, p_149734_3_, p_149734_4_); if (l > 0) { double d0 = (double)p_149734_2_ + 0.5D + ((double)p_149734_5_.nextFloat() - 0.5D) * 0.2D; double d1 = (double)((float)p_149734_3_ + 0.0625F); double d2 = (double)p_149734_4_ + 0.5D + ((double)p_149734_5_.nextFloat() - 0.5D) * 0.2D; float f = (float)l / 15.0F; float f1 = f * 0.6F + 0.4F; if (l == 0) { f1 = 0.0F; } float f2 = f * f * 0.7F - 0.5F; float f3 = f * f * 0.6F - 0.7F; if (f2 < 0.0F) { f2 = 0.0F; } if (f3 < 0.0F) { f3 = 0.0F; } p_149734_1_.spawnParticle("reddust", d0, d1, d2, (double)f1, (double)f2, (double)f3); } } public static boolean func_150176_g(IBlockAccess p_150176_0_, int p_150176_1_, int p_150176_2_, int p_150176_3_, int p_150176_4_) { if (isPowerProviderOrWire(p_150176_0_, p_150176_1_, p_150176_2_, p_150176_3_, p_150176_4_)) { return true; } else if (p_150176_0_.getBlock(p_150176_1_, p_150176_2_, p_150176_3_) == Blocks.powered_repeater) { int i1 = p_150176_0_.getBlockMetadata(p_150176_1_, p_150176_2_, p_150176_3_); return p_150176_4_ == (i1 & 3); } else { return false; } } /** * Gets an item for the block being called on. Args: world, x, y, z */ @SideOnly(Side.CLIENT) public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { return Items.redstone; } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_) { this.field_150182_M = p_149651_1_.registerIcon(this.getTextureName() + "_" + "cross"); this.field_150183_N = p_149651_1_.registerIcon(this.getTextureName() + "_" + "line"); this.field_150184_O = p_149651_1_.registerIcon(this.getTextureName() + "_" + "cross_overlay"); this.field_150180_P = p_149651_1_.registerIcon(this.getTextureName() + "_" + "line_overlay"); this.blockIcon = this.field_150182_M; } @SideOnly(Side.CLIENT) public static IIcon getRedstoneWireIcon(String p_150173_0_) { return p_150173_0_.equals("cross") ? Blocks.redstone_wire.field_150182_M : (p_150173_0_.equals("line") ? Blocks.redstone_wire.field_150183_N : (p_150173_0_.equals("cross_overlay") ? Blocks.redstone_wire.field_150184_O : (p_150173_0_.equals("line_overlay") ? Blocks.redstone_wire.field_150180_P : null))); } } Only because I had to make a simular block for my mod
  4. Arent you already sending your data to you TE in this line? return new ConveyorBeltTileEntity(ItemData data);
  5. Then would you maybe know why it isn't saving the data correctly? pretty wierd because it used to but now it doesn't BlockCode package molecularscience.moditems; import java.util.List; import java.util.Random; import molecularscience.MolecularScience; 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.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.world.ColorizerGrass; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockHeatConductant extends BlockContainer{ int conductiveness = 0; public BlockHeatConductant(Material material, int conduct) { super(material); this.setCreativeTab(MolecularScience.MBlocks); this.setBlockTextureName("molecularscience:BlockHeatConductant"); this.conductiveness = conduct; } @Override public TileEntity createNewTileEntity(World var1, int var2) { return new TileEntityHeatConductant(this, conductiveness); } public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_){} @Override public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_) { p_149670_5_.attackEntityFrom(DamageSource.fallingBlock, 2); } @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_) { int temp = 0; TileEntityHeatConductant tile = (TileEntityHeatConductant) p_149720_1_.getTileEntity(p_149720_2_, p_149720_3_, p_149720_4_); if (tile != null) { temp = tile.color; } return temp; } public boolean isOpaqueCube(){ return false; } public boolean renderAsNormalBlock(){ return false; } } TileEntity4 package molecularscience.moditems; import org.apache.logging.log4j.core.pattern.ConverterKeys; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import molecularscience.MolecularScience; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class TileEntityHeatConductant extends TileEntity{ double Temperature = 21; int color = 0x555555; int conductiveness = 0; Block Block; public TileEntityHeatConductant(Block block, int conduct) { this.Block = block; this.conductiveness = conduct; } @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setDouble("Temperature", Temperature); nbt.setInteger("Color", color); } @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.Temperature = nbt.getDouble("Temperature"); this.color = nbt.getInteger("Color"); } @Override public boolean canUpdate(){ return true; } public int getColor(){ int intcolor = 0; int green = (int) ((64.0 / 700.0) * this.Temperature); int red = (int) ((255.0 / 700.0) * this.Temperature); return ((green*256) + (red*65536)); } @Override public void updateEntity() { checkblocks(worldObj.getBlock(xCoord+1, yCoord, zCoord).getLocalizedName(), "1 0 0"); checkblocks(worldObj.getBlock(xCoord-1, yCoord, zCoord).getLocalizedName(), "-1 0 0"); checkblocks(worldObj.getBlock(xCoord, yCoord+1, zCoord).getLocalizedName(), "0 1 0"); checkblocks(worldObj.getBlock(xCoord, yCoord-1, zCoord).getLocalizedName(), "0 -1 0"); checkblocks(worldObj.getBlock(xCoord, yCoord, zCoord+1).getLocalizedName(), "0 0 1"); checkblocks(worldObj.getBlock(xCoord, yCoord, zCoord-1).getLocalizedName(), "0 0 -1"); worldObj.scheduleBlockUpdate(xCoord, yCoord, zCoord, Block, 1); this.color = getColor(); this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } public void checkblocks(String block, String coord){ boolean aircool = true; String[] coords = coord.split(" "); if(block.equals("Fire")){ if(Temperature <= 600.0){ Temperature = Temperature + 0.1; } aircool = false; } if(block.equals("Lava")){ if(Temperature <= 700.0){ Temperature = Temperature + 0.5; }else{ } aircool = false; } if(block.equals("Water")){ if(Temperature >= 10.0){ Temperature = Temperature - 20; if(Temperature >= 100){ //worldObj.setBlockToAir(xCoord + Integer.parseInt(coords[0]), yCoord + Integer.parseInt(coords[1]), zCoord + Integer.parseInt(coords[2])); } } aircool = false; } if(block.contains("HeatConductant")){ int gettiletemp = 0; TileEntityHeatConductant tile = (TileEntityHeatConductant) worldObj.getTileEntity(xCoord + Integer.parseInt(coords[0]), yCoord + Integer.parseInt(coords[1]), zCoord + Integer.parseInt(coords[2])); if (tile != null) { gettiletemp = (int) tile.Temperature; } if(gettiletemp >= this.Temperature){ double add = gettiletemp - this.Temperature; add = add / conductiveness; Temperature = Temperature + add; } aircool = false; } if(aircool == true){ if(Temperature >= 20){ Temperature = Temperature - 0.3; } } } }
  6. Could I see your code?
  7. Try removing the @Override?
  8. Are you saving metadata to your itemstack?
  9. No but why would you want that?
  10. yeah i know but i thaught maybe that overrides my nbt again this is my nbt @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setDouble("Temperature", Temperature); nbt.setInteger("Color", color); } @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.Temperature = nbt.getDouble("Temperature"); this.color = nbt.getInteger("Color"); }
  11. Nah i just think it looks better when you use different classes
  12. if you use the redstone wire code for a block and remove the pushed by piston part it should work
  13. Maybe you could take a look at the thaumcraft code?
  14. yeah whoops i didn't see his error ..
  15. For the piston you should copy the bedrock code where it can't be pushed by a piston
  16. use the on item dropped and use this to get the data TileEntityHeatConductant tile = (TileEntityHeatConductant) world.getTileEntity(x,y,z); if (tile != null) { var = tile.thing you want; }
  17. You should copy the normal redstone dust code and use it for a block
  18. Check the minecraft snowball src i think the correct method is inthere
  19. I just don't advice registering all your items in your main class file this is how I do it: @EventHandler public void preInit(FMLPreInitializationEvent event){ BlocksItems.InitItems(); BlocksItems.InitBlocks(); BlocksItems.WorldGen(); Config.InitRecipes(); Config.registerMolecules(); Config.registerSamples(); Config.registerMineralProps(); Config.registerTileEntity(); proxy.registerRenderers(); } and then in my blockitems file(sorry it's a mess i need to clean it up more) public class BlocksItems { //items public static Item Emptyjar; public static Item Sample; public static Item Mineral; //blocks public static Block OrePlutonium; public static Block Evaporite; public static Block BlockSlowHeatConductant; public static Block BlockMediumHeatConductant; public static Block BlockFastHeatConductant; // public static Block ResearchTableIdle; // public static Block ResearchTableActive; public static void WorldGen(){ GameRegistry.registerWorldGenerator(new WorldGen(), 1); } public static void InitItems(){ Emptyjar = new ItemEmptyjar().setUnlocalizedName("Emptyjar").setCreativeTab(MolecularScience.MItems); Sample = new ItemSample().setUnlocalizedName("sample"); Mineral = new ItemMineral().setUnlocalizedName("Mineral"); GameRegistry.registerItem(Emptyjar,"Emptyjar"); GameRegistry.registerItem(Sample,"Sample"); GameRegistry.registerItem(Mineral,"Mineral"); } public static void InitBlocks(){ OrePlutonium = new BlockOre(Material.rock, 2).setHardness(3.0F).setBlockName("Plutoniumore"); Evaporite = new BlockEvaporite(Material.rock).setHardness(3.0F).setBlockName("Evaporite"); BlockSlowHeatConductant = new BlockHeatConductant(Material.rock, 50).setHardness(3.0F).setBlockName("BlockSlowHeatConductant"); BlockMediumHeatConductant = new BlockHeatConductant(Material.rock, 25).setHardness(3.0F).setBlockName("BlockMediumHeatConductant"); BlockFastHeatConductant = new BlockHeatConductant(Material.rock, 5).setHardness(3.0F).setBlockName("BlockFastHeatConductant"); // ResearchTableIdle = new ResearchTable(false).setBlockName("ResearchTableIdle").setCreativeTab(MolecularScience.Blocks); // ResearchTableActive = new ResearchTable(true).setBlockName("ResearchTableActive"); GameRegistry.registerBlock(OrePlutonium, "Plutoniumore"); GameRegistry.registerBlock(Evaporite, "Evaporite"); GameRegistry.registerBlock(BlockSlowHeatConductant, "BlockSlowHeatConductant"); GameRegistry.registerBlock(BlockMediumHeatConductant, "BlockMediumHeatConductant"); GameRegistry.registerBlock(BlockFastHeatConductant, "BlockFastHeatConductant"); // GameRegistry.registerBlock(ResearchTableIdle, "ResearchTableIdle"); // GameRegistry.registerBlock(ResearchTableActive, "ResearchTableActive"); } }
  20. I already tried that and yes it is the attack entity from.
  21. I don't know much about gui's but I think if you look at the furnaces progress bar I think you could implement that in a way so that the text changes.
  22. i'm already doing that could it be because I do this in the class start : double Temperature = 21; int color = 0x555555; int conductiveness = 0;
  23. Could you explain a bit more? I think you're reffering to tileentity's to save nbt data.
  24. attackentityfrom just doesn't works.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.