Everything posted by vemerion
-
[1.16.2] Triggering event if a specific food item is eaten
No problem, glad I could help!
-
[1.16.2] Triggering event if a specific food item is eaten
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
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
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
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
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
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
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
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?
No problem, glad I could help!
-
RESOLVED! [1.14] How do you make modded entities hold items?
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?
Try adding a HeldItemLayer to your mob renderer.
-
[1.15.2] Custom Boat Help
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.
-
1.15.2 Crafting JSON not working
I see nothing wrong with your crafting recipe json file, I think the problem lies elsewhere. Where is the json file located?
-
Need help with an error!!!
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?
-
[Solved] Is it possible to make a potion effect that can't be cured by milk?
You could perhaps listen to the PotionRemoveEvent and check for a specific effect, and then cancel the event.
-
-
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.
-
[1.15.2] Player gets stuck when left clicking grass with Gun Item
Well, the easy way to fix this is to return true from canPlayerBreakBlockWhileHolding. Of course that means that the grass will be destroyed while holding the gun instead...
-
Check if player presssed key associated with jumping. (for a double jump type mechanic)
You would have to detect the jumping with for example a KeyInputEvent, and then send a packet to the server to inform the server that it should perform a jump action on a player. EDIT: Turns out there is a better way to do this, see diesieben's answer above.
-
How would i go about implementaling wall climbing. Ability to climb walls like ladders but slower. Using events
No problem, glad I could help! Slowing down the speed of the climb is easy, just change the y value in setMotion from 0.2 to something lower. As for requiring the player to look at the wall, that might be a bit harder, but should be doable with something like a RayTrace.
-
How would i go about implementaling wall climbing. Ability to climb walls like ladders but slower. Using events
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()); } }
-
[Solved] [1.16.1] Vines Generation Help
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.
-
How do I make custom TNT in Minecraft 1.16.1?
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.
-
Falling Block Inverted Gravity
You should add a call to super.tick() in your tick method (or at least a call to this.move()).
-
Custom Entity Child size?
If it is unchanged from 1.15, then you can specify the childBodyScale in the constructor of AgeableModel.
IPS spam blocked by CleanTalk.