Everything posted by Newww
-
Remove possibility to place string (tripwire)
Well, I'm not going to update since I want this modification to work in 1.7.10 :L Does it make much of a difference with the code?
-
Remove possibility to place string (tripwire)
Tried that before, didn't make much of a difference lol
-
Remove possibility to place string (tripwire)
Why do I need any Proxies? :L
-
Remove possibility to place string (tripwire)
_________________________________________ public class StringFix { @SubscribeEvent public static void PlayerUseItemEvent(net.minecraftforge.event.entity.player.PlayerUseItemEvent.Start event) { ItemStack itemstack = event.entityPlayer.inventory.getCurrentItem(); if (itemstack.getItem() == Items.string) { event.setCanceled(true); } } } __________________________________ Ok, that's my current code. But he still places down those tripwires :L And about that @SubscribeEvent, I need that right? And here's my main file, if there's a mistake in there lol ___________________________________________ package com.example.examplemod; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.init.Blocks; import net.minecraftforge.common.MinecraftForge; @Mod(modid = ExampleMod.MODID, version = ExampleMod.VERSION) public class ExampleMod { public static final String MODID = "examplemod"; public static final String VERSION = "1.0"; @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new StringFix()); } }
-
Remove possibility to place string (tripwire)
It doesn't do anything. Still places that dumb tripwire :L Is " PlayerUseItemEvent " even the correct on to use?
-
Remove possibility to place string (tripwire)
Like this? :L ___________________________________________ public void PlayerUseItemEvent(net.minecraftforge.event.entity.player.PlayerUseItemEvent.Start event, Item itemStack) { ItemStack itemstack = event.entityPlayer.inventory.getCurrentItem(); if (itemstack.getItem() == Items.string) { event.setCanceled(true); } }
-
Remove possibility to place string (tripwire)
Don't make it so difficult for me :L I just wanted to know how I could get that code to work. I'm just not good with java :L
-
Remove possibility to place string (tripwire)
Could you maybe write that short piece of code for me to copy? That would be really kind of you!
-
Remove possibility to place string (tripwire)
I'm just going to stop and hope that someone else writes a mod that does the same thing lol.
-
Remove possibility to place string (tripwire)
And is " event.setCanceled(true); " at the end enough to cancel the right click action, so it doesn't place the string? Or do I need to say which event has to get canceled?
-
Remove possibility to place string (tripwire)
Ahhh D: I'm sorry, but I really don't know how to translate that into code.
-
Remove possibility to place string (tripwire)
" ItemStack getItem; " gets the item out of the stack right? But what's the single item called? _______________________________________________ public class TripWireRem { public void PlayerUseItemEvent(net.minecraftforge.event.entity.player.PlayerUseItemEvent.Start event, Item itemStack) { ItemStack getItem; if (Item == Items.string) { event.setCanceled(true); } } }
-
Remove possibility to place string (tripwire)
Ok, thanks! I'm just having some problems translating that into some working code :L _________________________________________________________________________ public void PlayerUseItemEvent(net.minecraftforge.event.entity.player.PlayerUseItemEvent.Start event, Item itemStack) { ItemStack getItem; if (itemStack == Items.string) { event.setCanceled(true); } }
-
Remove possibility to place string (tripwire)
public void PlayerUseItemEvent(net.minecraftforge.event.entity.player.PlayerUseItemEvent.Start event, Item itemStack) { ItemStack item = event.item; if (itemStack == Items.string) { event.item.useItemRightClick(null, null); } } ___________________________________________________________________ That's how far I got, not really far at all lol. I want string to do nothing at all when you right click it, just like gunpowder or glowstone for instane. Does someone have an idea what I could do?
IPS spam blocked by CleanTalk.