Posted January 6, 201312 yr Hi, sorry to ask for something else again so soon, but maybe this is easier to get than a recipe remover for IC2: Does anybody know of a mod that will ban certain item IDs from a player's inventory? I could REALLY use that very well right now and would be so very grateful for any hint.
January 6, 201312 yr I see, your one of those server owners who likes to ban all the fun stuff. It wouldnt necassaraly be too hard. It's really as simple as checking a players inventory on playerEvent so it's probably simple enough for you to code yourself "you seem to be THE best modder I've seen imo." ~spynathan ლ(́◉◞౪◟◉‵ლ
January 6, 201312 yr Author I am one of those server owners who don't like it that the mining laser bypasses protection and so does the terraformer. If that wasnt't the case me and the other thousands of ppl since probably before 1.2.5 that struggled with the same issue (yes I did set up a large number of server and any one with IC2 on had to either get rid of the problematic stuff at once or after the grief) wouldn't even try so hard I have familiarized myself with the events in forge as can be found under jd.minecraftforge.net and my money would be on PlayerInteractEvent. Let's see if I can produce something useful here EDIT: I think it's the right event but I can't find any tutorial showing how to actually make that event fire ingame. I have all the other pieces I need (checking item in player hand, deleting item in player hand) so could somebody point me towards some source that uses events, so I can learn what I am still missing? Of course, when I am done, I will release my code and jar here for anybody to mess with as they like, so it's not like I am just wasting people's time
January 8, 201312 yr AtomStricker has an event tutorial on the mc forums. It's a little outdated, but overrall things still work the way he shows it "you seem to be THE best modder I've seen imo." ~spynathan ლ(́◉◞౪◟◉‵ლ
January 8, 201312 yr Author I googled and otherwise searched for AtomicStriker and AtomicStricker and both yielded no useful results. Could you possibly give me a link to his or any other tutorial? All I really need is to see how a mod registers an event. As long as the basic mechanics are the same it doesn't even have to be the PlayerInteractEvent that I want to use. As for my current status: I have learned how to set up, de/re-compile forge and how to make basic mods for recipes. Once I can use events I will move on to using configs and then make a mod that filters item IDs out of user inventories and armor slots based on config settings. I can see this being useful for lots of people
January 9, 201312 yr Here's the link http://www.minecraftforum.net/topic/1419836-131-forge-4x-events-howto/ Ps all the events are located in the minecraft forge package "you seem to be THE best modder I've seen imo." ~spynathan ლ(́◉◞౪◟◉‵ლ
January 9, 201312 yr Author Alright, that did it. My mod seems to be working fine now. I can ban any item id and when ppl do any kind of action, items vanish as they should. Now to get this to work with configs and it could be a very useful mod. You really are the best
January 10, 201312 yr You really are the best I see what you did there "you seem to be THE best modder I've seen imo." ~spynathan ლ(́◉◞౪◟◉‵ლ
January 11, 201312 yr Author Alright. Still dev work to do, but this might be useful for some ppl since it is pretty much all that is needed to inventory ban items that use unusual crafting (like the IC2 crafting). For any other type I recommend ShadowDragons RecipeRemover. Please note that these item IDs are for FeedTheBeast direwolf20 pack (should work with MindCrack too) and that my code is far from streamlined (like the proxys can probably be omitted). Just saying this might be useful since it DOES just work ARecipeMod.java package com.gamemakerworld.aRecipeMod; import net.minecraft.block.Block; import net.minecraft.item.*; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid="ARecipeMod", name="ARecipeMod", version="0.0.20") @NetworkMod(clientSideRequired=false, serverSideRequired=false) public class ARecipeMod { // The instance of your mod that Forge uses. @Instance("ARecipeMod") public static ARecipeMod instance; // Says where the client and server 'proxy' code is loaded. @SidedProxy(clientSide="com.gamemakerworld.aRecipeMod.ClientProxy", serverSide="com.gamemakerworld.aRecipeMod.CommonProxy") public static CommonProxy proxy; @PreInit public void preInit(FMLPreInitializationEvent event) { //stub } @Init public void load(FMLInitializationEvent event) { //stub } @PostInit public void postInit(FMLPostInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new Events()); } } CommonProxy.java package com.gamemakerworld.aRecipeMod; public class CommonProxy { public void registerRenderers() { //stub } } ClientProxy.java package com.gamemakerworld.aRecipeMod; public class ClientProxy extends CommonProxy { } Events.java package com.gamemakerworld.aRecipeMod; import cpw.mods.fml.common.network.Player; import net.minecraft.block.Block; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.player.PlayerInteractEvent; public class Events { @ForgeSubscribe public void playerInteract(PlayerInteractEvent event) { //check player's inventory for contraband and remove it EntityPlayer player = event.entityPlayer; Container cont = player.inventoryContainer; int i = 0; Slot slot; ItemStack stk; while(i<40 && (slot = cont.getSlot(i))!=null) { if(slot.getHasStack() && (stk = slot.getStack())!=null) { //nano suit and saber to a diamond each if(stk.itemID==30148 || stk.itemID==30175 || stk.itemID==30176 || stk.itemID==30177 || stk.itemID==30178) cont.putStackInSlot(i, new ItemStack(264, 1, 0)); //terraformer modules if(stk.itemID==30146) cont.putStackInSlot(i, new ItemStack(331, 10, 0)); //mining laser if(stk.itemID==30208) cont.putStackInSlot(i, new ItemStack(264, 2, 0)); } i++; } } } EDIT: Not sure if everybody can deal with source code, so (under the express limitation of this BEING AN ALPHA VERSION) I am also releasing the mod file here. http://gamemakerworld.com/stuff/aRecipeMod_a20_1.4.6.zip The contents are as shown above in the code. The way it is made it should not be able to mess up your players' inventories and definitely not your world, since it only replaces items with vanilla stuff. This is for the direwolf20 pack (probably works with MindCrack but needs testing there) for 1.4.6 (probably 1.4.7 too) and removes the following items, replacing them with a bit of some of their components: Nano suit and saber, mining laser, terraformer modules
January 11, 201312 yr Need any help with a config file? Also delete the proxies and the mod instance, theyre just wasting ram. "you seem to be THE best modder I've seen imo." ~spynathan ლ(́◉◞౪◟◉‵ლ
January 12, 201312 yr Author Thanks for the hints - I didn't know if the instance and proxy stuff was somehow important and not having them could cause instability. Now I can safely remove them As for config, I know there is a tutorial for that and I will try to work with it. For now I have to get a server running (have a release today). If I run into problems making config control later, I will be grateful for help though. Really nice community here
February 11, 201312 yr it would be amazing if you made a version with a config or without banning nano suits cause those are needed to make better armor
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.