Jump to content

cw84

Members
  • Posts

    17
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

cw84's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I was trying to avoid reflection due to the performance hit. I suppose I will investigate replacing the item with a custom item... is bytecode the best option here?
  2. Fair enough. Though, that wouldn't change the items stackability if it were given from say a trade w/ a villager... Is bytecode the way to do this now?
  3. Yes, I was able to do @Override on extended class... I have not reached a point to start learning bytecode yet, however I wouldn't mind being pointed towards a good tutorial that explains it. I'll start that read when I am comfortable with my Java skills... So is there an easy way to override the vanilla without advanced Java scripting?
  4. Sorry to ask.... I'm still very new to modding Minecraft and this is a new area for me. Can you provide details how overriding isItemTool shiuld be done?
  5. Hello, I started playing around with vanilla settings and have learned that when you mess with an Items MaxStackSize, it seems to break the items enchantability... Items.diamond_sword.setMaxStackSize(; Any reason why this is...? I don't fully understand why commenting out the line above gives me the ability to once again enchant the item.
  6. So is the proper way to do this, to remove the vanilla recipe and then add my own...? // Get all vanilla recipes... List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList(); Iterator<IRecipe> recipe = recipes.iterator(); // Cycle through and find the item we want to change... while(recipe.hasNext()) { ItemStack it = recipe.next().getRecipeOutput(); if(it.getItem() == Items.wooden_door) { recipe.remove(); } } // Add replacement vanilla recipes... GameRegistry.addRecipe(new ItemStack(Items.wooden_door, 4), new Object[] { "AA ", "AA ", "AA ", 'A', Blocks.planks }); ....Or is there a way to specifically change just the quantity output of the recipe once I've found it?
  7. Hello, Is there an easy way to change what is produced in a vanilla recipe? For instance, if I wanted to change the "wooden_door" recipe so that it gives 4 doors instead of 1.. Or change the bed recipe so that it gives a custom bed instead of the vanilla bed...
  8. You're right. The tool harvest level did change. Appears I had to do something like Item.gold_pickaxe.setMaxDamage(int) to change the max uses of the item. I believe this answers why: Thanks for all the help and insight on this guy's!
  9. I can't seem to get this to work... I've done what Lewie suggested: added my changeSettings() to FMLPostInitializationEvent.... previously I had it in my FMLInitializationEvent. - No Luck - I've done what larsgerrits suggested and used the string version... unfortunately I'm not sure I'm using it correctly because when I tried something like: ReflectionHelper.setPrivateValue(ToolMaterial.class, ToolMaterial.GOLD, 750, "maxUses"); It just simply crashes on loading Minecraft. I found this post: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2151027-1-7-x-using-reflection-to-modify-vanilla-values And this is where I've been basing my changes off of. Though, apparently, I am not doing things correctly. What am I doing wrong here?
  10. So technically, this code is correct and should be working? I only ask because while it doesn't appear to crash the game, it also doesn't appear to be changing any values. I feel maybe there is more to the puzzle than this? I am calling this class in my main last (prior to an event listener).
  11. As the title says... I am looking for a way to change vanilla tools properties without editing the base code. I tried using reflection, but it appears I've done nothing: import net.minecraft.item.Item.ToolMaterial; import cpw.mods.fml.relauncher.ReflectionHelper; public class ModVanilla { public static void changeSettings() { // Adjusting Gold Tools ReflectionHelper.setPrivateValue(ToolMaterial.class, ToolMaterial.GOLD, 2, 5); ReflectionHelper.setPrivateValue(ToolMaterial.class, ToolMaterial.GOLD, 750, 6); ReflectionHelper.setPrivateValue(ToolMaterial.class, ToolMaterial.GOLD, 8.0F, 7); ReflectionHelper.setPrivateValue(ToolMaterial.class, ToolMaterial.GOLD, 2.5F, ; ReflectionHelper.setPrivateValue(ToolMaterial.class, ToolMaterial.GOLD, 10, 9); // Adjusting Diamond Tools ReflectionHelper.setPrivateValue(ToolMaterial.class, ToolMaterial.EMERALD, 10.0F, 7); // Adjusting Stone Tools ReflectionHelper.setPrivateValue(ToolMaterial.class, ToolMaterial.STONE, 14, 9); // Adjusting Iron Tools ReflectionHelper.setPrivateValue(ToolMaterial.class, ToolMaterial.IRON, 12, 9); } } Any help here would be great! Thanks guys...
  12. I couldn't capture when a death event happened using ServerChatEvent.. what is it I am looking for exactly? At this point, I was able to get what I needed using the LivingDeathEvent. My only downside to it was that I can't cancel the server message and append the coordinates to it.
  13. So I tried a different path... import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.event.entity.living.LivingDeathEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class DMEventHandler { @SubscribeEvent public void onDeath(LivingDeathEvent event) { // Get the killed entity... Entity killed = event.entityLiving; // If the entity is a player... if(killed instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.entityLiving; // Round position... double posX = Math.round(event.entity.posX * 100.0) / 100.0; double posY = Math.round(event.entity.posY * 100.0) / 100.0; double posZ = Math.round(event.entity.posZ * 100.0) / 100.0; // Set the string to be sent... String chattxt = EnumChatFormatting.RED + "[" + EnumChatFormatting.YELLOW + "X:" + posX + " Y:" + posY + " Z:" + posZ + EnumChatFormatting.RED + "]"; // Send text player.addChatMessage(new ChatComponentTranslation(chattxt)); } } } This allows me to send the coordinates to the user at death. It doesn't, however, allow me to append to the message! Any help with this would be great. What's the right way to accomplish this?
  14. So I can now append the location to chat message sent.. I'm really looking to send the coordinates to the player upon their death. How do I get the death event? Here is what I currently have: import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.event.ServerChatEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class DMEventHandler { @SubscribeEvent public void onServerChatEvent(ServerChatEvent event) { // Cancel Event... event.setCanceled(true); // Round position... double posX = Math.round(event.player.posX * 100.0) / 100.0; double posY = Math.round(event.player.posY * 100.0) / 100.0; double posZ = Math.round(event.player.posZ * 100.0) / 100.0; // Set string to be sent... String chattxt = event.message + " " + EnumChatFormatting.RED + "[" + EnumChatFormatting.YELLOW + "X:" + posX + " Y:" + posY + " Z:" + posZ + EnumChatFormatting.RED + "]"; // Send text event.player.addChatMessage(new ChatComponentTranslation(chattxt)); } } Thanks guys!
  15. Okay, In my main class I have: @EventHandler public void loadMod(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new DMEventHandler()); } In my DMEventHandler class I have: import net.minecraftforge.event.ServerChatEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class DMEventHandler { @SubscribeEvent public void onServerChatEvent(ServerChatEvent event) { System.out.print("Player =" + event.player); System.out.print("Message =" + event.message); System.out.print("Username =" + event.username); System.out.print("Component =" + event.component); } } When I use the chat function it works perfectly. However, when I kill myself... "[19:31:46] [server thread/INFO]: Player62 fell from a high place [19:31:46] [Client thread/INFO]: [CHAT] Player62 fell from a high place" or "[19:32:22] [server thread/INFO]: Player62 was slain by Zombie [19:32:22] [Client thread/INFO]: [CHAT] Player62 was slain by Zombie" ... I don't get any output. Is there something I am missing here? Thanks for the pointers!
×
×
  • Create New...

Important Information

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