Jump to content

VengeanceSoldier

Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by VengeanceSoldier

  1. I'm trying to get my custom Item accept ONLY SPECIFIC vanilla enchantments (unbreaking) in the enchanting table. I know that you can allow the tool enchantments to be added by making the items class extend ItemTool, but that would allow all tool enchantments, like silk touch,... , to be added to the item. Is there a way of only accepting a few of these enchants without modifying base classes?
  2. MinecraftForge.class should be located in net.minecraftforge.common, and the events can be found in net.minecraftforge.event and net.minecraftforge.client.event Yes
  3. I dont know what you consider as cleanly but its possible with reflection. Here is how to do it: First create a new TickHandler (similar to onTick in ModLoader): import java.lang.reflect.Field; import java.util.EnumSet; import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.GuiChest; import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.TickType; public class TickHandler implements ITickHandler { @Override public void tickStart(EnumSet<TickType> type, Object... tickData) { try { GuiScreen activeGUI = Minecraft.getMinecraft().currentScreen; if(activeGUI != null && activeGUI instanceof GuiChest) //whatever GUI you want to add a/multiple button/s to { Field field = GuiScreen.class.getDeclaredField("buttonList"); field.setAccessible(true); List buttonList = (List) field.get(activeGUI); if(buttonList.size() < 1) //this has to be one smaller than the number of buttons it usually has, else you will keep adding your button over and oever again { buttonList.add(new GuiButton(1, 2, 5, "Test")); //you have to make a class extending GuiButton to add function to your button } } } catch(Exception e) { e.printStackTrace(); } } @Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { } @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.RENDER); } @Override public String getLabel() { return "GUI TickHandler"; //Or however you want to name it } } Then you have to register it in your load/init method TickRegistry.registerTickHandler(new TickHandler(), Side.CLIENT); Thats basically it, you will now have an additional button in the GUI(I used the chest as an example):
  4. @ForgeSubscribe public void LivingAttackEvent(LivingAttackEvent event) { if(event.entityLiving instanceof EntityPlayerMP) { EntityPlayerMP player = (EntityPlayerMP) event.entityLiving; player.addPotionEffect(new PotionEffect(Potion.heal.getId(), 200, 1)); } } It should work like this (or similar, this is for 1.6.2).
  5. Why do you ask this in a forum for Minecraft FORGE? Forge contains classes like BaseMod to allow compability with mods designed for ModLoader, not for making ModLoader mods. If you really want to use ModLoader (i recommend switching to forge), this is the wrong forum. But now back to your question: With Forge yes (pretty easily), with Modloader i dont know.
  6. Is there a way to prevent a particle effect from being rendered/appearing? I checked the client events but i havent found anything useful for this. I want to remove the sprinting particles if the player is wearing special boots. What also is kind of a problem is that digging and sprinting particles use the same class (EntityDiggingFX), and only the sprinting and not the digging particles should be disabled. Thanks in advance, VengeanceSoldier
  7. I think you have to register the sounds, but im not sure: http://www.minecraftforge.net/wiki/Sounds_For_Forge_1.3.2 Allthough the tutorial is for 1.3.2, it should still work in the same/a similar way.
  8. The function is used like this: GameRegistry.addSmelting(int BlockID/ItemID , ItemStack output, float xp); So in your case it would be: GameRegistry.addSmelting(ParallelWorlds.NightOre.blockID, new ItemStack(NightGem, 1), 1F);
  9. Dinnerbone wrote a tool for that, you dont have to do it that complicated:
  10. The problem propably is that your onItemUse() is getting called client and serversided. Just use if(!world.isRemote) and it will only be run server sided. Often running certain functions on the client results in problems, f.e. ghost items. Server functions (f.e. world changes, entity spawns,...) will get sent to the client anyway so it shouldnt cause any problems.
  11. Yes you are right with this, you only can give an item based on the output of the furnace, not the input. If you ment that earlyer, then im sorry that i misunderstood you. This shouldnt be a problem though as long as he only has one recipe for the item he is using the crafting handler for, or all the recipes for that item are ment to give you an extra item.
  12. Just use this: player.inventory.addItemStackToInventory(new ItemStack(Block.stone, item.stackSize)); It will give you as many items as you smelted CraftingHandlers can do that too, just add multiple if statements. Also if you want to give multiple items, just use the player.inventory.addItemStackToInventory function multiple times with different items. I also think that making a custom furnace is better, but as a temporary solution the CraftingHandler should work fine.
  13. Then try using a CraftingHandler. Put this in your load method: GameRegistry.registerCraftingHandler(new CraftingHandler()); Class CraftingHandler: public class CraftingHandler implements ICraftingHandler{ @Override public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix) { } @Override public void onSmelting(EntityPlayer player, ItemStack item) { if(item.itemID == Item.ingotIron.itemID){ player.inventory.addItemStackToInventory(new ItemStack(Block.stone, 1)); } } } This will give you one stone if you pick up a iron ingot from the output stack of a furnace. Hope it helped
  14. Do you mean if you smelt something in a vanilla furnace (f.e. Iron Ore), you get an Item (f.e. Stone) added to your inventory?
  15. Im trying to create a custom brewing stand recipe (Yes I know this has been asked a lot of times so far), but im trying to use it to create a potion with a CUSTOM potion effect. The calculation Damage Value of Potion -> List of Potion Effects gets Handeled in the PotionHelper class. public static List getPotionEffects(int par0, boolean par1){ ArrayList var2 = null; Potion[] var3 = Potion.potionTypes; int var4 = var3.length; for (int var5 = 0; var5 < var4; ++var5) { Potion var6 = var3[var5]; if (var6 != null && (!var6.isUsable() || par1)) { String var7 = (String)potionRequirements.get(Integer.valueOf(var6.getId())); if (var7 != null) { (.... more stuff) It gets a String of the HashMap potionRequirements. Although my potion effect would be called, it doesnt have a entry in potionRequirements, so (var7 != null) would return false and it wouldnt work. I cant add a value to potionRequirements because its set to private. Is there a way around this wthout editing base files? This is the only way i found, Brewing Stands can only output a potion (with a damage value wich it gets from the potion ingredient).
  16. Is there a way to disable crop tramling (Farmland getting set to Dirt) under certain circumstances? (Without modifying BlockFarmland of course) Is there maybe a forge event that could be used for this? I know canTriggerWalking(), but im trying to use it for existing mobs. Thanks, VengeanceSoldier
×
×
  • Create New...

Important Information

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