Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Zcelo12

Members
  • Posts

    100
  • Joined

  • Last visited

Everything posted by Zcelo12

  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; }
  14. Hello. I started to make a plant which works like Reed. Everything works fine, except that i cannot place the block on itself like reed. public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { Block block = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)]; return (block != null && block.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this)); } I think this is the problem. But when I add || blockID == myblock.blockID, then i can also place it on sand or when i place them on itself more times and break the first block, the other blocks doesn't drop as a item. I hope someone can help me.
  15. I didn't use the FileWrite/Read methods ever in Java, so i didn't learned it But thank you very much!
  16. And how I use it to locate the path. Sorry, but I don't understand how to use this method.
  17. There is one problem left. This mod should work universal. When i put in the path the full path with C:\Users... it works, but how can i make it universal like \config\bla.cfg. This can't work because the jar is in the folder versions. Maybe someone can help me
  18. Oh my god thank you, it's like i am a blockhead
  19. Don't reinvent the wheel. But i would like to edit the configuration of another mod, not mine. Anyway, solved it using a tmp-file.
  20. When I set the boolean to true, it adds the line at the end of the file. So i've the files twice and in the configuration it isn't among general { ... } . Is there a way to override only the line and set it to the position? I hope you undertand me.
  21. Hello, I'm trying to edit the configuration of another mod using FileReader/FileWriter in Java. My problem is that it only add the line i've edited, the other text in the configuration is gone. Can someone help me? private class CheckDynamicsConfig extends Thread { @Override public void run() { try { BufferedReader in = new BufferedReader(new FileReader("C:\\Users\\abt\\Desktop\\forge804\\mcp\\jars\\config\\DynamicLights_thePlayer.cfg")); String line = null; while ((line = in.readLine()) != null) { if (line.contains("S:LightItems")) { if (!line.contains("4020")) { BufferedWriter out = new BufferedWriter(new FileWriter("C:\\Users\\abt\\Desktop\\forge804\\mcp\\jars\\config\\DynamicLights_thePlayer.cfg")); String id = ",4020=10"; out.write(line+id); out.close(); } } } in.close(); } catch (IOException e) { e.printStackTrace(); } } }
  22. Hello, I've put a bollean in my config. Now, when someone set it to false a special item should not load. But how can I do that, when the item has more classes for example: container.class, gui.class . When I only disable the item i get a crash.
×
×
  • Create New...

Important Information

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