
Anon10W1z
Forge Modder-
Posts
311 -
Joined
-
Last visited
Everything posted by Anon10W1z
-
[SOLVED] How are vanilla stack sizes drawn on ItemStacks?
Anon10W1z posted a topic in Modder Support
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); -
@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.
-
How to increase speed of living entity by exact %?
Anon10W1z replied to Anon10W1z's topic in Modder Support
Thanks for all your help. -
How to increase speed of living entity by exact %?
Anon10W1z replied to Anon10W1z's topic in Modder Support
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); -
How to increase speed of living entity by exact %?
Anon10W1z replied to Anon10W1z's topic in Modder Support
Thanks, the value of potion.moveSpeed is what I am looking for, right? -
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?
-
[1.8] all items and blocks rendering as missing model texture.
Anon10W1z replied to Cleverpanda's topic in Modder Support
Do not actually name the folder with dots. Name it with slashes. -
NBT and google.
-
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.
-
[1.8 SOLVED]Creating a Custom Throwable Entity, Texture Not Showing
Anon10W1z replied to riderj's topic in Modder Support
Register the entity and the entity's renderer (EntityRegistry, RenderingRegistry) -
Why do you need a 3D array? The right format would probably be minecraft/yourmod/filename.txt
-
Okay then, but is that even relevant to my bug?
-
Calling openGui on a EntityPlayerMP doesn't do anything so it doesn't matter.
-
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.
-
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; } }
-
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.
-
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.
-
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.
-
Why are you modding 1.6.4...seriously 1.8 Forge came out eons ago.
-
[SOLVED] How to use Byte Buddy with obfuscation?
Anon10W1z replied to Anon10W1z's topic in Modder Support
I already had that covered, but thanks for the advice anyways. -
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.
-
[SOLVED] InvocationTargetException for coremod
Anon10W1z replied to Anon10W1z's topic in Modder Support
It's not that much, plus there isn't any alternative, as far as I know. -
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!