Jump to content

Moritz

Forge Modder
  • Posts

    512
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Moritz's Achievements

Dragon Slayer

Dragon Slayer (6/8)

15

Reputation

  1. He needs that because he is using Static variables and all tileEntities are overriding each other. Remove the static from your variables (speed and the other one) and you will not have those problems anymore. For explaining: Static means no matter how often that class gets recreated that variable will be always the same for all of them. A none static version will be recreated and shares the data only with the current instance which created it.
  2. is even easier as expected use the on update function like this: @Override public void onUpdate() { if(!worldObj.isRemote) { if(worldObj.getWorldTime() % 10 == 0) { PacketDispatcher.sendPacketToAllPlayers(getDiscriptionPacket()); } } } that should work pretty fine!
  3. Use ItemWorldSaverData that is the TileEntity for the item. Also it has a NBTCall.
  4. In this case i would use the Retrogen Way. The Retrogen way is there perfect. When you save a chunk you could add a nbt that says randomly you have a meteor when you get loaded again. And when it get loaded these chunks which have it spawn a meteor. Hope the idea is good.
  5. There is a forge event that get always called when a entity kind gets spawned (any entity) just add a entity player filter and then you can work with it
  6. A thing i tried (what is a little bit risk if you have a week pc like me) add a command that digh out a whole chunk for you (everything but not ores) so you can see difference between biomes and how much your ores get generated and the vannilla ores are got generated. By the way use a extra thread for it. But this is kind of a expert version of Orefinding (in my opinien)
  7. If you are using 1.7, then nightly is the right thing. But if you working on a 1.6 mod use master. Master = Release Version, Nigthly = Test/BugFix/NewStuff Version. I do not know what 1.7 Require. But the Master Version for 1.6 do not require CCC.
  8. Short result i removed the Block From the game. BC has a pump that solve it.
  9. I had no luck with Crashreports. The log say sometimes that the NBT does not work but i can not find the place where the mcp server does save his log files. How do i activate the debug mode?
  10. Very Simple. As far as i can read is the String the name of the particle and the first 3 double are the coords of the block. And the last 3 double can be 0. Look into the fire or furnace class for that.
  11. Sounds weird but my Block+Tile causes the Server Threads to get problems and slowly but truely it starts to make the server slower and make the server crash with that. I do not know why this happen. I only know it happen only on the Server side and only on at this TileEntity. Ventil (TileEntity): package speiger.src.api.common.tile; import cpw.mods.fml.common.FMLLog; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.Packet132TileEntityData; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; import speiger.src.api.common.blocks.BlockGas; import speiger.src.api.common.config.APIItems; public class Ventil extends TileFacing implements IFluidHandler { public FluidTank tank = new FluidTank(8000); public int between = 0; @Override public void updateEntity() { super.updateEntity(); if(!worldObj.isRemote) { suckGas(); } } public void useForFire() { FMLLog.getLogger().info("Test"); int blockID = worldObj.getBlockId(xCoord, yCoord+1, zCoord); if(blockID != 0 && blockID == Block.fire.blockID) { if(tank.getFluid() != null && tank.getFluid().amount > 0) { between++; if(between >= 25) { between = 0; tank.drain(1, true); } } } } public void suckGas() { int blockID = worldObj.getBlockId(xCoord, yCoord-1, zCoord); if(blockID != 0 && blockID == APIItems.gas.blockID) { int meta = worldObj.getBlockMetadata(xCoord, yCoord-1, zCoord); BlockGas block = (BlockGas) Block.blocksList[blockID]; if(block != null) { FluidStack liquid = new FluidStack(APIItems.animalGas, 100); liquid.amount = 100; if(tank.fill(liquid, false) >= 100) { tank.fill(liquid, true); block.removeOneGas(worldObj, xCoord, yCoord-1, zCoord); } } } } public boolean isFireSource() { if(tank.getFluid() != null && tank.getFluid().amount > 0) { useForFire(); return true; } return false; } @Override public int getTextureFromTile(int meta, int side) { if(side == 0) return 128; else if(side == 1)return 130; else return 129; } @Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { if(resource.isFluidEqual(new FluidStack(APIItems.animalGas, 1000))) { return tank.fill(resource, doFill); } return 0; } @Override public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { return tank.drain(resource.amount, doDrain); } @Override public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { return tank.drain(maxDrain, doDrain); } @Override public boolean canFill(ForgeDirection from, Fluid fluid) { return true; } @Override public boolean canDrain(ForgeDirection from, Fluid fluid) { return true; } @Override public FluidTankInfo[] getTankInfo(ForgeDirection from) { return new FluidTankInfo[]{tank.getInfo()}; } @Override public void readFromNBT(NBTTagCompound par1) { super.readFromNBT(par1); if (par1.hasKey("FirstTank")) { FluidStack stack = FluidStack.loadFluidStackFromNBT(par1.getCompoundTag("FirstTank")); if(stack != null) { tank.setFluid(stack); } } } @Override public void writeToNBT(NBTTagCompound par1) { super.writeToNBT(par1); if (tank.getFluid() != null) { par1.setTag("FirstTank", tank.getFluid().writeToNBT(par1)); } } @Override public Packet getDescriptionPacket() { NBTTagCompound nbt = new NBTTagCompound(); super.writeToNBT(nbt); if (tank.getFluid() != null) { nbt.setTag("FirstTank", tank.getFluid().writeToNBT(nbt)); } return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, nbt); } @Override public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) { this.readFromNBT(pkt.data); } } Here my Block Code: BlockAPI (Block): package speiger.src.api.common.blocks; import java.util.List; import java.util.Random; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Icon; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import speiger.src.api.SpmodAPI; import speiger.src.api.common.config.APIItems; import speiger.src.api.common.functions.MachineRecipeMaker; import speiger.src.api.common.functions.PathProxy; import speiger.src.api.common.functions.TextureRegister; import speiger.src.api.common.lib.APIIDs; import speiger.src.api.common.tile.BCCompressor; import speiger.src.api.common.tile.BasicCompressor; import speiger.src.api.common.tile.BasicExpBench; import speiger.src.api.common.tile.CobbleWorkbench; import speiger.src.api.common.tile.ConverterExpBench; import speiger.src.api.common.tile.Enchanter; import speiger.src.api.common.tile.EssensCreater; import speiger.src.api.common.tile.FurzMachine; import speiger.src.api.common.tile.MobMachine; import speiger.src.api.common.tile.TileAlphaTree; import speiger.src.api.common.tile.TileEntityCobbleStorage; import speiger.src.api.common.tile.TileFacing; import speiger.src.api.common.tile.Ventil; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.Loader; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockAPI extends BlockContainer { Random rand = new Random(); public Class<? extends BasicCompressor> compressor = BasicCompressor.class; public BlockAPI(int id) { super(id, Material.iron); setCreativeTab(SpmodAPI.spmodAPI); this.setHardness(5F); this.setResistance(5F); } Icon[] mobFront = new Icon[22]; Icon[] mobSide = new Icon[22]; Icon[] cobbleStorage = new Icon[3]; Icon[] basicExp = new Icon[3]; Icon[] advExp = new Icon[3]; Icon[] cobbleWork = new Icon[3]; Icon[] alpha = new Icon[2]; Icon[] furz = new Icon[6]; Icon[] compressors = new Icon[5]; Icon[] Ventil = new Icon[3]; Icon[] enchanter = new Icon[3]; Icon[] essens = new Icon[3]; public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3) { par3.add(new ItemStack(par1, 1, 0)); par3.add(new ItemStack(par1, 1, 1)); par3.add(new ItemStack(par1, 1, 2)); par3.add(new ItemStack(par1, 1, 3)); par3.add(new ItemStack(par1, 1, 4)); par3.add(new ItemStack(par1, 1, 5)); par3.add(new ItemStack(par1, 1, 6)); par3.add(new ItemStack(par1, 1, 7)); par3.add(new ItemStack(par1, 1, ); par3.add(new ItemStack(par1, 1, 9)); par3.add(new ItemStack(par1, 1, 10)); } @Override public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); if(meta == 0) { TileEntity tile = world.getBlockTileEntity(x, y, z); if(tile != null && tile instanceof MobMachine) { MobMachine mob = (MobMachine) tile; if(mob.mode != -1) { ItemStack end = new ItemStack(APIItems.apiItem, 1, mob.mode); return end; } else { ItemStack end = new ItemStack(this.blockID, 1, meta); return end; } } else { ItemStack end = new ItemStack(this.blockID, 1, meta); return end; } } else { ItemStack end = new ItemStack(this.blockID, 1, meta); return end; } } public int quantityDropped(Random par1Random) { return 1; } @Override public boolean isBlockNormalCube(World world, int x, int y, int z) { TileEntity tile = world.getBlockTileEntity(x, y, z); if(tile != null && tile instanceof Ventil) { return true; } return false; } @Override public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) { return true; } @Override public Icon getBlockTexture(IBlockAccess world, int var1, int var2, int var3, int side) { TileEntity tile = world.getBlockTileEntity(var1, var2, var3); int meta = world.getBlockMetadata(var1, var2, var3); if(tile instanceof MobMachine) { MobMachine mob = (MobMachine)tile; if(mob.mode == -1) { if(side == mob.faceing)return mobFront[0]; else return mobSide[0]; } else { if(side == mob.faceing)return mobFront[mob.mode]; else return mobSide[mob.mode]; } } if(tile instanceof TileFacing) { TileFacing face = (TileFacing)tile; if(meta == 1) { if(side == face.facing)return cobbleStorage[0]; else if(side == 0 || side == 1)return cobbleStorage[1]; else return cobbleStorage[2]; } else if(meta == 2) { if(side == face.facing)return basicExp[0]; else if(side == 0 || side == 1)return basicExp[1]; else return basicExp[2]; } else if(meta == 3) { if(side == face.facing)return advExp[0]; else if(side == 0 || side == 1)return advExp[1]; else return advExp[2]; } else if(meta == 4) { if(side == face.facing)return cobbleWork[0]; else if(side == 0 || side == 1)return cobbleWork[1]; else return cobbleWork[2]; } else if(meta == 5) { if(side == face.facing)return alpha[0]; else return alpha[1]; } else if(meta == 6) { return furz[side]; } else if(meta == 7) { if(side == face.facing)return compressors[2]; else if(side == 0)return compressors[0]; else if(side == 1)return compressors[1]; else if(side == ForgeDirection.getOrientation(face.facing).getOpposite().ordinal())return compressors[3]; else return compressors[4]; } else if(meta == { if(side == 0)return Ventil[0]; else if(side == 1)return Ventil[1]; else return Ventil[2]; } else if(meta == 9) { if(side == 0)return enchanter[0]; else if(side == 1)return enchanter[1]; else return enchanter[2]; } else if(meta == 10) { if(side == face.facing)return essens[0]; else if(side == 0 || side == 1)return essens[1]; else return essens[2]; } } return null; } @Override public TileEntity createTileEntity(World var1, int meta) { if(meta == 0)return new MobMachine(); else if(meta == 1)return new TileEntityCobbleStorage(); else if(meta == 2)return new BasicExpBench(); else if(meta == 3)return new ConverterExpBench(); else if(meta == 4)return new CobbleWorkbench(); else if(meta == 5)return new TileAlphaTree(); else if(meta == 6)return new FurzMachine(); else if(meta == 7) { if(Loader.isModLoaded("BuildCraft|Energy")) { return new BCCompressor(); } return new BasicCompressor(); } else if(meta == 8)return new Ventil(); else if(meta == 9)return new Enchanter(); else if(meta == 10)return new EssensCreater(); return null; } @Override @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1) { for(int i = 0; i<TextureRegister.mobMachineFront.length;i++) { mobFront[i] = par1.registerIcon(TextureRegister.mobMachineFront[i]); mobSide[i] = par1.registerIcon(TextureRegister.mobMachineSide[i]); } for(int i = 0; i<3;i++) { basicExp[i] = par1.registerIcon(TextureRegister.expBench[i]); cobbleStorage[i] = par1.registerIcon(TextureRegister.cobbleStorage[i]); cobbleWork[i] = par1.registerIcon(TextureRegister.cobbleBench[i]); advExp[i] = par1.registerIcon(TextureRegister.transBench[i]); enchanter[i] = par1.registerIcon(TextureRegister.enchanter[i]); essens[i] = par1.registerIcon(TextureRegister.essens[i]); Ventil[i] = par1.registerIcon(TextureRegister.ventil[i]); } for(int i = 0;i<TextureRegister.animalChunkLoader.length;i++) { this.furz[i] = par1.registerIcon(TextureRegister.animalChunkLoader[i]); } for(int i = 0;i<2;i++) { this.alpha[i] = par1.registerIcon(TextureRegister.alphaSapling[i]); } for(int i = 0;i<this.compressors.length;i++) { this.compressors[i] = par1.registerIcon(TextureRegister.compressor[i]); } } @Override @SideOnly(Side.CLIENT) public Icon getIcon(int par1, int par2) { if(par2 == 0) { if(par1 == 3)return mobFront[0]; else return mobSide[0]; } else if(par2 == 1) { if(par1 == 3)return cobbleStorage[0]; else if(par1 == 0 || par1 == 1)return cobbleStorage[1]; else return cobbleStorage[2]; } else if(par2 == 2) { if(par1 == 3)return basicExp[0]; else if(par1 == 0 || par1 == 1)return basicExp[1]; else return basicExp[2]; } else if(par2 == 3) { if(par1 == 3)return advExp[0]; else if(par1 == 0 || par1 == 1)return advExp[1]; else return advExp[2]; } else if(par2 == 4) { if(par1 == 3)return cobbleWork[0]; else if(par1 == 0 || par1 == 1)return cobbleWork[1]; else return cobbleWork[2]; } else if(par2 == 5) { if(par1 == 3)return alpha[0]; else return alpha[1]; } else if(par2 == 6) { return furz[par1]; } else if(par2 == 7) { if(par1 == 3)return compressors[2]; else if(par1 == 0)return compressors[0]; else if(par1 == 1)return compressors[1]; else if(par1 == ForgeDirection.getOrientation(3).getOpposite().ordinal())return compressors[3]; else return compressors[3]; } else if(par2 == { if(par1 == 0)return Ventil[0]; else if(par1 == 1)return Ventil[1]; else return Ventil[2]; } else if(par2 == 9) { if(par1 == 0)return enchanter[0]; else if(par1 == 1)return enchanter[1]; else return enchanter[2]; } else if(par2 == 10) { if(par1 == 3)return essens[0]; else if(par1 == 0 || par1 == 1)return essens[1]; else return essens[2]; } return null; } public int damageDropped(int par1) { return par1; } public int idDropped(int par1, Random par2Random, int par3) { return this.blockID; } @Override public void onBlockPlacedBy(World par1, int par2, int par3, int par4, EntityLivingBase par5, ItemStack var1) { TileEntity tile = par1.getBlockTileEntity(par2, par3, par4); int facing = MathHelper.floor_double(par5.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int upanddown = Math.round(par5.rotationPitch); int rotation = 0; if (facing == 0) { rotation = ForgeDirection.NORTH.ordinal(); } else if (facing == 1) { rotation = ForgeDirection.EAST.ordinal(); } else if (facing == 2) { rotation = ForgeDirection.SOUTH.ordinal(); } else if (facing == 3) { rotation = ForgeDirection.WEST.ordinal(); } else { rotation = ForgeDirection.NORTH.ordinal(); } if(tile instanceof BasicCompressor) { BasicCompressor basic = (BasicCompressor) tile; basic.cound = 200; basic.setFacing(rotation); } if(tile instanceof MobMachine) { MobMachine mob = (MobMachine)tile; mob.setFacing(rotation); if(mob.placed > 100) { par1.setBlock(par2, par3, par4, 0); par1.markTileEntityForDespawn(mob); } if(!par1.isRemote) { if(mob.placed <= 100) { mob.placed++; } } FMLLog.getLogger().info("Current Placed: "+mob.placed); } else if(tile instanceof TileFacing) { TileFacing face = (TileFacing)tile; face.setFacing(rotation); } else if(tile instanceof BasicExpBench) { BasicExpBench beb = (BasicExpBench) tile; beb.setFacing(rotation); } else { return; } } public void fertilize(World par0, int x, int y, int z) { TileEntity par1 = par0.getBlockTileEntity(x, y, z); if(par1 != null && par1 instanceof TileAlphaTree) { TileAlphaTree tile = (TileAlphaTree) par1; tile.count+=500; FMLLog.getLogger().info("GrowLevel: "+tile.count); } } @Override public boolean onBlockActivated(World par1, int par2, int par3, int par4, EntityPlayer par5, int par6, float par7, float par8, float par9) { TileEntity tileentity = par1.getBlockTileEntity(par2, par3, par4); int meta = par1.getBlockMetadata(par2, par3, par4); if(par5.isSneaking()) { if(tileentity instanceof MobMachine) { MobMachine mob = (MobMachine)tileentity; mob.setFacing(PathProxy.setNextFacing(mob.getFacing())); par1.markBlockForUpdate(par2, par3, par4); par5.addExhaustion(3F); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); return true; } if(tileentity instanceof TileFacing) { TileFacing face = (TileFacing)tileentity; face.setFacing(PathProxy.setNextFacing(face.getFacing())); par1.markBlockForUpdate(par2, par3, par4); par5.addExhaustion(3F); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); return true; } return false; } ItemStack current = par5.inventory.getCurrentItem(); if(!par1.isRemote) { if(meta == { if(tileentity instanceof Ventil && current != null) { Ventil tile = (Ventil) tileentity; FluidStack available = tile.getTankInfo(ForgeDirection.UNKNOWN)[0].fluid; if(available != null && current.stackSize == 1) { ItemStack filled = FluidContainerRegistry.fillFluidContainer(available, current); if(filled != null) { FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(filled); if(liquid != null) { par5.inventory.setInventorySlotContents(par5.inventory.currentItem, filled); tile.drain(ForgeDirection.UNKNOWN, liquid.amount, true); return true; } } } } } if(meta == 0) { if(tileentity instanceof MobMachine) { MobMachine tile = (MobMachine)tileentity; if(tile.mode != -1) { if(tile != null) { par5.openGui(SpmodAPI.instance, APIIDs.mobmachineGUIID, par1, par2, par3, par4); return true; } } else if(tile.mode == -1) { if(par5.getCurrentEquippedItem() == null) { par5.addChatMessage("Machine is not Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == APIItems.apiItem) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(par5.getCurrentEquippedItem().getItemDamage()); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.porkRaw)//Pig { par5.getCurrentEquippedItem().stackSize--; tile.setMode(1); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == APIItems.sheepbone)//Sheep { par5.getCurrentEquippedItem().stackSize--; tile.setMode(2); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par5.addChatMessage("Machine Initialized"); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.beefRaw) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(3); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.chickenRaw) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(4); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.dyePowder && par5.getCurrentEquippedItem().getItemDamage() == 0) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(5); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == APIItems.mooshroombone) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(6); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.rottenFlesh) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(7); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.bone) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(; tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.silk) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(9); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.spiderEye) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(10); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.goldNugget) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(11); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.gunpowder) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(12); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.ghastTear) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(13); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.magmaCream) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(14); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.slimeBall) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(15); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.netherStalkSeeds) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(16); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.skull && par5.getCurrentEquippedItem().getItemDamage() == 0) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(17); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.enderPearl) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(18); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.eyeOfEnder) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(19); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par5.addChatMessage("Machine Initialized"); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.skull && par5.getCurrentEquippedItem().getItemDamage() == 1) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(20); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else if(par5.getCurrentEquippedItem().getItem() == Item.blazePowder) { par5.getCurrentEquippedItem().stackSize--; tile.setMode(21); tile.setFacing(tile.getFacing()); par1.markBlockForUpdate(par2, par3, par4); par1.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); par5.addChatMessage("Machine Initialized"); return true; } else { par5.addChatMessage("Machine is not Initialized"); return true; } } } } else { if(tileentity instanceof TileFacing) { TileFacing face = (TileFacing)tileentity; int id = 0; if(meta == 1)id = APIIDs.cobblestorageGUIID; else if(meta == 2)id = APIIDs.basicexpbenchGUIID; else if(meta == 3)id = APIIDs.converterexpbenchGUIID; else if(meta == 4)id = APIIDs.cobblestoneworkbenchGUIID; else if(meta == 7)id = APIIDs.compressorGUIID; else if(meta == 9)id = APIIDs.EnchanterGUIID; else if(meta == 10)id = APIIDs.EssensCreaterGUIID; if(face != null && id != 0) { par5.openGui(SpmodAPI.instance, id, par1, par2, par3, par4); if(meta == 7) { MachineRecipeMaker.getRecipes().updateRecipes(); } return true; } } } if(meta == 5) { return false; } } return true; } public boolean addItemStackToInventory(InventoryPlayer par1, ItemStack par2) { for (int i = 0; i < par1.getSizeInventory(); i++) { ItemStack current = par1.getStackInSlot(i); if (current != null) { if (current.isItemEqual(par2) && current.stackSize + par2.stackSize <= 64 && current.getMaxStackSize() > 1) { par1.getStackInSlot(i).stackSize += par2.stackSize; return true; } } } for (int i = 0; i < 36; i++) { ItemStack current = par1.getStackInSlot(i); if (current == null) { par1.setInventorySlotContents(i, par2); return true; } } return false; } public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { if(par1World.getBlockTileEntity(par2, par3, par4) != null && par1World.getBlockTileEntity(par2, par3, par4) instanceof BasicCompressor) { ((BasicCompressor)par1World.getBlockTileEntity(par2, par3, par4)).breaks(); } dropInventory(par1World, par2, par3, par4); this.dropBlock(par1World, par2, par3, par4); if(par1World.getBlockTileEntity(par2, par3, par4) != null && par1World.getBlockTileEntity(par2, par3, par4) instanceof MobMachine) { ((MobMachine)par1World.getBlockTileEntity(par2, par3, par4)).placed--; } super.breakBlock(par1World, par2, par3, par4, par5, par6); } public void dropBlock(World par0, int par1, int par2, int par3) { int meta = par0.getBlockMetadata(par1, par2, par3); if(meta == 0) { MobMachine mm = (MobMachine)par0.getBlockTileEntity(par1, par2, par3); if(mm != null) { if(!(mm.mode == -1)) { this.dropBlockAsItem_do(par0, par1, par2, par3, new ItemStack(APIItems.apiItem, 1, mm.mode)); } } } } @Override public TileEntity createNewTileEntity(World var1) { return null; } public static void doDistroyBlock(World world, int par1, int par2, int par3) { int meta = world.getBlockMetadata(par1, par2, par3); if(meta == 4) { world.setBlock(par1, par2, par3, 0); } } private void dropInventory(World world, int x, int y, int z) { TileEntity tileEntity = world.getBlockTileEntity(x, y, z); if (!(tileEntity instanceof IInventory)) return; IInventory inventory = (IInventory) tileEntity; for (int i = 0; i < inventory.getSizeInventory(); i++) { ItemStack itemStack = inventory.getStackInSlot(i); if (itemStack != null && itemStack.stackSize > 0) { float dX = rand.nextFloat() * 0.8F + 0.1F; float dY = rand.nextFloat() * 0.8F + 0.1F; float dZ = rand.nextFloat() * 0.8F + 0.1F; EntityItem entityItem = new EntityItem(world, x + dX, y + dY, z + dZ, new ItemStack(itemStack.itemID, itemStack.stackSize, itemStack.getItemDamage())); if (itemStack.hasTagCompound()) { entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy()); } float factor = 0.05F; entityItem.motionX = rand.nextGaussian() * factor; entityItem.motionY = rand.nextGaussian() * factor + 0.2F; entityItem.motionZ = rand.nextGaussian() * factor; world.spawnEntityInWorld(entityItem); itemStack.stackSize = 0; } } } public void updateTick(World world, int i, int j, int k, Random random) { notifyNeighbors(world, i, j, k); world.scheduleBlockUpdate(i, j, k, blockID, tickRate()); } public void onBlockDestroyedByPlayer(World world, int i, int j, int k, int l) { notifyNeighbors(world, i, j, k); } public void notifyNeighbors(World world, int i, int j, int k) { world.notifyBlocksOfNeighborChange(i, j, k, blockID); world.notifyBlocksOfNeighborChange(i, j - 1, k, blockID); world.notifyBlocksOfNeighborChange(i, j + 1, k, blockID); world.notifyBlocksOfNeighborChange(i - 1, j, k, blockID); world.notifyBlocksOfNeighborChange(i + 1, j, k, blockID); world.notifyBlocksOfNeighborChange(i, j, k - 1, blockID); world.notifyBlocksOfNeighborChange(i, j, k + 1, blockID); } public void onBlockAdded(World world, int i, int j, int k) { world.scheduleBlockUpdate(i, j, k, blockID, tickRate()); } public int tickRate() { return 1; } @Override public boolean isFireSource(World world, int x, int y, int z, int metadata, ForgeDirection side) { if(side == side.UP) { if(world.getBlockTileEntity(x, y, z) != null && world.getBlockTileEntity(x, y, z) instanceof Ventil) { Ventil tile = (Ventil) world.getBlockTileEntity(x, y, z); return tile.isFireSource(); } } return super.isFireSource(world, x, y, z, metadata, side); } }
  12. Try out the Java String formating (do not know if it works but try it out) String.format(Arguments, Your Text); %s = Text to show. %n = next Line. here a example: String.format("%s%n%s", "Text1", "Text2"); That should Print it like this: Text1 Text2 I hope it helps,Works.
  13. Its easier as you think. Forge has a full Finite Liquid Block class that does everything for you. You only have to tell what kind of liquid/fluid (i really hat the name change) it is. Thats easier as you think. Unless you do not try to make your own flowing code. Luckly Forge say: "You still have the choice"
  14. But the EntityPlayer class have it. If not MC have removed it. Thats why i calling it.
  15. Why so complicated? Just make it like this in your event: @SubscribeEvent public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) { event.player.addChatMessage("Welcome"); LogHelper.info(Reference.ID, event.player.getDisplayName() + " logged In!"); } and by the way the static could be the problem.
×
×
  • Create New...

Important Information

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