Jump to content

insane_gravy

Members
  • Posts

    28
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

insane_gravy's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hi everyone, I haven't done any modding work since Minecraft 1.7.10, so I'm more than a little rusty. Needless to say, I've been asked to update a mod that was created for Minecraft 1.5 by someone else. I've set everything up in Eclipse and made sure that the dependencies are all correct. When I open the mod up, I get hit with 2419 errors that all need fixing. I'm a bit over my head here because the modding environment looks so different from what I'm used to and really don't know where to start. Does anyone have any pointers on how to get this updated? I've attached an example of one of the files that needs fixing. BiologicalElement.java
  2. I assume I need a VillageHandler to do that, right? What do I need to create a village component?
  3. I'm trying to make a villager of my own, but it doesn't spawn naturally and I can only obtain it through a spawn egg. How do I get a villager to appear in the game?
  4. How is it creating a TileEntity by default? It should only create a TileEntity if a block is added and it detects a valid combination. I tried removing removing references to the superclass, but that doesn't fix it.
  5. I previously had a boolean field which would be set to "true" if the block being placed was the master block (ie: it would only be true if it was the last block in the combination). The same problem was still present even with this field present. Additionally, the GUI can only open if a TileEntity exists at the location, so it's creating TileEntities multiple times for some reason. Try this version of the boolean check. It has more console statements and should show the method calls occuring more than once. private boolean isValidCombination(int x, int y, int z, World world) { System.out.println("checking for valid combinations"); if (getNextX(x, y, z, world) && getNextZ(x, y, z, world)) { return getTopRightDiag(x, y, z, world); } if (getNextX(x, y, z, world) && getPrevZ(x, y, z, world)) { return getTopLeftDiag(x, y, z, world); } if (getPrevX(x, y, z, world) && getNextZ(x, y, z, world)) { return getBottomRightDiag(x, y, z, world); } if (getPrevX(x, y, z, world) && getPrevZ(x, y, z, world)) { return getBottomLeftDiag(x, y, z, world); } System.out.println("no combinations found"); return false; } private boolean getNextX(int x, int y, int z, World world) { return world.getBlockId(x + 1, y, z) == modHerbcraft.BlockOvenBrick.blockID; } private boolean getPrevX(int x, int y, int z, World world) { return world.getBlockId(x - 1, y, z) == modHerbcraft.BlockOvenBrick.blockID; } private boolean getNextZ(int x, int y, int z, World world) { return world.getBlockId(x, y, z + 1) == modHerbcraft.BlockOvenBrick.blockID; } private boolean getPrevZ(int x, int y, int z, World world) { return world.getBlockId(x, y, z - 1) == modHerbcraft.BlockOvenBrick.blockID; } private boolean getTopLeftDiag(int x, int y, int z, World world) { return world.getBlockId(x + 1, y, z - 1) == modHerbcraft.BlockOvenBrick.blockID; } private boolean getTopRightDiag(int x, int y, int z, World world) { return world.getBlockId(x + 1, y, z + 1) == modHerbcraft.BlockOvenBrick.blockID; } private boolean getBottomLeftDiag(int x, int y, int z, World world) { return world.getBlockId(x - 1, y, z - 1) == modHerbcraft.BlockOvenBrick.blockID; } private boolean getBottomRightDiag(int x, int y, int z, World world) { return world.getBlockId(x - 1, y, z - 1) == modHerbcraft.BlockOvenBrick.blockID; }
  6. Interesting. The TileEntity should only be called once, and that's when the last block is placed. I added a println statement at several points, and it's clear from console feedback that the method calls occur for all blocks when a new one is placed in close proximity to existing ones. The method calls should only happen once. What do I need to change to stop this from happening?
  7. Generally speaking, field declarations have to be made on an individual basis.
  8. This is the code that checks for valid combinations private boolean isValidCombination(int x, int y, int z, World world) { if (getNextX(x, y, z, world) && getNextZ(x, y, z, world)) { return getTopRightDiag(x, y, z, world); } if (getNextX(x, y, z, world) && getPrevZ(x, y, z, world)) { return getTopLeftDiag(x, y, z, world); } if (getPrevX(x, y, z, world) && getNextZ(x, y, z, world)) { return getBottomRightDiag(x, y, z, world); } if (getPrevX(x, y, z, world) && getPrevZ(x, y, z, world)) { return getBottomLeftDiag(x, y, z, world); } return false; } private boolean getNextX(int x, int y, int z, World world) { return world.getBlockId(x + 1, y, z) == modHerbcraft.BlockOvenBrick.blockID; } private boolean getPrevX(int x, int y, int z, World world) { return world.getBlockId(x - 1, y, z) == modHerbcraft.BlockOvenBrick.blockID; } private boolean getNextZ(int x, int y, int z, World world) { return world.getBlockId(x, y, z + 1) == modHerbcraft.BlockOvenBrick.blockID; } private boolean getPrevZ(int x, int y, int z, World world) { return world.getBlockId(x, y, z - 1) == modHerbcraft.BlockOvenBrick.blockID; } private boolean getTopLeftDiag(int x, int y, int z, World world) { return world.getBlockId(x + 1, y, z - 1) == modHerbcraft.BlockOvenBrick.blockID; } private boolean getTopRightDiag(int x, int y, int z, World world) { return world.getBlockId(x + 1, y, z + 1) == modHerbcraft.BlockOvenBrick.blockID; } private boolean getBottomLeftDiag(int x, int y, int z, World world) { return world.getBlockId(x - 1, y, z - 1) == modHerbcraft.BlockOvenBrick.blockID; } private boolean getBottomRightDiag(int x, int y, int z, World world) { return world.getBlockId(x + 1, y, z + 1) == modHerbcraft.BlockOvenBrick.blockID; } It's just a boolean check.
  9. Here's some of the code I've been working with @Override public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { if (isValidCombination(par2, par3, par4, par1World)) { if (par1World.getBlockTileEntity(par2, par3, par4) != null) { System.out.println("This is the master block"); TileEntityFurnace tile = (TileEntityFurnace) par1World.getBlockTileEntity(par2, par3, par4); par5EntityPlayer.displayGUIFurnace(tile); return true; } } return false; } public void onBlockAdded(World world, int x, int y, int z) { if (isValidCombination(x, y, z, world)) { super.onBlockAdded(world, x, y, z); System.out.println("this is a valid combination"); } } For some reason, this code creates three seperate TileEntities when the last block is placed. Can anyone see why this is occuring?
  10. Do those methods go in the TileEntity class or the Block class?
  11. I'm attempting to create a new furnace built like the coke oven furnace in Railcraft. However, I have no idea how to approach this. Thus far, I have the following files present. package insanegravy.herbcraft.common; import net.minecraft.src.EntityPlayer; import net.minecraft.src.FurnaceRecipes; import net.minecraft.src.IInventory; import net.minecraft.src.ItemStack; import net.minecraft.src.TileEntity; import net.minecraft.src.World; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ISidedInventory; public class TileOvenBrick extends TileEntity implements IMatrixEntity, IInventory, ISidedInventory { private ItemStack[] furnaceItemStacks = new ItemStack[3]; public TileOvenBrick() { } @Override public boolean isValidCombination() { TileOvenBrick[] x = (TileOvenBrick[]) getXBound(); TileOvenBrick[] y = (TileOvenBrick[]) getYBound(); TileOvenBrick[] z = (TileOvenBrick[]) getZBound(); return (Math.abs(x[0].xCoord - x[1].xCoord) == 1) && (Math.abs(y[0].yCoord - y[1].yCoord) == 1) && (Math.abs(z[0].zCoord - z[1].zCoord) == 1); } public static TileOvenBrick getAbove(TileOvenBrick tile) { TileEntity above = tile.worldObj.getBlockTileEntity(tile.xCoord, tile.yCoord + 1, tile.zCoord); if (above instanceof TileOvenBrick) { return (TileOvenBrick) above; } else { return null; } } public static TileOvenBrick getBelow(TileOvenBrick tile) { TileEntity below = tile.worldObj.getBlockTileEntity(tile.xCoord, tile.yCoord - 1, tile.zCoord); if (below instanceof TileOvenBrick) { return (TileOvenBrick) below; } else { return null; } } public static TileOvenBrick getNextX(TileOvenBrick tile) { TileEntity nextX = tile.worldObj.getBlockTileEntity(tile.xCoord + 1, tile.yCoord, tile.zCoord); if (nextX instanceof TileOvenBrick) { return (TileOvenBrick) nextX; } else { return null; } } public static TileOvenBrick getPrevX(TileOvenBrick tile) { TileEntity prevX = tile.worldObj.getBlockTileEntity(tile.xCoord - 1, tile.yCoord, tile.zCoord); if (prevX instanceof TileOvenBrick) { return (TileOvenBrick) prevX; } else { return null; } } public static TileOvenBrick getNextZ(TileOvenBrick tile) { TileEntity nextZ = tile.worldObj.getBlockTileEntity(tile.xCoord, tile.yCoord, tile.zCoord + 1); if (nextZ instanceof TileOvenBrick) { return (TileOvenBrick) nextZ; } else { return null; } } public static TileOvenBrick getPrevZ(TileOvenBrick tile) { TileEntity prevZ = tile.worldObj.getBlockTileEntity(tile.xCoord, tile.yCoord, tile.zCoord - 1); if (prevZ instanceof TileOvenBrick) { return (TileOvenBrick) prevZ; } else { return null; } } @Override public TileEntity[] getXBound() { TileEntity[] result = new TileOvenBrick[2]; TileOvenBrick nextX = this; TileOvenBrick prevX = this; for(; { TileOvenBrick temp = getNextX(nextX); if (temp != null) { nextX = temp; } else { result[0] = nextX; break; } } for(; { TileOvenBrick temp = getPrevX(prevX); if (temp != null) { prevX = temp; } else { result[1] = prevX; break; } } return result; } @Override public TileEntity[] getYBound() { TileEntity[] result = new TileOvenBrick[2]; TileOvenBrick nextY = this; TileOvenBrick prevY = this; for(; { TileOvenBrick temp = getAbove(nextY); if (temp != null) { nextY = temp; } else { result[0] = nextY; break; } } for(; { TileOvenBrick temp = getBelow(prevY); if (temp != null) { prevY = temp; } else { result[1] = prevY; break; } } return result; } @Override public TileEntity[] getZBound() { TileEntity[] result = new TileOvenBrick[2]; TileOvenBrick nextZ = this; TileOvenBrick prevZ = this; for(; { TileOvenBrick temp = getNextZ(nextZ); if (temp != null) { nextZ = temp; } else { result[0] = nextZ; break; } } for(; { TileOvenBrick temp = getPrevZ(prevZ); if (temp != null) { prevZ = temp; } else { result[1] = prevZ; break; } } return result; } public void smeltItem() { if (this.canSmelt()) { ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]); if (this.furnaceItemStacks[2] == null) { this.furnaceItemStacks[2] = var1.copy(); } else if (this.furnaceItemStacks[2].isItemEqual(var1)) { furnaceItemStacks[2].stackSize += var1.stackSize; } --this.furnaceItemStacks[0].stackSize; if (this.furnaceItemStacks[0].stackSize <= 0) { this.furnaceItemStacks[0] = null; } } } private boolean canSmelt() { if (this.furnaceItemStacks[0] == null) { return false; } else { ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]); if (var1 == null) return false; if (this.furnaceItemStacks[2] == null) return true; if (!this.furnaceItemStacks[2].isItemEqual(var1)) return false; int result = furnaceItemStacks[2].stackSize + var1.stackSize; return (result <= getInventoryStackLimit() && result <= var1.getMaxStackSize()); } } public int getInventoryStackLimit() { return 64; } @Override public int getStartInventorySide(ForgeDirection side) { // TODO Auto-generated method stub return 0; } @Override public int getSizeInventorySide(ForgeDirection side) { // TODO Auto-generated method stub return 0; } @Override public int getSizeInventory() { // TODO Auto-generated method stub return 0; } @Override public ItemStack getStackInSlot(int var1) { // TODO Auto-generated method stub return null; } @Override public ItemStack decrStackSize(int var1, int var2) { // TODO Auto-generated method stub return null; } @Override public ItemStack getStackInSlotOnClosing(int var1) { // TODO Auto-generated method stub return null; } @Override public void setInventorySlotContents(int var1, ItemStack var2) { // TODO Auto-generated method stub } @Override public String getInvName() { // TODO Auto-generated method stub return null; } @Override public boolean isUseableByPlayer(EntityPlayer var1) { // TODO Auto-generated method stub return false; } @Override public void openChest() { // TODO Auto-generated method stub } @Override public void closeChest() { // TODO Auto-generated method stub } } package insanegravy.herbcraft.common; import java.util.Random; import net.minecraft.src.Block; import net.minecraft.src.BlockContainer; import net.minecraft.src.EntityPlayer; import net.minecraft.src.Material; import net.minecraft.src.TileEntity; import net.minecraft.src.World; public class BlockOvenBrick extends BlockContainer { public BlockOvenBrick(int par1, int par2) { super(par1, par2, Material.rock); } @Override public TileEntity createNewTileEntity(World var1) { return new TileOvenBrick(); } @Override public boolean renderAsNormalBlock() { return false; } public boolean isOpaqueCube() { return false; } @Override public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { TileOvenBrick brick = (TileOvenBrick) par1World.getBlockTileEntity(par2, par3, par4); if (brick != null && brick.isValidCombination()) { return true; } else { return false; } } public int idDropped(int par1, Random par2Random, int par3) { return modHerbcraft.BlockOvenBrick.blockID; } } Beyond this, I have no idea what I'm supposed to do. If the blocks are placed in the proper arrangement, how do I get them to behave as a single unit?
×
×
  • Create New...

Important Information

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