Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


Forge Modder
  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Rohzek

  1. You know what? It needed to be registered on the terrain event bus, not the event bus. Now, it's working but my attempt at placing my own block in it's place crashes. World world = event.getWorld(); BlockPos pos = event.getPos(); EventType type = event.getType(); if(type == EventType.PUMPKIN) { event.setResult(Result.DENY); if(!world.isRemote) { LogHelper.debug("I blocked a pumpkin spawn"); world.setBlockState(pos, SPBlocks.PUMPKIN_SP.getDefaultState()); } } EDIT: Because the pos it always spits out, is at y level 0. I'm quite confused here.
  2. Ah. That explains then. I wasn't thinking, and only looked in TileEntity. The NBT is pretty simple, for both items and tile entities. You would do something like: NBTTagCompound myCompound = tileEntity.getTileData(); myCompound.setString("keyToSave", "valueToSave"); Keep in mind TileEntity#getTileData (in 1.11 anyway) specifically checks to see if the NBTTagCompound is null, and if it is, sets it to a new one. You should probably check to make sure it's not null before reading it or writing to it, anyway though. and to retrieve it later, you would do this: String myName = myCompound.getString("keyToSave");
  3. I don't know much in the way of what's wrong with your current issue, but as an alternative you could try saving and loading the String you want in the tile entity's NBT, instead of using TileEntity#setCustomName, which seems to be more future proof, as I went to investigate that method, and couldn't find it in the TileEntity class for 1.11 (which is what I am currently working with).
  4. @Mod.EventBusSubscriber public class DecorateBiomeEventSP { @SubscribeEvent public static void onDecorateBiome(DecorateBiomeEvent.Decorate event) { World world = event.getWorld(); BlockPos pos = event.getPos(); EventType type = event.getType(); if(type == EventType.PUMPKIN) { event.setResult(Result.DENY); world.setBlockState(pos, SPBlocks.PUMPKIN_SP.getDefaultState()); } } } I'm only replacing the melons and pumpkins. The melons use the same texture so I just changed the drop you get with the harvest drops event to my custom one, but my custom pumpkin removes the face (and will make you carve one on, to get the vanilla pumpkin... unless I can make a custom block work to spawn the snow golem) so I'm trying to replace them.
  5. So, I can block the spawn with: setResult(Result.DENY); That actually didn't seem to block them from spawning, for some reason.
  6. How would one go about stopping the spawn of a vanilla block, say, the Pumpkin and replacing it with a modded block? On world generation, that is, not on growing.
  7. That's what I would have thought. But either I messed this up hard, or I don't seem to have that option.
  8. What's exactly is the new way to check for a block when mining it? It used to be if(event.block == Block.whateverblock) {} and it now seems it has to be... if(event.getclass() == whateverblock.class) {} ...is that it?
  9. Registering my item this way, worked perfectly. I now have textures in the game, and can cycle between the different textures no problem. Thank you all, so much.
  10. I was calling it during the preinit of my main class public static void PreInit(FMLPreInitializationEvent PreEvent) { MinecraftForge.EVENT_BUS.register(new LoadModelEvent()); } I also tried (after reading through Choonster's link) making it static, and making that public static void PreInit(FMLPreInitializationEvent PreEvent) { MinecraftForge.EVENT_BUS.register(LoadModelEvent.class); } Which also didn't work. I then tried removing that, and using: @Mod.EventBusSubscriber public class LoadModelEvent { ... } Which runs, and gets a nullpointerexception because the items aren't loaded yet... Attempting to load the items by registering them in the event too instead of normal fixes that, but then they get initialized as being from minecraft instead of being from my MODID Exception loading model for variant minecraft:testitemstage0#inventory for item "minecraft:testitem", normal location exception: Sorry, I am 100% thoroughly lost and confused.
  11. I seem to be failing to properly register my ModelRegistryEvent, as it seems it doesn't complain because that method never runs? I've tried registering it with the forge event bus in both my Main, and ClientProxy and neither works... ...This is probably all wrong? MinecraftForge.EVENT_BUS.register(new LoadModelEvent()); LoadModelEvent: ... @SubscribeEvent public void onModelRegistry(ModelRegistryEvent event) { testItems.registerRenders(); } TestItems: ... public static void registerRenders() { registerRender(testItem, 0, "Stage0"); registerRender(testItem, 1, "Stage1"); registerRender(testItem, 2, "Stage2"); } public static void registerRender(Item item, int meta, String addon) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName() + addon, "inventory")); LogHelper.debug("I should be loading the json file for: " + item.getRegistryName() + addon + " and setting metadata: " + meta); }
  12. Hmm. That sounded easy until I managed to confuse myself. I was originally using and it could find my original json file just fine, and it showed in game. I tried changing that to take a string to seperate them, making it: And that didn't complain about not being able to find my new json files, but it was broken texture in game. After switching that to ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName() + addon, "inventory")); Now it also can't find my json files. After remembering to register my event, same problem as above. It doesn't complain that it can't find the json files... ...it just doesn't load the textures in game.
  13. Just the easiest way. Preferably if it doesn't involve just removing the item, and adding in another one.
  14. Is there an easy way to change the texture of an item in say, an overridden onItemRightClick, by changing which layer, or which model file is being loaded?
  15. In your item class. You'll have to create a new item class and extend either sword or bow... or item. Yep it's Item#getDamageVsEntity—at least it's the same in 1.7.10 anyway.
  16. Depends on if you want the "drawing" animation or not. Either as Failender said with a bow which will have the animation or by making a normal sword and overriding onItemRightClick and make it spawn an arrow on right click to fire without an animation
  17. I know that much. As I said (the quick buttons don't seem to be working right now so... improvise) "which is the spawn block in world under onupdate.. taken straight from the vanilla code for melons..." Line 120 is world.setBlock(j1, y, k1, this.block); but I can't even begin to imagine why that could be null. The stem works fine on it's own... as does the melon block... it's when it tries to spawn a melon that it breaks.. and the code is literally copy pasted from the vanilla code. I don't understand why it's not working. EDIT: Out of curiosity.. I just deleted that entire class and started over RE copypasta-ing and refactoring variables.... and this time it worked just fine.... I don't even know what was up but thats fixed. That just leaves the particles of my custom food being a weird color.
  18. Are you making a new GUI for the player inventory or trying to change the vanilla one?
  19. More custom food errors... but this time only halfway related to the spoiling food... Namely those foods have messed up particles So this was interesting to try and snap a picture for but: The food particles don't look anything like ANY of the textures I have registered for this... Is there a easy way to fix or remove them? and more pressingly: My custom block/stem crops are crashing with: java.lang.NullPointerException: Exception ticking world ... at com.Rohzek.food.crop.BlockStem.updateTick(BlockStem.java:120) ... which is the spawn block in world under onupdate.. taken straight from the vanilla code for melons... Not sure whats wrong with it?
  20. Hmm. Interesting. I COULD compound things by adding checks to see how long it's been since the update function of the entityitem has ran similar to how I handled the chest..but I'm not sure I care THAT much, at least right now... I guess item frames are free safe storage for my foods then. Thanks.
  21. You could save a number to the itemstack's nbt and change that number on right click. Then in your geticon method load the number from the nbt and say if the number is equal to whatever number, change the texture to another one
  22. EDIT: I still don't know how to deal with Item Frames.. but my problem my last problem was one number out of place messing the numbers up. Anyone have any ideas about how to work with item frames? Do I still have access to the entityItem / the itemstack's nbt or something somehow while it's on an item frame?
  23. That... is a LONG time... heh... long.. Okay I'm shutting up now. Right thank all of you so much. It's really cool. Here it is in action(Youtube)
  24. Okay, using a PlayerTickEvent items now degrade correctly when in chests. I can either lower the amount of change or just not check at all I guess, if they are in a "fridge". Cool. Now what I have left is the entity item. I see you can just get the itemstack from the entity item so that shouldn't be too hard to just call on onEntityItemUpdate. I'm just not quite sure about one thing.. the method I'm using to get the time (world.getWorldTime()) always seems to return a big number. Does it reset to 0.. like when the next day starts? If not how long before it's too big to be cast as int/long/double or whatever I store it in? If so how does that work with the check.. or am I using the wrong type of time?
  25. Okay so right now... I have it so that 100 ticks after creation the item goes stale.. and 100 ticks after that it goes moldy.. It does this by storing time and data to the ItemStack's TagCompound. I'm not sure where to go from here though, how do I transfer/read that from the entityitem and or detect when items are placed into a container?
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.