Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

MrImba

Members
  • Joined

  • Last visited

Everything posted by MrImba

  1. some on methods i understand but no all because i started to learn java some days ago. I just want to use my ricepts not fuel just my ricepts!
  2. I did:D package com.verdure.mod.contaier; import com.verdure.mod.entity.VDEntity_raw_furnace; import com.verdure.mod.recipte.VDraw_furnace_smelting; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotFurnaceFuel; import net.minecraft.inventory.SlotFurnaceOutput; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class VDContainer_raw_furance extends Container { private final IInventory tileFurnace; private int field_178152_f; private int field_178153_g; private int field_178154_h; private int field_178155_i; public VDContainer_raw_furance(InventoryPlayer playerInventory, IInventory furnaceInventory) { this.tileFurnace = furnaceInventory; this.addSlotToContainer(new Slot(furnaceInventory, 0, 56, 17)); this.addSlotToContainer(new SlotFurnaceFuel(furnaceInventory, 1, 56, 53)); this.addSlotToContainer(new SlotFurnaceOutput(playerInventory.player, furnaceInventory, 2, 116, 35)); for (int i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } for (int k = 0; k < 9; ++k) { this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142)); } } public void onCraftGuiOpened(ICrafting listener) { super.onCraftGuiOpened(listener); listener.sendAllWindowProperties(this, this.tileFurnace); } /** * Looks for changes made in the container, sends them to every listener. */ public void detectAndSendChanges() { super.detectAndSendChanges(); for (int i = 0; i < this.crafters.size(); ++i) { ICrafting icrafting = (ICrafting)this.crafters.get(i); if (this.field_178152_f != this.tileFurnace.getField(2)) { icrafting.sendProgressBarUpdate(this, 2, this.tileFurnace.getField(2)); } if (this.field_178154_h != this.tileFurnace.getField(0)) { icrafting.sendProgressBarUpdate(this, 0, this.tileFurnace.getField(0)); } if (this.field_178155_i != this.tileFurnace.getField(1)) { icrafting.sendProgressBarUpdate(this, 1, this.tileFurnace.getField(1)); } if (this.field_178153_g != this.tileFurnace.getField(3)) { icrafting.sendProgressBarUpdate(this, 3, this.tileFurnace.getField(3)); } } this.field_178152_f = this.tileFurnace.getField(2); this.field_178154_h = this.tileFurnace.getField(0); this.field_178155_i = this.tileFurnace.getField(1); this.field_178153_g = this.tileFurnace.getField(3); } @SideOnly(Side.CLIENT) public void updateProgressBar(int id, int data) { this.tileFurnace.setField(id, data); } public boolean canInteractWith(EntityPlayer playerIn) { return this.tileFurnace.isUseableByPlayer(playerIn); } /** * Take a stack from the specified inventory slot. */ public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) { ItemStack itemstack = null; Slot slot = (Slot)this.inventorySlots.get(index); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (index == 2) { if (!this.mergeItemStack(itemstack1, 3, 39, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); } else if (index != 1 && index != 0) { if (VDraw_furnace_smelting.instance().getSmeltingResult(itemstack1) != null) { if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } } else if (VDEntity_raw_furnace.isItemFuel(itemstack1)) { if (!this.mergeItemStack(itemstack1, 1, 2, false)) { return null; } } else if (index >= 3 && index < 30) { if (!this.mergeItemStack(itemstack1, 30, 39, false)) { return null; } } else if (index >= 30 && index < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) { return null; } } else if (!this.mergeItemStack(itemstack1, 3, 39, false)) { return null; } if (itemstack1.stackSize == 0) { slot.putStack((ItemStack)null); } else { slot.onSlotChanged(); } if (itemstack1.stackSize == itemstack.stackSize) { return null; } slot.onPickupFromSlot(playerIn, itemstack1); } return itemstack; } } package com.verdure.mod.gui; import com.verdure.mod.contaier.VDContainer_raw_furance; import com.verdure.mod.entity.VDEntity_raw_furnace; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class VDGui_raw_furnace extends GuiContainer { private static final ResourceLocation furnaceGuiTextures = new ResourceLocation("textures/gui/container/furnace.png"); /** The player inventory bound to this GUI. */ private final InventoryPlayer playerInventory; private IInventory tileFurnace; public VDGui_raw_furnace(InventoryPlayer playerInv, IInventory furnaceInv) { super(new VDContainer_raw_furance(playerInv, furnaceInv)); this.playerInventory = playerInv; this.tileFurnace = furnaceInv; } /** * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY */ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { String s = this.tileFurnace.getDisplayName().getUnformattedText(); this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752); } /** * Args : renderPartialTicks, mouseX, mouseY */ protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(furnaceGuiTextures); int i = (this.width - this.xSize) / 2; int j = (this.height - this.ySize) / 2; this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); if ( VDEntity_raw_furnace.isBurning(this.tileFurnace)) { int k = this.getBurnLeftScaled(13); this.drawTexturedModalRect(i + 56, j + 36 + 12 - k, 176, 12 - k, 14, k + 1); } int l = this.getCookProgressScaled(24); this.drawTexturedModalRect(i + 79, j + 34, 176, 14, l + 1, 16); } private int getCookProgressScaled(int pixels) { int i = this.tileFurnace.getField(2); int j = this.tileFurnace.getField(3); return j != 0 && i != 0 ? i * pixels / j : 0; } private int getBurnLeftScaled(int pixels) { int i = this.tileFurnace.getField(1); if (i == 0) { i = 200; } return this.tileFurnace.getField(0) * pixels / i; } }
  3. So i need to cr my own FurnaceContoiner?
  4. Hmm strange when i useing orinal recipe all ok but my furnace turn into original when it start working, i create 2 blocks when furnace off and on but minecraft use original furnace when it start burning. How can i add gif here? error code at net.minecraft.tileentity.TileEntity.writeToNBT(TileEntity.java:86) ~[TileEntity.class:?] at net.minecraft.tileentity.TileEntityLockable.writeToNBT(TileEntityLockable.java:23) ~[TileEntityLockable.class:?] at com.verdure.mod.entity.VDEntity_raw_furnace.writeToNBT(VDEntity_raw_furnace.java:183) ~[VDEntity_raw_furnace.class:?] at net.minecraft.world.chunk.storage.AnvilChunkLoader.writeChunkToNBT(AnvilChunkLoader.java:393) [AnvilChunkLoader.class:?] at net.minecraft.world.chunk.storage.AnvilChunkLoader.saveChunk(AnvilChunkLoader.java:172) [AnvilChunkLoader.class:?] at net.minecraft.world.gen.ChunkProviderServer.saveChunkData(ChunkProviderServer.java:257) [ChunkProviderServer.class:?] at net.minecraft.world.gen.ChunkProviderServer.saveChunks(ChunkProviderServer.java:324) [ChunkProviderServer.class:?] at net.minecraft.world.WorldServer.saveAllChunks(WorldServer.java:945) [WorldServer.class:?] at net.minecraft.server.MinecraftServer.saveAllWorlds(MinecraftServer.java:427) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:462) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:363) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:601) [MinecraftServer.class:?]
  5. i cant understand why should i create my own class if i can use original?
  6. or u mean my block? package com.verdure.mod.blocks; import java.util.Map; import java.util.Random; import com.google.common.collect.Maps; import com.verdure.mod.VerdureGlobal; import com.verdure.mod.entity.VDEntity_raw_furnace; import com.verdure.mod.items.VDItems; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.entity.layers.LayerBipedArmor; import net.minecraft.client.renderer.entity.layers.LayerHeldBlock; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.Container; import net.minecraft.inventory.InventoryHelper; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import com.verdure.mod.recipte.*; import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class raw_furnace extends BlockContainer { public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); private final boolean isBurning; private static boolean keepInventory; protected raw_furnace (boolean isBurning, String unlocalizedName) { super(Material.rock); this.setCreativeTab(VerdureGlobal.vdCreativeTabs); this.setUnlocalizedName(unlocalizedName); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); this.isBurning = isBurning; } /** * Get the Item that this Block should drop when harvested. */ public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(VDBlocks.raw_furnace); } public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { this.setDefaultFacing(worldIn, pos, state); } private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { Block block = worldIn.getBlockState(pos.north()).getBlock(); Block block1 = worldIn.getBlockState(pos.south()).getBlock(); Block block2 = worldIn.getBlockState(pos.west()).getBlock(); Block block3 = worldIn.getBlockState(pos.east()).getBlock(); EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); if (enumfacing == EnumFacing.NORTH && block.isFullBlock() && !block1.isFullBlock()) { enumfacing = EnumFacing.SOUTH; } else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock() && !block.isFullBlock()) { enumfacing = EnumFacing.NORTH; } else if (enumfacing == EnumFacing.WEST && block2.isFullBlock() && !block3.isFullBlock()) { enumfacing = EnumFacing.EAST; } else if (enumfacing == EnumFacing.EAST && block3.isFullBlock() && !block2.isFullBlock()) { enumfacing = EnumFacing.WEST; } worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2); } } @SideOnly(Side.CLIENT) @SuppressWarnings("incomplete-switch") public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (this.isBurning) { EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); double d0 = (double)pos.getX() + 0.5D; double d1 = (double)pos.getY() + rand.nextDouble() * 6.0D / 16.0D; double d2 = (double)pos.getZ() + 0.5D; double d3 = 0.52D; double d4 = rand.nextDouble() * 0.6D - 0.3D; switch (enumfacing) { case WEST: worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); break; case EAST: worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); break; case NORTH: worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D, new int[0]); break; case SOUTH: worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D, new int[0]); } } } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return true; } else { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof VDEntity_raw_furnace) { playerIn.displayGUIChest((VDEntity_raw_furnace)tileentity); playerIn.triggerAchievement(StatList.field_181741_Y); } return true; } } public static void setState(boolean active, World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); TileEntity tileentity = worldIn.getTileEntity(pos); keepInventory = true; if (active) { worldIn.setBlockState(pos, Blocks.lit_furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, Blocks.lit_furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } else { worldIn.setBlockState(pos, Blocks.furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, Blocks.furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } keepInventory = false; if (tileentity != null) { tileentity.validate(); worldIn.setTileEntity(pos, tileentity); } } /** * Returns a new instance of a block's tile entity class. Called on placing the block. */ public TileEntity createNewTileEntity(World worldIn, int meta) { return new VDEntity_raw_furnace(); } /** * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } /** * Called by ItemBlocks after a block is set in the world, to allow post-place logic */ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2); if (stack.hasDisplayName()) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof VDEntity_raw_furnace) { ((VDEntity_raw_furnace)tileentity).setCustomInventoryName(stack.getDisplayName()); } } } public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { if (!keepInventory) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof VDEntity_raw_furnace) { InventoryHelper.dropInventoryItems(worldIn, pos, (VDEntity_raw_furnace)tileentity); worldIn.updateComparatorOutputLevel(pos, this); } } super.breakBlock(worldIn, pos, state); } public boolean hasComparatorInputOverride() { return true; } public int getComparatorInputOverride(World worldIn, BlockPos pos) { return Container.calcRedstone(worldIn.getTileEntity(pos)); } @SideOnly(Side.CLIENT) public Item getItem(World worldIn, BlockPos pos) { return Item.getItemFromBlock(VDBlocks.raw_furnace); } /** * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render */ public int getRenderType() { return 3; } /** * Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...) */ @SideOnly(Side.CLIENT) public IBlockState getStateForEntityRender(IBlockState state) { return this.getDefaultState().withProperty(FACING, EnumFacing.SOUTH); } /** * Convert the given metadata into a BlockState for this Block */ public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(FACING, enumfacing); } /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state) { return ((EnumFacing)state.getValue(FACING)).getIndex(); } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {FACING}); } @Override public boolean isOpaqueCube() { return false; } @Override public boolean isFullCube() {
  7. but i use original gui from block furnace
  8. what is post container? ackage com.verdure.mod.entity; import com.verdure.mod.recipte.VDraw_furnace_smelting; import net.minecraft.block.Block; import net.minecraft.block.BlockFurnace; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerFurnace; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.SlotFurnaceFuel; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.item.ItemTool; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntityLockable; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraft.util.MathHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class VDEntity_raw_furnace extends TileEntityLockable implements ITickable, ISidedInventory { private static final int[] slotsTop = new int[] {0}; private static final int[] slotsBottom = new int[] {2, 1}; private static final int[] slotsSides = new int[] {1}; /** The ItemStacks that hold the items currently being used in the furnace */ private ItemStack[] furnaceItemStacks = new ItemStack[3]; /** The number of ticks that the furnace will keep burning */ private int furnaceBurnTime; /** The number of ticks that a fresh copy of the currently-burning item would keep the furnace burning for */ private int currentItemBurnTime; private int cookTime; private int totalCookTime; private String furnaceCustomName; /** * Returns the number of slots in the inventory. */ public int getSizeInventory() { return this.furnaceItemStacks.length; } /** * Returns the stack in the given slot. */ public ItemStack getStackInSlot(int index) { return this.furnaceItemStacks[index]; } /** * Removes up to a specified number of items from an inventory slot and returns them in a new stack. */ public ItemStack decrStackSize(int index, int count) { if (this.furnaceItemStacks[index] != null) { if (this.furnaceItemStacks[index].stackSize <= count) { ItemStack itemstack1 = this.furnaceItemStacks[index]; this.furnaceItemStacks[index] = null; return itemstack1; } else { ItemStack itemstack = this.furnaceItemStacks[index].splitStack(count); if (this.furnaceItemStacks[index].stackSize == 0) { this.furnaceItemStacks[index] = null; } return itemstack; } } else { return null; } } /** * Removes a stack from the given slot and returns it. */ public ItemStack removeStackFromSlot(int index) { if (this.furnaceItemStacks[index] != null) { ItemStack itemstack = this.furnaceItemStacks[index]; this.furnaceItemStacks[index] = null; return itemstack; } else { return null; } } /** * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). */ public void setInventorySlotContents(int index, ItemStack stack) { boolean flag = stack != null && stack.isItemEqual(this.furnaceItemStacks[index]) && ItemStack.areItemStackTagsEqual(stack, this.furnaceItemStacks[index]); this.furnaceItemStacks[index] = stack; if (stack != null && stack.stackSize > this.getInventoryStackLimit()) { stack.stackSize = this.getInventoryStackLimit(); } if (index == 0 && !flag) { this.totalCookTime = this.getCookTime(stack); this.cookTime = 0; this.markDirty(); } } /** * Get the name of this object. For players this returns their username */ public String getName() { return this.hasCustomName() ? this.furnaceCustomName : "container.furnace"; } /** * Returns true if this thing is named */ public boolean hasCustomName() { return this.furnaceCustomName != null && this.furnaceCustomName.length() > 0; } public void setCustomInventoryName(String p_145951_1_) { this.furnaceCustomName = p_145951_1_; } public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); NBTTagList nbttaglist = compound.getTagList("Items", 10); this.furnaceItemStacks = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); int j = nbttagcompound.getByte("Slot"); if (j >= 0 && j < this.furnaceItemStacks.length) { this.furnaceItemStacks[j] = ItemStack.loadItemStackFromNBT(nbttagcompound); } } this.furnaceBurnTime = compound.getInteger("BurnTime"); this.cookTime = compound.getInteger("CookTime"); this.totalCookTime = compound.getInteger("CookTimeTotal"); this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]); if (compound.hasKey("CustomName", ) { this.furnaceCustomName = compound.getString("CustomName"); } } public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); compound.setInteger("BurnTime", this.furnaceBurnTime); compound.setInteger("CookTime", this.cookTime); compound.setInteger("CookTimeTotal", this.totalCookTime); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.furnaceItemStacks.length; ++i) { if (this.furnaceItemStacks[i] != null) { NBTTagCompound nbttagcompound = new NBTTagCompound(); nbttagcompound.setByte("Slot", (byte)i); this.furnaceItemStacks[i].writeToNBT(nbttagcompound); nbttaglist.appendTag(nbttagcompound); } } compound.setTag("Items", nbttaglist); if (this.hasCustomName()) { compound.setString("CustomName", this.furnaceCustomName); } } /** * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. */ public int getInventoryStackLimit() { return 64; } /** * Furnace isBurning */ public boolean isBurning() { return this.furnaceBurnTime > 0; } @SideOnly(Side.CLIENT) public static boolean isBurning(IInventory p_174903_0_) { return p_174903_0_.getField(0) > 0; } /** * Like the old updateEntity(), except more generic. */ public void update() { boolean flag = this.isBurning(); boolean flag1 = false; if (this.isBurning()) { --this.furnaceBurnTime; } if (!this.worldObj.isRemote) { if (this.isBurning() || this.furnaceItemStacks[1] != null && this.furnaceItemStacks[0] != null) { if (!this.isBurning() && this.canSmelt()) { this.currentItemBurnTime = this.furnaceBurnTime = getItemBurnTime(this.furnaceItemStacks[1]); if (this.isBurning()) { flag1 = true; if (this.furnaceItemStacks[1] != null) { --this.furnaceItemStacks[1].stackSize; if (this.furnaceItemStacks[1].stackSize == 0) { this.furnaceItemStacks[1] = furnaceItemStacks[1].getItem().getContainerItem(furnaceItemStacks[1]); } } } } if (this.isBurning() && this.canSmelt()) { ++this.cookTime; if (this.cookTime == this.totalCookTime) { this.cookTime = 0; this.totalCookTime = this.getCookTime(this.furnaceItemStacks[0]); this.smeltItem(); flag1 = true; } } else { this.cookTime = 0; } } else if (!this.isBurning() && this.cookTime > 0) { this.cookTime = MathHelper.clamp_int(this.cookTime - 2, 0, this.totalCookTime); } if (flag != this.isBurning()) { flag1 = true; BlockFurnace.setState(this.isBurning(), this.worldObj, this.pos); } } if (flag1) { this.markDirty(); } } public int getCookTime(ItemStack stack) { return 200; } /** * Returns true if the furnace can smelt an item, i.e. has a source item, destination stack isn't full, etc. */ private boolean canSmelt() { if (this.furnaceItemStacks[0] == null) { return false; } else { ItemStack itemstack = VDraw_furnace_smelting.instance().getSmeltingResult(this.furnaceItemStacks[0]); if (itemstack == null) return false; if (this.furnaceItemStacks[2] == null) return true; if (!this.furnaceItemStacks[2].isItemEqual(itemstack)) return false; int result = furnaceItemStacks[2].stackSize + itemstack.stackSize; return result <= getInventoryStackLimit() && result <= this.furnaceItemStacks[2].getMaxStackSize(); //Forge BugFix: Make it respect stack sizes properly. } } /** * Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack */ public void smeltItem() { if (this.canSmelt()) { ItemStack itemstack = VDraw_furnace_smelting.instance().getSmeltingResult(this.furnaceItemStacks[0]); if (this.furnaceItemStacks[2] == null) { this.furnaceItemStacks[2] = itemstack.copy(); } else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem()) { this.furnaceItemStacks[2].stackSize += itemstack.stackSize; // Forge BugFix: Results may have multiple items } if (this.furnaceItemStacks[0].getItem() == Item.getItemFromBlock(Blocks.sponge) && this.furnaceItemStacks[0].getMetadata() == 1 && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].getItem() == Items.bucket) { this.furnaceItemStacks[1] = new ItemStack(Items.water_bucket); } --this.furnaceItemStacks[0].stackSize; if (this.furnaceItemStacks[0].stackSize <= 0) { this.furnaceItemStacks[0] = null; } } } /** * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't * fuel */ public static int getItemBurnTime(ItemStack p_145952_0_) { if (p_145952_0_ == null) { return 0; } else { Item item = p_145952_0_.getItem(); if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) { Block block = Block.getBlockFromItem(item); if (block == Blocks.wooden_slab) { return 150; } if (block.getMaterial() == Material.wood) { return 300; } if (block == Blocks.coal_block) { return 16000; } } if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200; if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200; if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200; if (item == Items.stick) return 100; if (item == Items.coal) return 1600; if (item == Items.lava_bucket) return 20000; if (item == Item.getItemFromBlock(Blocks.sapling)) return 100; if (item == Items.blaze_rod) return 2400; return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(p_145952_0_); } } public static boolean isItemFuel(ItemStack p_145954_0_) { /** * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't * fuel */ return getItemBurnTime(p_145954_0_) > 0; } /** * Do not make give this method the name canInteractWith because it clashes with Container */ public boolean isUseableByPlayer(EntityPlayer player) { return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D; } public void openInventory(EntityPlayer player) { } public void closeInventory(EntityPlayer player) { } /** * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. */ public boolean isItemValidForSlot(int index, ItemStack stack) { return index == 2 ? false : (index != 1 ? true : isItemFuel(stack) || SlotFurnaceFuel.isBucket(stack)); } public int[] getSlotsForFace(EnumFacing side) { return side == EnumFacing.DOWN ? slotsBottom : (side == EnumFacing.UP ? slotsTop : slotsSides); } /** * Returns true if automation can insert the given item in the given slot from the given side. Args: slot, item, * side */ public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) { return this.isItemValidForSlot(index, itemStackIn); } /** * Returns true if automation can extract the given item in the given slot from the given side. Args: slot, item, * side */ public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) { if (direction == EnumFacing.DOWN && index == 1) { Item item = stack.getItem(); if (item != Items.water_bucket && item != Items.bucket) { return false; } } return true; } public String getGuiID() { return "minecraft:furnace"; } public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) { return new ContainerFurnace(playerInventory, this); } public int getField(int id) { switch (id) { case 0: return this.furnaceBurnTime; case 1: return this.currentItemBurnTime; case 2: return this.cookTime; case 3: return this.totalCookTime; default: return 0; } } public void setField(int id, int value) { switch (id) { case 0: this.furnaceBurnTime = value; break; case 1: this.currentItemBurnTime = value; break; case 2: this.cookTime = value; break; case 3: this.totalCookTime = value; } } public int getFieldCount() { return 4; } public void clear() { for (int i = 0; i < this.furnaceItemStacks.length; ++i) { this.furnaceItemStacks[i] = null; } } net.minecraftforge.items.IItemHandler handlerTop = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.UP); net.minecraftforge.items.IItemHandler handlerBottom = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.DOWN); net.minecraftforge.items.IItemHandler handlerSide = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.WEST); @Override public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, net.minecraft.util.EnumFacing facing) { if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) if (facing == EnumFacing.DOWN) return (T) handlerBottom; else if (facing == EnumFacing.UP) return (T) handlerTop; else return (T) handlerSide; return super.getCapability(capability, facing); } }
  9. did, but when i push with item on slot for items game crashes:C
  10. I add in my furnacereciptes cooper ore to copper but, it crashes when i start to smelt my cooper
  11. I think i did all ok but when it start smelting game crashes package com.verdure.mod.entity; import com.verdure.mod.recipte.VDraw_furnace_smelting; import net.minecraft.block.Block; import net.minecraft.block.BlockFurnace; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerFurnace; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.SlotFurnaceFuel; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.item.ItemTool; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntityLockable; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraft.util.MathHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class VDEntity_raw_furnace extends TileEntityLockable implements ITickable, ISidedInventory { private static final int[] slotsTop = new int[] {0}; private static final int[] slotsBottom = new int[] {2, 1}; private static final int[] slotsSides = new int[] {1}; /** The ItemStacks that hold the items currently being used in the furnace */ private ItemStack[] furnaceItemStacks = new ItemStack[3]; /** The number of ticks that the furnace will keep burning */ private int furnaceBurnTime; /** The number of ticks that a fresh copy of the currently-burning item would keep the furnace burning for */ private int currentItemBurnTime; private int cookTime; private int totalCookTime; private String furnaceCustomName; /** * Returns the number of slots in the inventory. */ public int getSizeInventory() { return this.furnaceItemStacks.length; } /** * Returns the stack in the given slot. */ public ItemStack getStackInSlot(int index) { return this.furnaceItemStacks[index]; } /** * Removes up to a specified number of items from an inventory slot and returns them in a new stack. */ public ItemStack decrStackSize(int index, int count) { if (this.furnaceItemStacks[index] != null) { if (this.furnaceItemStacks[index].stackSize <= count) { ItemStack itemstack1 = this.furnaceItemStacks[index]; this.furnaceItemStacks[index] = null; return itemstack1; } else { ItemStack itemstack = this.furnaceItemStacks[index].splitStack(count); if (this.furnaceItemStacks[index].stackSize == 0) { this.furnaceItemStacks[index] = null; } return itemstack; } } else { return null; } } /** * Removes a stack from the given slot and returns it. */ public ItemStack removeStackFromSlot(int index) { if (this.furnaceItemStacks[index] != null) { ItemStack itemstack = this.furnaceItemStacks[index]; this.furnaceItemStacks[index] = null; return itemstack; } else { return null; } } /** * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). */ public void setInventorySlotContents(int index, ItemStack stack) { boolean flag = stack != null && stack.isItemEqual(this.furnaceItemStacks[index]) && ItemStack.areItemStackTagsEqual(stack, this.furnaceItemStacks[index]); this.furnaceItemStacks[index] = stack; if (stack != null && stack.stackSize > this.getInventoryStackLimit()) { stack.stackSize = this.getInventoryStackLimit(); } if (index == 0 && !flag) { this.totalCookTime = this.getCookTime(stack); this.cookTime = 0; this.markDirty(); } } /** * Get the name of this object. For players this returns their username */ public String getName() { return this.hasCustomName() ? this.furnaceCustomName : "container.furnace"; } /** * Returns true if this thing is named */ public boolean hasCustomName() { return this.furnaceCustomName != null && this.furnaceCustomName.length() > 0; } public void setCustomInventoryName(String p_145951_1_) { this.furnaceCustomName = p_145951_1_; } public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); NBTTagList nbttaglist = compound.getTagList("Items", 10); this.furnaceItemStacks = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); int j = nbttagcompound.getByte("Slot"); if (j >= 0 && j < this.furnaceItemStacks.length) { this.furnaceItemStacks[j] = ItemStack.loadItemStackFromNBT(nbttagcompound); } } this.furnaceBurnTime = compound.getInteger("BurnTime"); this.cookTime = compound.getInteger("CookTime"); this.totalCookTime = compound.getInteger("CookTimeTotal"); this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]); if (compound.hasKey("CustomName", ) { this.furnaceCustomName = compound.getString("CustomName"); } } public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); compound.setInteger("BurnTime", this.furnaceBurnTime); compound.setInteger("CookTime", this.cookTime); compound.setInteger("CookTimeTotal", this.totalCookTime); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.furnaceItemStacks.length; ++i) { if (this.furnaceItemStacks[i] != null) { NBTTagCompound nbttagcompound = new NBTTagCompound(); nbttagcompound.setByte("Slot", (byte)i); this.furnaceItemStacks[i].writeToNBT(nbttagcompound); nbttaglist.appendTag(nbttagcompound); } } compound.setTag("Items", nbttaglist); if (this.hasCustomName()) { compound.setString("CustomName", this.furnaceCustomName); } } /** * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. */ public int getInventoryStackLimit() { return 64; } /** * Furnace isBurning */ public boolean isBurning() { return this.furnaceBurnTime > 0; } @SideOnly(Side.CLIENT) public static boolean isBurning(IInventory p_174903_0_) { return p_174903_0_.getField(0) > 0; } /** * Like the old updateEntity(), except more generic. */ public void update() { boolean flag = this.isBurning(); boolean flag1 = false; if (this.isBurning()) { --this.furnaceBurnTime; } if (!this.worldObj.isRemote) { if (this.isBurning() || this.furnaceItemStacks[1] != null && this.furnaceItemStacks[0] != null) { if (!this.isBurning() && this.canSmelt()) { this.currentItemBurnTime = this.furnaceBurnTime = getItemBurnTime(this.furnaceItemStacks[1]); if (this.isBurning()) { flag1 = true; if (this.furnaceItemStacks[1] != null) { --this.furnaceItemStacks[1].stackSize; if (this.furnaceItemStacks[1].stackSize == 0) { this.furnaceItemStacks[1] = furnaceItemStacks[1].getItem().getContainerItem(furnaceItemStacks[1]); } } } } if (this.isBurning() && this.canSmelt()) { ++this.cookTime; if (this.cookTime == this.totalCookTime) { this.cookTime = 0; this.totalCookTime = this.getCookTime(this.furnaceItemStacks[0]); this.smeltItem(); flag1 = true; } } else { this.cookTime = 0; } } else if (!this.isBurning() && this.cookTime > 0) { this.cookTime = MathHelper.clamp_int(this.cookTime - 2, 0, this.totalCookTime); } if (flag != this.isBurning()) { flag1 = true; BlockFurnace.setState(this.isBurning(), this.worldObj, this.pos); } } if (flag1) { this.markDirty(); } } public int getCookTime(ItemStack stack) { return 200; } /** * Returns true if the furnace can smelt an item, i.e. has a source item, destination stack isn't full, etc. */ private boolean canSmelt() { if (this.furnaceItemStacks[0] == null) { return false; } else { ItemStack itemstack = VDraw_furnace_smelting.instance().getSmeltingResult(this.furnaceItemStacks[0]); if (itemstack == null) return false; if (this.furnaceItemStacks[2] == null) return true; if (!this.furnaceItemStacks[2].isItemEqual(itemstack)) return false; int result = furnaceItemStacks[2].stackSize + itemstack.stackSize; return result <= getInventoryStackLimit() && result <= this.furnaceItemStacks[2].getMaxStackSize(); //Forge BugFix: Make it respect stack sizes properly. } } /** * Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack */ public void smeltItem() { if (this.canSmelt()) { ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]); if (this.furnaceItemStacks[2] == null) { this.furnaceItemStacks[2] = itemstack.copy(); } else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem()) { this.furnaceItemStacks[2].stackSize += itemstack.stackSize; // Forge BugFix: Results may have multiple items } if (this.furnaceItemStacks[0].getItem() == Item.getItemFromBlock(Blocks.sponge) && this.furnaceItemStacks[0].getMetadata() == 1 && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].getItem() == Items.bucket) { this.furnaceItemStacks[1] = new ItemStack(Items.water_bucket); } --this.furnaceItemStacks[0].stackSize; if (this.furnaceItemStacks[0].stackSize <= 0) { this.furnaceItemStacks[0] = null; } } } /** * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't * fuel */ public static int getItemBurnTime(ItemStack p_145952_0_) { if (p_145952_0_ == null) { return 0; } else { Item item = p_145952_0_.getItem(); if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) { Block block = Block.getBlockFromItem(item); if (block == Blocks.wooden_slab) { return 150; } if (block.getMaterial() == Material.wood) { return 300; } if (block == Blocks.coal_block) { return 16000; } } if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200; if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200; if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200; if (item == Items.stick) return 100; if (item == Items.coal) return 1600; if (item == Items.lava_bucket) return 20000; if (item == Item.getItemFromBlock(Blocks.sapling)) return 100; if (item == Items.blaze_rod) return 2400; return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(p_145952_0_); } } public static boolean isItemFuel(ItemStack p_145954_0_) { /** * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't * fuel */ return getItemBurnTime(p_145954_0_) > 0; } /** * Do not make give this method the name canInteractWith because it clashes with Container */ public boolean isUseableByPlayer(EntityPlayer player) { return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D; } public void openInventory(EntityPlayer player) { } public void closeInventory(EntityPlayer player) { } /** * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. */ public boolean isItemValidForSlot(int index, ItemStack stack) { return index == 2 ? false : (index != 1 ? true : isItemFuel(stack) || SlotFurnaceFuel.isBucket(stack)); } public int[] getSlotsForFace(EnumFacing side) { return side == EnumFacing.DOWN ? slotsBottom : (side == EnumFacing.UP ? slotsTop : slotsSides); } /** * Returns true if automation can insert the given item in the given slot from the given side. Args: slot, item, * side */ public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) { return this.isItemValidForSlot(index, itemStackIn); } /** * Returns true if automation can extract the given item in the given slot from the given side. Args: slot, item, * side */ public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) { if (direction == EnumFacing.DOWN && index == 1) { Item item = stack.getItem(); if (item != Items.water_bucket && item != Items.bucket) { return false; } } return true; } public String getGuiID() { return "minecraft:furnace"; } public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) { return new ContainerFurnace(playerInventory, this); } public int getField(int id) { switch (id) { case 0: return this.furnaceBurnTime; case 1: return this.currentItemBurnTime; case 2: return this.cookTime; case 3: return this.totalCookTime; default: return 0; } } public void setField(int id, int value) { switch (id) { case 0: this.furnaceBurnTime = value; break; case 1: this.currentItemBurnTime = value; break; case 2: this.cookTime = value; break; case 3: this.totalCookTime = value; } } public int getFieldCount() { return 4; } public void clear() { for (int i = 0; i < this.furnaceItemStacks.length; ++i) { this.furnaceItemStacks[i] = null; } } net.minecraftforge.items.IItemHandler handlerTop = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.UP); net.minecraftforge.items.IItemHandler handlerBottom = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.DOWN); net.minecraftforge.items.IItemHandler handlerSide = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.WEST); @Override public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, net.minecraft.util.EnumFacing facing) { if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) if (facing == EnumFacing.DOWN) return (T) handlerBottom; else if (facing == EnumFacing.UP) return (T) handlerTop; else return (T) handlerSide; return super.getCapability(capability, facing); } } smth wrong with my entityfurnace java.lang.ExceptionInInitializerError at com.verdure.mod.entity.VDEntity_raw_furnace.canSmelt(VDEntity_raw_furnace.java:319) at com.verdure.mod.entity.VDEntity_raw_furnace.update(VDEntity_raw_furnace.java:248) at net.minecraft.world.World.updateEntities(World.java:1860) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:560) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:777) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:681) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:159) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:548) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NullPointerException at com.verdure.mod.recipte.VDraw_furnace_smelting.getSmeltingResult(VDraw_furnace_smelting.java:71) at com.verdure.mod.recipte.VDraw_furnace_smelting.addSmeltingRecipe(VDraw_furnace_smelting.java:61) at com.verdure.mod.recipte.VDraw_furnace_smelting.addSmelting(VDraw_furnace_smelting.java:53) at com.verdure.mod.recipte.VDraw_furnace_smelting.addSmeltingRecipeForBlock(VDraw_furnace_smelting.java:45) at com.verdure.mod.recipte.VDraw_furnace_smelting.<init>(VDraw_furnace_smelting.java:36) at com.verdure.mod.recipte.VDraw_furnace_smelting.<clinit>(VDraw_furnace_smelting.java:22) ... 9 more
  12. I did but still dosent work maybe i forgot to add smth? package com.verdure.mod.recipte; import java.util.Map; import java.util.Map.Entry; import com.google.common.collect.Maps; import com.verdure.mod.blocks.VDBlocks; import com.verdure.mod.items.VDItems; import net.minecraft.block.Block; import net.minecraft.block.BlockStoneBrick; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.Item; import net.minecraft.item.ItemFishFood; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; public class VDraw_furnace_smelting { private static final VDraw_furnace_smelting VDraw_furnace_smelting = new VDraw_furnace_smelting(); private Map<ItemStack, ItemStack> smeltingList = Maps.<ItemStack, ItemStack>newHashMap(); private Map<ItemStack, Float> experienceList = Maps.<ItemStack, Float>newHashMap(); /** * Returns an instance of FurnaceRecipes. */ public static VDraw_furnace_smelting instance() { return VDraw_furnace_smelting; } private VDraw_furnace_smelting() { this.addSmeltingRecipeForBlock(VDBlocks.cooper_ore, new ItemStack(VDItems.cooper), 0.7F); } /** * Adds a smelting recipe, where the input item is an instance of Block. */ public void addSmeltingRecipeForBlock(Block input, ItemStack stack, float experience) { this.addSmelting(Item.getItemFromBlock(input), stack, experience); } /** * Adds a smelting recipe using an Item as the input item. */ public void addSmelting(Item input, ItemStack stack, float experience) { this.addSmeltingRecipe(new ItemStack(input, 1, 32767), stack, experience); } /** * Adds a smelting recipe using an ItemStack as the input for the recipe. */ public void addSmeltingRecipe(ItemStack input, ItemStack stack, float experience) { if (getSmeltingResult(input) != null) { net.minecraftforge.fml.common.FMLLog.info("Ignored smelting recipe with conflicting input: " + input + " = " + stack); return; } this.smeltingList.put(input, stack); this.experienceList.put(stack, Float.valueOf(experience)); } /** * Returns the smelting result of an item. */ public ItemStack getSmeltingResult(ItemStack stack) { for (Entry<ItemStack, ItemStack> entry : this.smeltingList.entrySet()) { if (this.compareItemStacks(stack, (ItemStack)entry.getKey())) { return (ItemStack)entry.getValue(); } } return null; } /** * Compares two itemstacks to ensure that they are the same. This checks both the item and the metadata of the item. */ private boolean compareItemStacks(ItemStack stack1, ItemStack stack2) { return stack2.getItem() == stack1.getItem() && (stack2.getMetadata() == 32767 || stack2.getMetadata() == stack1.getMetadata()); } public Map<ItemStack, ItemStack> getSmeltingList() { return this.smeltingList; } public float getSmeltingExperience(ItemStack stack) { float ret = stack.getItem().getSmeltingExperience(stack); if (ret != -1) return ret; for (Entry<ItemStack, Float> entry : this.experienceList.entrySet()) { if (this.compareItemStacks(stack, (ItemStack)entry.getKey())) { return ((Float)entry.getValue()).floatValue(); } } return 0.0F; }}
  13. holyyyyyyyyyyyyyyyyyyyyyy shit i managed!!!!!!!!!!!! sry for spam:)
  14. When i use tesr method model just not load i mean vanish in the cube
  15. U mean my model? or vanila?
  16. right but my model have cavity and the texture flat i cant draw cavity on texture
  17. ye but i made it, custom model worked when it was a block but when i started to add methods from furnaceBlock it is not working this is my model "parent": "block/orientable", "textures": { "0": "vd:blocks/raw_furnace", "1": "vd:blocks/raw_furnace.foward" }, "elements": [ { "name": "Cube", "from": [ 3.0, 0.0, 3.0 ], "to": [ 13.0, 11.0, 13.0 ], "faces": { "north": { "texture": "#0", "uv": [ 2.0, 5.0, 12.0, 16.0 ] }, "west": { "texture": "#0", "uv": [ 6.0, 0.0, 16.0, 11.0 ] }, "south": { "texture": "#1", "uv": [ 3.0, 5.0, 13.0, 16.0 ] }, "west": { "texture": "#0", "uv": [ 0.0, 0.0, 10.0, 11.0 ] }, "up": { "texture": "#0", "uv": [ 3.0, 3.0, 13.0, 13.0 ] }, "down": { "texture": "#0", "uv": [ 3.0, 6.0, 13.0, 16.0 ] } } }, { "name": "Cube", "from": [ 4.0, 11.0, 4.0 ], "to": [ 12.0, 12.0, 12.0 ], "faces": { "north": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] }, "east": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] }, "south": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] }, "west": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] }, "up": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 8.0 ] }, "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 8.0 ] } } }, { "name": "Cube", "from": [ 5.0, 12.0, 5.0 ], "to": [ 11.0, 13.0, 11.0 ], "faces": { "north": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 1.0 ] }, "east": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 1.0 ] }, "south": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 1.0 ] }, "west": { "texture": "#0", "uv": [ 0.0, 0.0, -5.0, -1.0 ] }, "up": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 6.0 ] }, "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 6.0 ] } } }, { "name": "Cube", "from": [ 7.0, 13.0, 7.0 ], "to": [ 9.0, 16.0, 9.0 ], "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 45.0 }, "faces": { "north": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 3.0 ] }, "east": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 3.0 ] }, "south": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 3.0 ] }, "west": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 3.0 ] }, "up": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }, "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] } } } ] } and this blockfurnace { "parent": "block/orientable", "textures": { "top": "blocks/furnace_top", "front": "blocks/furnace_front_off", "side": "blocks/furnace_side" } } I think i need to add to my model top front and side but i dont know how:C
  18. So, i need to find method that render furnace texure? right?
  19. oh still dosent work and now when i open furnace minecraft crash but i used auto generated methods.. should i ad some methods by myself? package com.verdure.mod.entity; import net.minecraft.block.Block; import net.minecraft.block.BlockFurnace; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerFurnace; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.SlotFurnaceFuel; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.item.ItemTool; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntityLockable; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraft.util.MathHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class VDEntity_raw_furnace extends TileEntityLockable implements ITickable, ISidedInventory { @Override public int getSizeInventory() { // TODO Auto-generated method stub return 0; } @Override public ItemStack getStackInSlot(int index) { // TODO Auto-generated method stub return null; } @Override public ItemStack decrStackSize(int index, int count) { // TODO Auto-generated method stub return null; } @Override public ItemStack removeStackFromSlot(int index) { // TODO Auto-generated method stub return null; } @Override public void setInventorySlotContents(int index, ItemStack stack) { // TODO Auto-generated method stub } @Override public int getInventoryStackLimit() { // TODO Auto-generated method stub return 0; } @Override public boolean isUseableByPlayer(EntityPlayer player) { // TODO Auto-generated method stub return false; } @Override public void openInventory(EntityPlayer player) { // TODO Auto-generated method stub } @Override public void closeInventory(EntityPlayer player) { // TODO Auto-generated method stub } @Override public boolean isItemValidForSlot(int index, ItemStack stack) { // TODO Auto-generated method stub return false; } @Override public int getField(int id) { // TODO Auto-generated method stub return 0; } @Override public void setField(int id, int value) { // TODO Auto-generated method stub } @Override public int getFieldCount() { // TODO Auto-generated method stub return 0; } @Override public void clear() { // TODO Auto-generated method stub } @Override public String getName() { // TODO Auto-generated method stub return null; } @Override public boolean hasCustomName() { // TODO Auto-generated method stub return false; } @Override public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) { // TODO Auto-generated method stub return null; } @Override public String getGuiID() { // TODO Auto-generated method stub return null; } @Override public int[] getSlotsForFace(EnumFacing side) { // TODO Auto-generated method stub return null; } @Override public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) { // TODO Auto-generated method stub return false; } @Override public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) { // TODO Auto-generated method stub return false; } @Override public void update() { // TODO Auto-generated method stub } public void setCustomInventoryName(String displayName) { // TODO Auto-generated method stub }}
  20. package com.verdure.mod.blocks; import java.util.Random; import com.verdure.mod.VerdureGlobal; import com.verdure.mod.entity.VDEntity_raw_furnace; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.entity.layers.LayerBipedArmor; import net.minecraft.client.renderer.entity.layers.LayerHeldBlock; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.inventory.Container; import net.minecraft.inventory.InventoryHelper; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class raw_furnace extends BlockContainer { public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); private final boolean isBurning; private static boolean keepInventory; protected raw_furnace (boolean isBurning, String unlocalizedName) { super(Material.rock); this.setCreativeTab(VerdureGlobal.vdCreativeTabs); this.setUnlocalizedName(unlocalizedName); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); this.isBurning = isBurning; } /** * Get the Item that this Block should drop when harvested. */ public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(VDBlocks.raw_furnace); } public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { this.setDefaultFacing(worldIn, pos, state); } private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { Block block = worldIn.getBlockState(pos.north()).getBlock(); Block block1 = worldIn.getBlockState(pos.south()).getBlock(); Block block2 = worldIn.getBlockState(pos.west()).getBlock(); Block block3 = worldIn.getBlockState(pos.east()).getBlock(); EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); if (enumfacing == EnumFacing.NORTH && block.isFullBlock() && !block1.isFullBlock()) { enumfacing = EnumFacing.SOUTH; } else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock() && !block.isFullBlock()) { enumfacing = EnumFacing.NORTH; } else if (enumfacing == EnumFacing.WEST && block2.isFullBlock() && !block3.isFullBlock()) { enumfacing = EnumFacing.EAST; } else if (enumfacing == EnumFacing.EAST && block3.isFullBlock() && !block2.isFullBlock()) { enumfacing = EnumFacing.WEST; } worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2); } } @SideOnly(Side.CLIENT) @SuppressWarnings("incomplete-switch") public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (this.isBurning) { EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); double d0 = (double)pos.getX() + 0.5D; double d1 = (double)pos.getY() + rand.nextDouble() * 6.0D / 16.0D; double d2 = (double)pos.getZ() + 0.5D; double d3 = 0.52D; double d4 = rand.nextDouble() * 0.6D - 0.3D; switch (enumfacing) { case WEST: worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); break; case EAST: worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); break; case NORTH: worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D, new int[0]); break; case SOUTH: worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D, new int[0]); } } } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return true; } else { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityFurnace) { playerIn.displayGUIChest((TileEntityFurnace)tileentity); playerIn.triggerAchievement(StatList.field_181741_Y); } return true; } } public static void setState(boolean active, World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); TileEntity tileentity = worldIn.getTileEntity(pos); keepInventory = true; if (active) { worldIn.setBlockState(pos, Blocks.lit_furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, Blocks.lit_furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } else { worldIn.setBlockState(pos, Blocks.furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, Blocks.furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } keepInventory = false; if (tileentity != null) { tileentity.validate(); worldIn.setTileEntity(pos, tileentity); } } /** * Returns a new instance of a block's tile entity class. Called on placing the block. */ public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityFurnace(); } /** * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } /** * Called by ItemBlocks after a block is set in the world, to allow post-place logic */ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2); if (stack.hasDisplayName()) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityFurnace) { ((TileEntityFurnace)tileentity).setCustomInventoryName(stack.getDisplayName()); } } } public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { if (!keepInventory) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityFurnace) { InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityFurnace)tileentity); worldIn.updateComparatorOutputLevel(pos, this); } } super.breakBlock(worldIn, pos, state); } public boolean hasComparatorInputOverride() { return true; } public int getComparatorInputOverride(World worldIn, BlockPos pos) { return Container.calcRedstone(worldIn.getTileEntity(pos)); } @SideOnly(Side.CLIENT) public Item getItem(World worldIn, BlockPos pos) { return Item.getItemFromBlock(VDBlocks.raw_furnace); } /** * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render */ public int getRenderType() { return 3; } /** * Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...) */ @SideOnly(Side.CLIENT) public IBlockState getStateForEntityRender(IBlockState state) { return this.getDefaultState().withProperty(FACING, EnumFacing.SOUTH); } /** * Convert the given metadata into a BlockState for this Block */ public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(FACING, enumfacing); } /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state) { return ((EnumFacing)state.getValue(FACING)).getIndex(); } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {FACING}); } @Override public boolean isOpaqueCube() { return false; } @Override public boolean isFullCube() { return false; } }
  21. Hello guys i made furnace but it have no model that i made in mc pre 4 before i made block with that custom model and all worked but after i added methods from BlockFurnace into my class customfurnaceblock model didnt work. need some help:C

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.