Siqhter
Members-
Posts
149 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Siqhter
-
I think I was just phrasing this badly. Yes, by instantiating I did mean creating the new block using the "new" keyword. And then I register it in the correct register event in my registryhandler class.
-
Ok, I will definitely try that. But it is acceptable to use an array list, create the blocks in a BlockInit class and add them to an array, and then instantiate in RegistryEvent#register? (As long as it is not a static instantiation?)
-
Sorry if I'm misunderstanding, because I probably am, but isn't it just less code to use an array? With the example you provided wouldn't it be a new line per block?
-
I register them using
-
Ok, that's what I thought. I'm looking at other examples, but I'm having trouble finding where I should add the block to the arraylist, because it's normally done in blockbase.
-
Huh, I see. I was just scanning through MrCrayfishsFurnitureMod on GitHub out of curiousity, and I was wondering if you could tell me if this is close to how it should be done. https://github.com/MrCrayfish/MrCrayfishFurnitureMod/blob/master/src/main/java/com/mrcrayfish/furniture/init/FurnitureItems.java
-
Should I also remove the BlockBase class, or is that not necessary?
-
Ok, thanks everyone for help with this. Going back to Animefan8888's original answer and working from there I have gotten registration to work. This is definitely different than how a lot of the poorly structured youtube tutorials teach it.
-
Does anything have to be registered in Main.java? It's currently not registering.
-
So I could register ItemInit.init() and BlockInit.init() in preInit, but it would be prefered to do it in: @SubscribeEvent public static void onBlockRegister(RegistryEvent.Register<Block> event) { BlockInit.init(); }
-
You mentioned registering them once I added them to an array, and I just wanted to see if this is acceptable.
-
Awesome, thanks.
-
Ah, thanks. Is there an example of how it should be done? Everyone seems to do it in the format of the above line I posted.
-
Ok, that makes sense. I've also found that the majority of YouTube tutorials do this as well: But many people have said not to.
-
Wow, that probably removed 40 lines of code. Why did people do that in the first place? Also, I assume I still want to used an Array to store blocks and items?
-
Recently, after reading one of my posts, someone said that I should not use IHasModel. I have also heard this in numerous other Forge discussions, and I was wondering how about exactly do I replace it? I register my blocks like this: My BlockBase class implements IHasModel. So how would I remove IHasModel? Thanks.
-
Ok, thanks. I could just copy over the RayTraceResult method, but that's extra code.
-
Ok, I might have been misunderstanding, but since RayTraceResult is protected, I can access it with the this keyword if my class extends Item.
-
Thanks! I got it working. Just a quick question while I'm on this topic, does my class have to extend Item to use RayTraceResult?
-
So in this method, specifically at itemStack.isEmpty(), when I am in creative mode and right click on water with a bottle, the bottle quickly fills with water then instantly gets removed from the inventory. itemStack#isEmpty is called when there is only 1 bottle left in the stack. In survival this does not happen and it fills up as it should. Everything else is working fine. Also if I change it to PlayerInteractEvent.RightClickBlock, this problem does not occur. This is everything in the class.
-
Sorry, I actually got it. I was just wondering however if my class has to extend Item to use RayTraceResult. Specifically #rayTrace, where the arguments are.
-
Ok thanks. So mimicking the code in ItemGlassBottle (or similar to it, at least) should be good, without adding too much I don't need?
-
Ok, that's what I thought. Is there a downfall to that?
-
I have looked through the ItemGlassBottle and ItemBucket classes in answer to this question, but is there a way to detect if the player right clicks on a block of water with an item using PlayerInteractEvent?
-
Registering an Event class that extends EntityLiving
Siqhter replied to Siqhter's topic in Modder Support
I just got it. EntityCow cow = (EntityCow) event.getTarget();