Everything posted by vemerion
-
[SOLVED]-[1.16.1] How to handle Custom Slime Death
Try overriding the remove method in the ColoredSlimeEntity and setting the color of the new children to the same color as the parent.
-
How to make the player invincible for a set number of ticks?
You could listen to the LivingHurtEvent event and cancel it if the entity is a player.
-
How do I use Events
Strange, maybe try to just search for *.api.Event or *forge*.Event . It is a little bit finicky to find the event class, since there are a lot of different event classes from different irrelevant libraries which we do not want. The method Draco explains should also work, don't forget to right click on the Event class in the type hierarchy tree and select Focus On 'Event'.
-
[1.15.2] Missing library
You might have to specify the path to the jdk (and the jre that comes with it), but I think it does so automatically when installing java. You can check the location of java the eclipse is using under Window -> Preferences -> Java -> Installed JREs.
-
How do I use Events
If you are using eclipse (but presumably other IDEs have similar functionality) you can view all events by: Pressing ctrl+shift+t to and search for the net.minecraftforge.eventbus.api.Event type Click on the class name and press F4 to open the Event type hierarchy, where you can view all events
-
[1.14.4/1.15.2] [Solved] Custom Leaf Help
No problem, glad I could help!
-
[1.15.2] Missing library
Something similar has also happened to me once, and I am not quite sure what was wrong, but here is what I did to fix it: Reinstalled the JDK Downloaded an older version of eclipse (I think I ended up using eclipse-2018-12) Made sure that the eclipse installation, the JDK, and the workspace were on the same disk volume Ran the eclipse and genEclipseRuns tasks in the terminal before importing the project to eclipse Hope this helps!
-
[1.14.4/1.15.2] [Solved] Custom Leaf Help
I think the problem is that the superclass LeavesBlock tries to set the default state for DISTANCE in its constructor, which unfortunately does not exist anymore due to the fact that you have overriden fillStateContainer. To fix this, change the string name of your DISTANCE variable, like so: public static final IntegerProperty DISTANCE = IntegerProperty.create("distance2", 1, 11); and also change fillStateContainer to the following: @Override protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { builder.add(DISTANCE); super.fillStateContainer(builder); } Hopefully that will work.
-
[1.15.2] Playing music
No problem, glad I could help!
-
[1.15.2] Playing music
ClientTickEvent is fired on the Forge bus, try changing bus = Mod.EventBusSubscriber.Bus.MOD to bus = Mod.EventBusSubscriber.Bus.FORGE
-
[1.16.1] Trouble with displaying particles
No problem! Happy modding
-
[1.16.1] Trouble with displaying particles
Try casting the world instance first, like so: ServerWorld world = (ServerWorld) target.getEntityWorld();
-
[1.16.1] Trouble with displaying particles
Assuming that it has not changed since 1.15, EntityInteract is fired on both logical sides. This means that when it is fired on the client side, the world will be a ClientWorld (remember that ClientWorld is a subclass of World), and thus addParticle will be implemented and work, which it why it works for the Rats mod. The onLivingHurt event however only fires on the server, I believe. Edit: To create particles from the server, use the spawnParticle method instead of addParticle (as I now see that the Rats mod does), which should also send the particles to the client.
-
[1.15.2] Playing music
This would play your music once every 1000 ticks (every 50 seconds): private static int musicTimer = 1000; @SubscribeEvent public static void onTick(ClientTickEvent event) { if (event.phase == Phase.END && event.side == LogicalSide.CLIENT) { if (musicTimer-- <= 0 && Minecraft.getInstance() != null && Minecraft.getInstance().player != null) { musicTimer = 1000; Minecraft.getInstance().player.playSound(YOUR MUSIC HERE, 2f, 1f); Minecraft.getInstance().getMusicTicker().stop(); } } } Although I think the vanilla Minecraft music could potentially start while your music is playing, so you would have to handle that also.
-
[1.15.2] Playing music
You could register your own SoundEvents as detailed here, and then for example play those SoundEvents (your music) in a tick event at random.
-
[1.15.2] Ticking Entity Error
No problem, I am just glad to help. Happy modding!
-
[1.15.2] How to slow down growth speed
You could listen to the event BlockEvent.CropGrowEvent.Pre to slow down growth speed.
-
[1.15.2] Ticking Entity Error
It seems like you first have to register the attribute, like so: this.getAttributes().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE);
-
[1.15.2] Ticking Entity Error
I think you have to also set the ATTACK_DAMAGE attribute in your registerAttributes() method.
-
Does Forge have an api manual?
Alright, thanks for the info!
-
Does Forge have an api manual?
Are you sure? I thought the order was Blocks -> Items -> Everything else in alphabetical order.
-
[1.15.2] Cannot get overridden block methods to run
onEntityWalk detects when an entity is on top of a block, if that is what you need.
-
[1.15.2] Cannot get overridden block methods to run
I suspect the methods work, but that you are mistaken about when they should trigger. onEntityCollision is supposed to only trigger when the entity is inside, and onBlockClicked only triggers for left click, use onBlockActivated for right click.
-
[1.15.2] Implementation of IForgeEffect & IForgeEffectInstance
If you are fine with just hiding the top right potion icons and the particles (but not the inventory screen effect), you can utilize the onRenderGameOverlay and onPotionColorCalc events, respectively.
-
Help with my forge setup (1.15 this time)
Did you run the eclipse task or only genEclipseRuns? To be honest, if I were you I would redo the project and follow a tutorial such as this to the letter, and see if that works.
IPS spam blocked by CleanTalk.