Jump to content

Zcelo12

Members
  • Posts

    100
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Personal Text
    I love Minecraft!

Zcelo12's Achievements

Creeper Killer

Creeper Killer (4/8)

0

Reputation

  1. Hello, I currently using Forge latest recommend build for 1.7.2. I'm trying to modify the function for transferStackInSlot. My problem is, that my second input doesn't transfered. I modified the vanilla code from the furnace. The second output works correctly, so if i shift click on the outputs they will be transfered in my inventory. public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { ItemStack itemstack = null; Slot slot = (Slot)this.inventorySlots.get(par2); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (par2 == 2 || par2 == 4) { if (!this.mergeItemStack(itemstack1, 3, 39, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); } else if (par2 != 1 && par2 != 0) { if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null) { if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } } else if (TileEntityFurnace.isItemFuel(itemstack1)) { if (!this.mergeItemStack(itemstack1, 1, 2, false)) { return null; } } else if (par2 >= 3 && par2 < 30) { if (!this.mergeItemStack(itemstack1, 30, 39, false)) { return null; } } else if (par2 >= 30 && par2 < 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(par1EntityPlayer, itemstack1); } return itemstack; } Ouh and my Slots public containerFurnace(InventoryPlayer par1InventoryPlayer, FE_TileEntityFurnace par2TileEntityLargeFurnace) { this.telf = par2TileEntityLargeFurnace; this.addSlotToContainer(new Slot(par2TileEntityLargeFurnace, 0, 52, 15)); this.addSlotToContainer(new Slot(par2TileEntityLargeFurnace, 1, 52, 57)); this.addSlotToContainer(new My_SlotFurnace(par1InventoryPlayer.player, par2TileEntityLargeFurnace, 2, 108, 15)); this.addSlotToContainer(new Slot(par2TileEntityLargeFurnace, 3, 52, 33)); this.addSlotToContainer(new My_SlotFurnace(par1InventoryPlayer.player, par2TileEntityLargeFurnace, 4, 108, 33)); for(int i = 0; i < 3; i++) { for(int k = 0; k < 9; k++) { this.addSlotToContainer(new Slot(par1InventoryPlayer, k + i * 9 + 9, 8 + k * 18, 84 + i * 18)); } } for(int j = 0; j < 9; j++) { this.addSlotToContainer(new Slot(par1InventoryPlayer, j, 8 + j * 18, 142)); } } These funtions are in my container.class Inputs are 0 and 3 Fuel is 1 Outputs are 2 and 4 Hope you could help me.
  2. After I changed it, i get this error pointing to onPlayerLogin: Expecting non-static method
  3. Hello, after updating from Forge 1024 to 1034 my EventHandler doesn't work anymore. In my mod_File I've: public void LoadMod(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new EventHandler()); } EventHandler.class public class FE_EventHandler { @SubscribeEvent public static void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) { String welcome = EnumChatFormatting.YELLOW + "Mod V1.0 successfully loaded."; event.player.addChatComponentMessage(new ChatComponentText(welcome)); } } The message doesn't appear and some other things I added to EventHandler also doesn't work. Can someone help me, please?
  4. Hello, I have a problem. My blocks are displayed as tile.null.name, but the textures are loaded. preInit: myblock= new BlockClass().setStepSound(Block.soundTypeWood).setHardness(1.0F).setBlockTextureName("mymod:myblock"); GameRegistry.registerBlock(myblock,"MyBlock"); BlockClass public class BlockClass extends Block { public BlockClass() { super(Material.gourd); this.setCreativeTab(mod_myMod.tabMyMod); } } lang file en_US tile.myblock.name = My Block Does someone know what is wrong?
  5. 1. At this to your EntityClass: public EntityYourClass spawnBabyAnimal(EntityAgeable par1EntityAgeable) { return new EntityYourClass(this.worldObj); } public EntityAgeable createChild(EntityAgeable par1EntityAgeable) { return this.spawnBabyAnimal(par1EntityAgeable); } 2. Look at the EntityClass of sheep
  6. I used 10 as second argument for TAG_Compund and used this function instead of tagAt: func_150305_b. Errors are gone. Am I on the right way? I can't test because of some more, about 230 errors, in my mod. So im trying to fix them first Ich danke dir bereits im voraus: "Manchmal sieht man den Wald vor lauter Bäumen nicht".
  7. Thanks for your help. Now i have problems with the "new" getTagList function and tagAt. My current code looks like this: private void readFromNBT() { reading = true; // TODO for backwards compatibility if(NBTUtil.getCompoundTag(originalIS, "Inventory").hasKey("title")) { setInvName(NBTUtil.getCompoundTag(originalIS, "Inventory").getString("title")); } else { setInvName(NBTUtil.getCompoundTag(originalIS, "display").getString("Name")); } NBTTagList itemList = NBTUtil.getCompoundTag(originalIS, "Inventory").func_150295_c("Items") // But i need slotEntry as second Argument?! for(int i = 0; i < itemList.tagCount(); i++) { NBTTagCompound slotEntry = (NBTTagCompound) itemList.tagAt(i);//what was tagAt replaced for this situation? int j = slotEntry.getByte("Slot") & 0xff; if(j >= 0 && j < getSizeInventory()) { setInventorySlotContents(j, ItemStack.loadItemStackFromNBT(slotEntry)); } } getTagList needs more arguments than in earlier version. I have trouble rewriting it. Can you or someone else give me some tips?
  8. Hello, I am using Forge Build 1007 and was wondering why the function setCompoundTag doesn't exist, because getCompoundTag exist. Also getTaglist and tagAt in NBTTagList doesn't exist. Were they changed or are they missing?
  9. Hello, I have a problem returning an emptyBowl after crafted a custom item. My code looks like this, but it doesn't return the item. public class ItemBowl2 extends Item { public ItemBowl2(int par1) { super(par1); this.setMaxStackSize(1); this.setCreativeTab(CreativeTabs.tabMisc); setContainerItem(Item.bowlEmpty); } @Override public boolean doesContainerItemLeaveCraftingGrid(ItemStack par1ItemStack) { return true; } } Edit: Solved the problem with a CraftingHandler!
  10. Problem solved. I really didn't use that method My fault.
  11. I added this, but i still can place the block everywhere. @Override protected boolean canThisPlantGrowOnThisBlockID(int par1) { if(par1 == Block.tilledField.blockID || par1 == myblocks.BCorn.blockID) return true; return false; }
  12. Thank you. Now, I'm extending BlockFlower. But what do you mean with override canThisPlantGrowOnThisBlockID(int).
  13. I also looked at it. I copied the method and added this to it: if(plantid == myblocks.bcorn.blockID && blockID == myblocks.bcorn.blockID) { return true; } Now the problem is, that i can place my block everywhere. I defindet the EnumPlantType as Corn, but can place it also on sand or grass. So the code looks like this. I'll remove unused things later. public boolean canSustainPlant2(World world, int x, int y, int z, ForgeDirection direction, IPlantable plant) { int plantID = plant.getPlantID(world, x, y + 1, z); EnumPlantType plantType = plant.getPlantType(world, x, y + 1, z); if (plantID == myblocks.bcorn.blockID && blockID == myblocks.bcorn.blockID) { return true; } if (plant instanceof BlockFlower && canThisPlantGrowOnThisBlockID2(blockID)) { return true; } switch (plantType) { case Desert: return blockID == sand.blockID; case Nether: return blockID == slowSand.blockID; case Crop: return blockID == tilledField.blockID; case Cave: return isBlockSolidOnSide(world, x, y, z, UP); case Plains: return blockID == grass.blockID || blockID == dirt.blockID; case Water: return world.getBlockMaterial(x, y, z) == Material.water && world.getBlockMetadata(x, y, z) == 0; case Beach: boolean isBeach = (blockID == Block.grass.blockID || blockID == Block.dirt.blockID || blockID == Block.sand.blockID); boolean hasWater = (world.getBlockMaterial(x - 1, y, z ) == Material.water || world.getBlockMaterial(x + 1, y, z ) == Material.water || world.getBlockMaterial(x, y, z - 1) == Material.water || world.getBlockMaterial(x, y, z + 1) == Material.water); return isBeach && hasWater; } return false; } protected boolean canThisPlantGrowOnThisBlockID2(int par1) { return par1 == Block.grass.blockID || par1 == Block.dirt.blockID || par1 == Block.tilledField.blockID; }
×
×
  • Create New...

Important Information

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