Jump to content

apuppy120

Members
  • Posts

    14
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    Middle of Nowhere, America
  • Personal Text
    glub.

apuppy120's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I'm trying to make it so that I can break a block and place it back down and it keeps the TileEntity data from before. I managed to get this working... sorta. When I break a block it drops a ItemBlock of with the data stored from the tileEntity. I can place it back down and it is good, but if I break the block, and then break another of the same block with different tileEntity data, they both end up with the data of the second one broken. This always happens to all of the blocks when they exist as an item in the world, whether it be on the ground or in a chest, they always change their data to the most recently broken block. Here is my code:
  2. It is pretty much exactly the same as what I currently have. This is the code that I have in the PotentialBlock class in the breakBlock() method. @Override public void breakBlock(World world, int x, int y, int z, Block block, int p_149749_6_) { TilePotBlock t = (TilePotBlock)world.getTileEntity(x, y, z); ArrayList<ItemStack> items = new ArrayList<ItemStack>(); if (t instanceof TilePotBlock) { TilePotBlock tile = (TilePotBlock)t; ItemStack stack = new ItemStack(world.getBlock(x, y, z), 1); if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } stack.getTagCompound().setBoolean("potBlockR", tile.red); stack.getTagCompound().setBoolean("potBlockG", tile.green); stack.getTagCompound().setBoolean("potBlockB", tile.blue); stack.getTagCompound().setBoolean("potBlockIR", tile.ir); items.add(stack); world.spawnEntityInWorld(new EntityItem(world, x, y, z, items.get(0))); world.setBlock(x, y, z, Blocks.air); } } It is deleting the information when I'm placing it back down.
  3. I have the part that you put in breakBlock(), but what do you put in onBlockPlaced? You said "the opposite" and I don't quite get what the code for that would be.
  4. I saw something about it in someone else's similar problem that they ended up fixing, so I thought that I would test it. Here is the original code: if(entity.getEntityItem().getItem() == ASItem.antiItem) {...} EDIT: Nevermind, I found the problem. There was a semicolon at the end of an if() statement where there shouldn't be.
  5. I'm trying to get a specific item to kill the player or a nearby player if it exists as an EntityItem in world. The problem is that, even though I am making a check for it, it is running the kill code for all items. Any help?
  6. I've been looking around a bit for how to use the collisionRayTrace() method in Block and I haven't been able to find out how it works. I'm trying to make a block that shoots lines of particles in a random direction. I think I know how the vectors work, but I don't know how to use the in collisionRayTrace(). If anyone could help out it would be very appreciated.
  7. 1.7.10. I know that I need to subscribe, but I dont know how I'm supposed to, and apparently I'm also supposed to register a tick handler.
  8. I've been trying to figure out how to get a "Star Catcher" to work, where it drops an item downwards X amount of ticks. I've managed to get it to drop the item. but I can get it to increment a variable very tick, then when variable is = to Y, reset variable and do something. Here is my code (The code that drops the item isn't included, but if it was, it would be under tickEnd): public void tickStart(EnumSet<WorldTickEvent.Type> type, Object... tickData) { } public EnumSet<WorldTickEvent.Type> ticks() { return EnumSet.of(WorldTickEvent.Type.WORLD); } public void tickEnd(EnumSet<WorldTickEvent.Type> type, Object... tickData) { if(currentTick/20 < 15 || isLesserStarReady == false) { currentTick++; System.out.println("BlockTick!"); }else if(currentTick/20 >= 15) { System.out.println("Star Ready!"); isLesserStarReady = true; } } Please help?
×
×
  • Create New...

Important Information

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