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


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by vemerion

  1. If you want to check for a certain item and delete all stacks of it from the player inventory, you could do something like this: IItemHandler inventory = new PlayerMainInvWrapper(player.inventory); for (int i = 0; i < inventory.getSlots(); i++) if (inventory.getStackInSlot(i).getItem() == <THE ITEM YOU WANT TO DELETE>) inventory.extractItem(i, inventory.getSlotLimit(i), false); The IItemHandler is a class provided by Forge that makes manipulation of inventories easier, which is why it is advantageous to use that instead of manipulating the player inventory directly. EDIT: Or do you want to consume the item you are using? The you could do stack.shrink(1) or similar on the item stack in question.
  2. I think a good starting point would be to look at how the WitherEntity and the GhastEntity fires these projectiles, and do it in a similar fashion 🙂
  3. One idea would be to subscribe to the PlayerTickEvent and check that the player is in water but close to the surface, something like this: @SubscribeEvent public static void jump(PlayerTickEvent event) { PlayerEntity player = event.player; if (<CHECK IF PLAYER IS JUMPING> && player.isInWater() && player.level.getBlockState(new BlockPos(player.getX(), player.getY() + 0.5, player.getZ())) .getFluidState().isEmpty()) { player.setDeltaMovement(player.getDeltaMovement().add(0, 0.2, 0)); } } Unfortunately, the field LivingEntity.jumping is protected so you can not easily access it to check if the player is jumping. Probably best to use reflection to access it.
  4. The drinking animation is completely hardcoded in vanilla, if you want a custom drinking animation for one of your items you have to subscribe to the RenderHandEvent and make your own animation.
  5. I don't think this is currently possible without using something like mixins. Might be worth it to add an event for it though.
  6. If you want to change the hitbox size of the entity, you can change the arguments to the sized() method when creating the entity type. If you want to scale the model of the entity, you could use the scale() method on the matrix stack in the entity renderer (although I have never used GeckoLib so I don't know if that changes anything in regards to the rendering).
  7. For those that might stumble upon this post with the same problem in the future: The solution in this case was to add this to the entity class: @Override public IPacket<?> getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } A rule of thumb: If you custom entity is not a LivingEntity, then you need to override getAddEntityPacket(). This is due to the fact that vanilla handles non-living entity spawn packets in a hard coded way.
  8. I just tested and good news! You don't need to do anything special to have a semi-transparent item. Just make the texture transparent and you should be good to go!
  9. The best tutorial is the vanilla source code! Advancements are data-driven, so you can add them via json files. To avoid having to manually create these json files, I would recommend using data generators! You can check out the AdvancementProvider class and for example the TheEndAdvancements class to see how to generate advancements json files. If you just want to know more about the advancement json format the Minecraft wiki has a good article on that.
  10. I think the class was just renamed to ItemBlockRenderTypes when the switch to official mappings for class names was made.
  11. The forge documentation about sounds explains which methods to use in different situations.
  12. You can't really have an instance field like extraArmor in item classes, since items are singleton and every stack will share the same item. This means that for example if one player uses the item and changes the extraArmor field, it will also change for all other players that also have that item.
  13. No problem, I am glad I could be of assistance!
  14. The problem is that you are adding a new layer every time RenderPlayerEvent is called. You should add the layer to the player renderer only once at startup.
  15. The UUID is used to identify the attribute. This means that if two items have the same UUID for an attribute, the most recently equipped one will override the other if both are equipped at the same time. The Minecraft wiki has some info about it on the attribute page here. What I usually do is generate a random UUID once with UUID.randomUUID(), and then use that in UUID.fromString().
  16. You are using the overload for ModelRenderer.render() that doesn't take rgb parameters and always renders the texture white. Change the call to body.render() in the renderToBuffer() method in your PoggModel class to actually use the supplied red, green, blue, alpha parameters.
  17. Note that I am no expert on mappings, and I think generally it is best to use the same mappings as most other people use to make life easier for everybody. However, with that said, this should work: 1. Add this to your build.gradle to create a local maven repo on your computer: repositories { maven { url "file:///${project.projectDir}/mappings" } } 2. Change back the mappings channel (the mappings channel is hardcoded to use 'official', 'snapshot' and 'stable' so you have to use one of those): mappings channel: 'snapshot', version: 'vemerion-mappings' You can of course change 'vemerion-mappings' to something else but then you have to change it in the mappings repo as well in the next few steps 3. Create the file structure 'mappings/de/oceanlabs/mcp/mcp_snapshot/vemerion-mappings/' in your mod project folder 4. Inside the file structure you just created, create a zip file named 'mcp_snapshot-vemerion-mappings.zip', that should contain the fields.csv and methods.csv files etc 5. Run ./gradlew clean and ./gradlew cleanEclipse 6. Run ./gradlew genEclipseRuns and ./gradlew eclipse 7. If gradle complains about duplicate mappings then everything will probably fail and you have to update your mappings files and redo the process 8. Import the project into Eclipse 9. Your custom mappings should now work Hope this helps! As a last word of caution, I just want to reiterate that IMO it is probably best to stick with the normal MCP or Mojang mappings.
  18. You can useFOVUpdateEvent.setNewfov() to set it to the old value to avoid the FOV change.
  19. Strange, because this works for me: matrixStack.push(); matrixStack.translate(0, 0, 500); if (count != 1) this.font.drawStringWithShadow(matrixStack, num, startX + (i * 26), startY + (j * 26), 1); matrixStack.pop();
  20. Export the model as a java class, and then return an instance of it in the getArmorModel() method in your item. You can also override getArmorTexture() to change the texture of the armor.
  21. Things related to input and graphics are done on the client. Most other things related to the actual logic of the game should be done on the server. A bit of common sense goes a long way. For example, if you want to damage the player, you only want to do that on the server, since it is the server that keeps track of all the players and their state. If you want to place a block, you have to do it on the server, otherwise you end up with 'ghost-blocks' etc. When you use runServer for the first time a text file called eula.txt should be generated, which you have to edit to set 'eula=true' and then run the server again. But using runServer is not guaranteed to catch all errors related to sides, since it will only crash if you are using a method on the physical server that only exists on the physical client (for instance rendering methods). This page explains it in pretty good detail.
  22. When you are breaking a block, the "this" entity in the condition is the player, and since the primalmagic:drops_bloody_flesh tag contains the player, the condition is met. You would have to add another condition that checks that an entity was actually killed.
  23. Player movement is controlled by the client, that is you need to set the movement on the client.
  24. From what I can see you don't do a translation on the matrix stack. Have you tested that?
  • Create New...

Important Information

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