-
Posts
390 -
Joined
-
Last visited
-
Days Won
15
Everything posted by vemerion
-
[1.16.2] Triggering event if a specific food item is eaten
vemerion replied to naelsun's topic in Modder Support
No problem, glad I could help! -
[1.16.2] Triggering event if a specific food item is eaten
vemerion replied to naelsun's topic in Modder Support
No problem! If you decide to go with the event solution, you can get the item like so: (which should work regardless of stack size) @SubscribeEvent public static void onFoodEaten(LivingEntityUseItemEvent.Finish event) { if (event.getItem().getItem() == RegistryHandler.GOLDEN_CHORUS_FRUIT.get()) { // Do what you want here } } if you go with the override route, you would do something like this: public class MyItem extends Item { public MyItem(Properties properties) { super(properties); } @Override public ItemStack onItemUseFinish(ItemStack stack, World worldIn, LivingEntity entityLiving) { // Do what you want here return entityLiving.onFoodEaten(worldIn, stack); } } -
[1.16.2] Triggering event if a specific food item is eaten
vemerion replied to naelsun's topic in Modder Support
You can get the ItemStack used directly from the event with the getItem() method. However, since it is your own custom item, you can alternatively override the onItemUseFinish method in the item class and avoid using an event altogether. -
[1.16.2] Triggering event if a specific food item is eaten
vemerion replied to naelsun's topic in Modder Support
Is it your own custom food item? If so, you can override the different methods in the item class (such as onItemUseFinish) to implement your functionality. Otherwise, you can subscribe to one of the subclasses of LivingEntityUseItemEvent, and check if the item being used is the specific one you want. -
[1.16.2] My ModSnowball does not render with texture
vemerion replied to Ooooscar's topic in Modder Support
You are absolutely right, you have to register a renderer for your snowball. If I am not mistaken it is the SpriteRenderer you should use. -
[1.16.2] Create custom sand-like block that falls upwards
vemerion replied to spicy shrek's topic in Modder Support
Minecraft does it by creating a FallingBlockEntity. You should be able to do a 'falling upwards' block by extending FallingBlockEntity and set the motion upwards instead of downwards. -
[1.16.2] My ModSnowball does not render with texture
vemerion replied to Ooooscar's topic in Modder Support
You are overriding getItem() and returning null, which is a problem, since it is getItem() that determines the texture of the projectile. I don't think you need to override that method at all, since the definition in the superclass should be fine. -
RESOLVED! [1.14] How to make entity swing arm when attacking
vemerion replied to ImZDUDE9's topic in Modder Support
How have you implemented the attacking? Because if you are using the MeleeAttackGoal, I believe it sets the swingProgress variable, which you can then use to rotate the arm of the entity. -
[1.15.2] issue while trying to get contents of an ArrayList
vemerion replied to Skelyvelocirap's topic in Modder Support
Seems to me like you are never initializing your array, and thus it is null. -
RESOLVED! [1.14] How do you make modded entities hold items?
vemerion replied to ImZDUDE9's topic in Modder Support
No problem, glad I could help! -
RESOLVED! [1.14] How do you make modded entities hold items?
vemerion replied to ImZDUDE9's topic in Modder Support
The easiest way would probably be to make your own class that extends HeldItemLayer and add translation and scaling before rendering the item. -
RESOLVED! [1.14] How do you make modded entities hold items?
vemerion replied to ImZDUDE9's topic in Modder Support
Try adding a HeldItemLayer to your mob renderer. -
You really shouldn't copy all the attributes and method from a superclass into a subclass, because you already get those by inheritance. As far as boat speed is concerned, I think setMotion is the way to go, as with all entities.
-
I see nothing wrong with your crafting recipe json file, I think the problem lies elsewhere. Where is the json file located?
-
You should user the debug mode of your IDE together with breakpoints to figure out what is null. Also why have you annotated your entity classes with EventBusSubscriber?
-
Hi! I have found Tabula to be tremendously helpful when creating custom models for entities. Blockbench is another alternative, which is also a pretty great tool.
-
You could try using a PlayerTickEvent like this: @SubscribeEvent public static void onPlayerTickEvent(PlayerTickEvent event) { if (event.phase == Phase.START && event.player.collidedHorizontally) { Vec3d motion = event.player.getMotion(); event.player.setMotion(motion.getX(), 0.2, motion.getZ()); } }
-
Hello! I think your best bet is to create a new feature which places your own vine block. As you noted yourself, the already existing VinesFeature is a good place to check to learn how to make your own feature.
-
I think a good place to start is looking at how vanilla Minecraft does it. Look at the classes TNTBlock and TNTEntity to get an idea of how you could go about making your own custom TNT blocks.
-
You should add a call to super.tick() in your tick method (or at least a call to this.move()).
-
If it is unchanged from 1.15, then you can specify the childBodyScale in the constructor of AgeableModel.