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.

dark2222

Forge Modder
  • Joined

  • Last visited

Everything posted by dark2222

  1. have you try'ed to use the FMLPreInitializationEvent that event runs when the mojang screen is there. @EventHandler public void preInit(FMLPreInitializationEvent event) { }
  2. no error in console? some times they can be there without crash
  3. try to reduce the number at (new WorldGenMinable(MainClass.SapphireOre, 50)).generate(world, random, chunkX, chunkY, chunkZ); i think its too big maybe you run you of memory creating the ores because it generates in chunks you rarity is basically how many times it runs per chunk and and then you say 50 ores should spawn (thats a lot of ores) so in short you in 1 chunk you run the code 24-25 times and every time you create 50 ores i try'ed this myself when i try'ed to make trees (hole chunks where just trees) if i'm wrong on how this works please tell me i just learned this from my tree gen
  4. hi all. i'm working on a mod where i need a "skill tree" and that's basically it. I been unable to find any tutorials or any api on how to make an GUI like the thaumcraft 4 book or ars magica 2
  5. try to create you items before the config Package = new BlockPackage(PackageBlockID, Material.wood).setUnlocalizedName("Package"); Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); //Block int PackageBlockID = config.getBlock("Package", 4095).getInt(); config.save();
  6. yea that's why i wanna just cancel when they craft the item because the Boolean that can be true for some players can also turn false. just so you now what i'm working on (may help) i'm working on a new Vampire Mod and i'm currently adding a Holy Ingot that i don't wan't the vampires to craft and there is also some items that i'm thinking too add that i wan't only the vampires to be able too craft.
  7. i don't think that can work with a the vanilla crafting table. i have also try'ed to look at it but wanst able to find the code (looked in the public thaumcraft API)
  8. ok else thanks do you now when we might get a way?
  9. hello everyone. i can't find a way to "stop" a player from crafting a specific item when they not shall be able to make it to say it more deeply i have a boolean that normal say false but for some player it says true and i try to stop the player with the boolean = true from crafting some items i already tryed ItemCraftedEvent where i cancel the event but i crash when i do that
  10. i'm having a problem with the new netty system where i can send a packet in singleplayer without any problems but when i try on a local server (using ip: localhost) it seams that the client sends and encode the packet but it never run the decode or handleServerSide code's the packet i'm trying to send package com.dark2222.vampiremod.core.PacketHandler.packets; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.ChatComponentText; import net.minecraft.util.IChatComponent; import com.dark2222.vampiremod.core.VampireMain; import com.dark2222.vampiremod.core.BloodCore.BloodCore; import com.dark2222.vampiremod.core.BloodCore.TickHandler; import com.dark2222.vampiremod.core.PacketHandler.AbstractPacket; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.network.ByteBufUtils; public class FoodPack extends AbstractPacket{ int i; public FoodPack() {} public FoodPack(int i){ this.i = i; } @Override public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) { buffer.writeInt(i); } @Override public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) { i = buffer.readInt(); } @Override public void handleClientSide(EntityPlayer player) { System.out.print("Running Client "); BloodCore props = BloodCore.get(player); } @Override public void handleServerSide(EntityPlayer player) { System.out.print("Running server "); BloodCore props = BloodCore.get(player); } } my packetpipeline class is just "copy-paste" from the tutorial as is the abstractPacket class i register the packages in the packetpipeline
  11. i'm a bit new to packet's but try changing (in you https://github.com/chibill/AdditionalCrafting/blob/master/AdditionalCrafting-1.7.2/src/java/chibill/additionalcrafting/common/networking/SendChatAll.java) AdditionalCraftingBase.packetPipeline.sendToAll(this); to AdditionalCraftingBase.packetPipeline.sendToAll(new SendChatAll(message));
  12. how did you make the server get the packet? i'm having a problem with the server doesn't seem to receive the packets i send it (it does not print anything out in console from the server) i use this code when i'm trying to send a packets MainClass.packetPipeline.sendToAll(new TestPacket()); i also tryed to change the code to MainClass.packetPipeline.sendToServer(new TestPacket()); no reaction from the server at all when i send the packet
  13. thanks it helped me allot. i just need to learn how i send package now.
  14. Yes and No. Entirely depends on what you mean to do with it. ok. i'm working on a wampire mod and i'm working on the blood system and i found out working on the system that it will kind of reset itself if i don't "save" the blood level a player is on. ex: if the player has a blood level on 5 i don't wan't it to be on 0 when he restart minecraft or re-join a server
  15. thanks gonna check them out. and i meant HUD ok i understand a bit more of NBT but can i use this without a block/item?
  16. thanks gonna check them out. and i meant HUD
  17. i'm working on a new system for my mod and i think i will need to save some custom int's and strings with NBT but i don't now how to use it completely. what i'm trying to save is kind of a new hunger bar. just asking because i can't find any tut's btw how do i make a HUD?
  18. well as i sad i learn as do it right now and i just learned that it is a object and btw if i try to do that it want to change the items to a int so i don't think i am doing it right here is my container is i try to code in package com.durabilitytransfer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.event.ForgeSubscribe; import com.durabilitytransfer.slots.basictransferslot1; import com.durabilitytransfer.slots.basictransferslot2; import com.durabilitytransfer.slots.basictransferslot3; import com.durabilitytransfer.titleentitys.TileEntityBasic; public class ContainerBatic extends Container{ private TileEntityBasic basic; public ContainerBatic(InventoryPlayer invPlayer, TileEntityBasic basic) { this.basic = basic; boolean a = true; test(basic); for (int x = 0; x < 9; x++){ addSlotToContainer(new Slot(invPlayer, x, 8 + 18 * x, 198)); } for (int y = 0; y < 3; y++){ for(int x = 0; x < 9; x++) { addSlotToContainer(new Slot(invPlayer, x + y * 9 + 9, 8 + 18 * x, 140 + y * 18)); } } for (int y = 0; y < 1; y++){ for (int x = 0; x < 1; x++){ this.addSlotToContainer(new basictransferslot1(basic, 0, 82 + x * 18, 12 + y * 18)); this.addSlotToContainer(new basictransferslot2(basic, 1, 82 + x * 18, 59 + y * 18)); this.addSlotToContainer(new basictransferslot3(basic, 2, 8 + x * 18, 120 + y * 18)); } } } public static void test(TileEntityBasic basic){ <---- this is the code i am working on System.out.println("starting1"); if(basic.getStackInSlot(0) == ItemStack[item.swordWood]){ System.out.println("test"); }else{ System.out.println("broke"); } } @Override public boolean canInteractWith(EntityPlayer entityplayer) { return basic.isUseableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int index){ ItemStack stack = null; Slot slot = (Slot) this.inventorySlots.get(index); if(slot!=null&&slot.getHasStack()){ ItemStack slotstack = slot.getStack(); stack = slotstack.copy(); if(index<{ if(!this.mergeItemStack(slotstack,8,this.inventorySlots.size(),false)) return null; }else if(!this.getSlot(0).isItemValid(slotstack)||!this.mergeItemStack(slotstack,0,4,false)) return null; if(slotstack.stackSize==0){ slot.putStack((ItemStack) null); }else{ slot.onSlotChanged(); } if(slotstack.stackSize==stack.stackSize) return null; slot.onPickupFromSlot(player,slotstack); } return stack; } /** * Does the same as mergeItemStack with the same args, except does not * actually merge— just returns the number of items that can be merged * (usually either stack.stackSize or 0, but can be in between) * @param stack * @param start * @param end * @param reverse * @return */ int dryMerge(ItemStack stack, int start, int end, boolean reverse){ boolean flag1 = false; int i = start; if(reverse){ i = end-1; } int quantity = stack.stackSize; Slot slot; ItemStack slotstack; if(stack.isStackable()){ while(stack.stackSize>0&&(!reverse&&i<end||reverse&&i>=start)){ slot = this.getSlot(i); slotstack = slot.getStack(); if(slotstack!=null&&slotstack.itemID==stack.itemID&&(!stack.getHasSubtypes()||stack.getItemDamage()==slotstack.getItemDamage())&&ItemStack.areItemStackTagsEqual(stack,slotstack)){ int l = slotstack.stackSize+stack.stackSize; if(l<=stack.getMaxStackSize()){ quantity -= slotstack.stackSize; }else if(slotstack.stackSize<stack.getMaxStackSize()){ quantity -= (stack.getMaxStackSize() - slotstack.stackSize); } } if(reverse) --i; else ++i; } } if(stack.stackSize>0){ if(reverse){ i = end-1; }else{ i = start; } while(!reverse&&i<end||reverse&&i>=start){ slot = (Slot) this.inventorySlots.get(i); slotstack = slot.getStack(); if(slotstack==null){ quantity = 0; break; } if(reverse){ --i; }else{ ++i; } } } return stack.stackSize-quantity; } }
  19. will not say that i am lazy bekos i am trying to make it work as i am waiting for response i just ask so much bekos i can't find any tuts on it + i don't now that much java (learning that as i go more advanced) and i use that system println trick and right now i am trying to get wooden sword to work but i all times get a error (about ItemStack[] don't work with int)
  20. Define "this". am i suppose to do the detect/check on the tile entity or container? so far i try'd in tile entity to detect it but nothing worked so i am trying to make it in the container
  21. i understand that and i tryed to make a code my problem is that my code is not running/executing EDIT- wait... am i suppose to do this in the container or tile entity? (right now i tryed in tile entity)
  22. i have tryed a cuble things but i can't get it to run EDIT- i can't find any onUpdate
  23. So i can tell it what slot by the slot id i gave the specefic slot? Sorry i ask so much just trying to understand as much as i can before getting home for school
  24. Thanks for the tip, can i still check what slot the item are in? Have 3 diffrent slots and i need to do diffrent stuff on all slots Sorry if some words are spell wrong i am on ipad in school
  25. i am working on an new mod right now and i don't now have to detect the items i put the GUI slots or change them (damaging/enchanting ex) here are the files i think you will need container package com.durabilitytransfer; import com.durabilitytransfer.slots.basictransferslot1; import com.durabilitytransfer.slots.basictransferslot2; import com.durabilitytransfer.slots.basictransferslot3; import com.durabilitytransfer.titleentitys.TileEntityBasic; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.MinecraftForge; public class ContainerBatic extends Container{ private TileEntityBasic basic; public ContainerBatic(InventoryPlayer invPlayer, TileEntityBasic basic) { this.basic = basic; if(basic.canUpdate() != false){ basic.updateContainingBlockInfo(); } for (int x = 0; x < 9; x++){ addSlotToContainer(new Slot(invPlayer, x, 8 + 18 * x, 198)); } for (int y = 0; y < 3; y++){ for(int x = 0; x < 9; x++) { addSlotToContainer(new Slot(invPlayer, x + y * 9 + 9, 8 + 18 * x, 140 + y * 18)); } } for (int y = 0; y < 1; y++){ for (int x = 0; x < 1; x++){ this.addSlotToContainer(new basictransferslot1(basic, 0, 82 + x * 18, 12 + y * 18)); this.addSlotToContainer(new basictransferslot2(basic, 1, 82 + x * 18, 59 + y * 18)); this.addSlotToContainer(new basictransferslot3(basic, 2, 8 + x * 18, 120 + y * 18)); } } } @Override public boolean canInteractWith(EntityPlayer entityplayer) { return basic.isUseableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int index){ ItemStack stack = null; Slot slot = (Slot) this.inventorySlots.get(index); if(slot!=null&&slot.getHasStack()){ ItemStack slotstack = slot.getStack(); stack = slotstack.copy(); if(index<{ if(!this.mergeItemStack(slotstack,8,this.inventorySlots.size(),false)) return null; }else if(!this.getSlot(0).isItemValid(slotstack)||!this.mergeItemStack(slotstack,0,4,false)) return null; if(slotstack.stackSize==0){ slot.putStack((ItemStack) null); }else{ slot.onSlotChanged(); } if(slotstack.stackSize==stack.stackSize) return null; slot.onPickupFromSlot(player,slotstack); } return stack; } /** * Does the same as mergeItemStack with the same args, except does not * actually merge— just returns the number of items that can be merged * (usually either stack.stackSize or 0, but can be in between) * @param stack * @param start * @param end * @param reverse * @return */ int dryMerge(ItemStack stack, int start, int end, boolean reverse){ boolean flag1 = false; int i = start; if(reverse){ i = end-1; } int quantity = stack.stackSize; Slot slot; ItemStack slotstack; if(stack.isStackable()){ while(stack.stackSize>0&&(!reverse&&i<end||reverse&&i>=start)){ slot = this.getSlot(i); slotstack = slot.getStack(); if(slotstack!=null&&slotstack.itemID==stack.itemID&&(!stack.getHasSubtypes()||stack.getItemDamage()==slotstack.getItemDamage())&&ItemStack.areItemStackTagsEqual(stack,slotstack)){ int l = slotstack.stackSize+stack.stackSize; if(l<=stack.getMaxStackSize()){ quantity -= slotstack.stackSize; }else if(slotstack.stackSize<stack.getMaxStackSize()){ quantity -= (stack.getMaxStackSize() - slotstack.stackSize); } } if(reverse) --i; else ++i; } } if(stack.stackSize>0){ if(reverse){ i = end-1; }else{ i = start; } while(!reverse&&i<end||reverse&&i>=start){ slot = (Slot) this.inventorySlots.get(i); slotstack = slot.getStack(); if(slotstack==null){ quantity = 0; break; } if(reverse){ --i; }else{ ++i; } } } return stack.stackSize-quantity; } } Tile entity package com.durabilitytransfer.titleentitys; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; public class TileEntityBasic extends TileEntity implements IInventory{ private ItemStack[] items; public TileEntityBasic() { items = new ItemStack[9]; } @Override public int getSizeInventory() { return items.length; } @Override public ItemStack getStackInSlot(int i) { return items[i]; } @Override public ItemStack decrStackSize(int i, int count) { ItemStack itemstack = getStackInSlot(i); if(itemstack != null){ if(itemstack.stackSize <= count){ setInventorySlotContents(i, null); } else { itemstack = itemstack.splitStack(count); onInventoryChanged(); } } return itemstack; } @Override public ItemStack getStackInSlotOnClosing(int i) { ItemStack item = getStackInSlot(i); setInventorySlotContents(i, null); return item; } @Override public void setInventorySlotContents(int i, ItemStack itemstack) { items[i] = itemstack; if(itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { itemstack.stackSize = getInventoryStackLimit(); } onInventoryChanged(); } @Override public String getInvName() { return "BasicTransfer"; } @Override public boolean isInvNameLocalized() { return false; } @Override public int getInventoryStackLimit() { return 1; } @Override public boolean isUseableByPlayer(EntityPlayer entityplayer) { return entityplayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) <= 64; } @Override public void openChest() { } @Override public void closeChest() { } @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { return itemstack.itemID == Item.swordWood.itemID; } @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); NBTTagList list = new NBTTagList(); for(int i = 0; i < getSizeInventory(); i++) { ItemStack itemstack = getStackInSlot(i); if(itemstack != null) { NBTTagCompound item = new NBTTagCompound(); item.setByte("dtitem", (byte) i); itemstack.writeToNBT(item); list.appendTag(item); } } compound.setTag("dtitem", list); } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); NBTTagList list = compound.getTagList("dtitem"); for(int i = 0; i < list.tagCount(); i++) { NBTTagCompound item = (NBTTagCompound) list.tagAt(i); int slot = item.getByte("dtitem"); if(slot >= 0 && slot < getSizeInventory()) { setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(item)); } } } } i also have 3 custom slot classes for my Block slots that look like this package com.durabilitytransfer.slots; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class basictransferslot1 extends Slot{ public basictransferslot1(IInventory par1iInventory, int par2, int par3, int par4) { super(par1iInventory, par2, par3, par4); } @Override public boolean isItemValid(ItemStack par1ItemStack) { return par1ItemStack.itemID == Item.swordWood.itemID; } }

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.