Jump to content

Anon10W1z

Forge Modder
  • Posts

    311
  • Joined

  • Last visited

Everything posted by Anon10W1z

  1. I want to draw the potion amplifier of the current potion effect similar to how vanilla Minecraft does for ItemStacks in your inventory. Currently I am using a fixed x and y offset of 12. Is this the right way to do it? if (potionEffect.getAmplifier() > 0) gui.drawString(minecraft.fontRendererObj, Integer.toString(potionEffect.getAmplifier() + 1), xPos + 12, yPos + 12, 0xFFFFFF);
  2. @SubscribeEvent public void onAnvilUpdate(AnvilUpdateEvent event) { if (event.right.getItem() == Items.written_book) { NBTTagCompound bookTagCompound = event.right.getTagCompound(); NBTTagList pagesList = bookTagCompound.getTagList("pages",; ItemStack output = event.left.copy(); NBTTagCompound outputTagCompound = new NBTTagCompound(); NBTTagList loreList = new NBTTagList(); for (int i = 0; i < pagesList.tagCount(); ++i) { String[] pageSplit = pagesList.getStringTagAt(i).substring(1, pagesList.getStringTagAt(i).length() - 1).replace("\\n", "\n").split("\n"); for (String line : pageSplit) loreList.appendTag(new NBTTagString(line)); } outputTagCompound.setTag("Lore", loreList); output.setTagInfo("display", outputTagCompound); if (!event.name.trim().isEmpty()) output.setStackDisplayName(event.name); event.output = output; } } I am using the above code to allow application of written books as lore on items. It works perfectly except for one thing: The result can't be taken out of its slot. Shift clicking and regular left-clicking do not do anything, in fact. Is this a bug or am I doing something wrong? The reason I am replacing the literal "\n" with the actual linefeed "\n" is that it shows as the literal in the lore. Then I have to split the linefeed "\n" because it renders as an LF icon rather than an actual new line. Solved by setting event.cost.
  3. Thanks for all your help.
  4. So when creating my modifier I pass the value 2 for operation? Just making sure I'm on the same page as you. AttributeModifier speedModifier = new AttributeModifier(nimbleUUID, "Nimble", (float) enchantmentLevel * 0.20000000298023224, 2); speedAttribute.applyModifier(speedModifier);
  5. Thanks, the value of potion.moveSpeed is what I am looking for, right?
  6. I am currently using an attribute modifier to increase the speed of an entity. Is the amount I give the attribute modifier a multiplier or an addend?
  7. Do not actually name the folder with dots. Name it with slashes.
  8. NBT and google.
  9. On WorldTickEvent get the list of all arrows in the world. For each arrow, create a new NBT tag compound, call the arrow's write entity to NBT method, then check if the byte tag inGround in your NBT compound equals 1. If it is, do whatever you want. Warning: your code will run always when the arrow is in the ground.
  10. Register the entity and the entity's renderer (EntityRegistry, RenderingRegistry)
  11. Check out my mod on Github. https://github.com/Anon10W1z/CraftPlusPlus
  12. Why do you need a 3D array? The right format would probably be minecraft/yourmod/filename.txt
  13. Okay then, but is that even relevant to my bug?
  14. Calling openGui on a EntityPlayerMP doesn't do anything so it doesn't matter.
  15. This is wrong. map.put("Hello", 1); map.put("Goodbye", 1); Works perfectly fine. map.get("Hello"); //1 map.get("Goodbye"); //2 However he doesn't know how to use the syntax properly.
  16. It probably has nothing to do with it, but here: package io.github.anon10w1z.craftPP.items; import io.github.anon10w1z.craftPP.main.CraftPlusPlus; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; /** * A portable crafting pad that allows you to craft items on the go */ public class ItemCraftingPad extends Item { public ItemCraftingPad() { super(); this.setUnlocalizedName("craftingPad"); this.setCreativeTab(CreativeTabs.tabInventory); } @Override public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { if (player.inventory.hasItem(CppItems.recipe_book) || player.capabilities.isCreativeMode) player.openGui(CraftPlusPlus.instance, 0, world, 0, 0, 0); return itemstack; } }
  17. Once I wanted to get rid of my own item, so I put it in on the delete item button. But the item didn't delete, rather, it stuck to the button. See the illustration below. Deleting the world and recreating it didn't help. Restarting Minecraft didn't help. Even removing and re-adding the item to the game didn't work. Why did this happen? FYI, my item opens a GUI on right click. My mod maintains 100% server compatibility.
  18. You can create your own class that wraps around BlockPos. Override the equals and hashCode methods to return the proper values when the x, y, and z are the same.
  19. Look at how my code is set up on my Github repository. If you have all of those folders and files, excluding the readme, license, and version check json, you are good to go.
  20. Why are you modding 1.6.4...seriously 1.8 Forge came out eons ago.
  21. I already had that covered, but thanks for the advice anyways.
  22. You have to regenerate the IntelliJ project if you move your project elsewhere. It's not that big of a deal, just set it up again and paste in your existing code.
  23. It's not that much, plus there isn't any alternative, as far as I know.
  24. Create a map yourself. Map entity names to their classes, for example zombie_pig -> EntityPigZombie.class. Then parse the string, lookup the entity name in the map, and voila!
×
×
  • Create New...

Important Information

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