Jump to content

LuccaPossamai

Members
  • Posts

    65
  • Joined

  • Last visited

Everything posted by LuccaPossamai

  1. I did this, but my texture did no rendered. @Mod.EventBusSubscriber public class LevelGUI { private static final ResourceLocation ICON_LOCATION = new ResourceLocation("mohard", "textures/gui/mod_icons.png"); @SubscribeEvent public static void cancelRender(RenderGameOverlayEvent.Pre event){ if(event.getType().equals(RenderGameOverlayEvent.ElementType.HEALTH)){ event.setCanceled(true); renderModHealth(Minecraft.getInstance().gui event.getMatrixStack(), event.getWindow().getWidth(), event.getWindow().getHeight(), Minecraft.getInstance().player); } } private static void renderModHealth(IngameGui gui, MatrixStack matrixStack, int screenWidth, int screenHeight, PlayerEntity jogador){ int x = screenWidth / 2 - 91; int y = screenHeight - 39; Minecraft.getInstance().getTextureManager().bind(ICON_LOCATION); gui.blit(matrixStack, x, y, 0, 0, 90,9); int percentual = (int) Math.ceil((jogador.getHealth() / jogador.getMaxHealth()) * 20); for(int i = percentual; i > 0; i--){ gui.blit(matrixStack, x + 1 + (i * 4), y + 1, 1 + (getHealthType(jogador) * 4), 10, 4, 7); } } private static int getHealthType(PlayerEntity jogador){ return jogador.hasEffect(Effects.WITHER) ? 3 : jogador.hasEffect(Effects.POISON) ? 2 : jogador.hasEffect(Effects.ABSORPTION) ? 1 : 0; } }
  2. I was looking and coding with Attributes, and I see that, when you have a lot of Max_Health, your game starts to get a little bit visually poluted(like in the picture). After a while, these hearts starts to be really annoying. I was thinking in create a toggle switch to show and hide your health or even change the hearts display to be more confortable. I see the: RenderGameOverlayEvent but I really don't understand how to do it. In the case of changing the hearts visual, how do I "Override" the renderHearts method in the IngameGui class, if the method it's not a Overridable method?
  3. I've created some attributes, and I want to aply to all the entities in the game including the players. But I'm a bit confused with this. Someone know how to do it?
  4. Thanks, I'd realized where I messed up the things.
  5. Capability.IStorage: The class that extends the capability: The ICapabilitySerializable: And the container Inventory:
  6. I tried to use the player.addAdditionalSaveData(CompoundNBT nbt) but, things got more complicated.
  7. I've created a container that stores items for each player, it acts more like and EnderChest. And, to make this I use Capabilities, but when I was testing in a world, I see that the container share items with other worlds. For example, in the world "BananaBoys" I store 2 apples and 1 diamond axe, and when I enter in other world like "BananaGirls", in the container have 2 apples and 1 diamond axe. Someone know how to make the container unique for each world?
  8. With the AI entities, yes, but with the Stunned players?
  9. I'm trying to make an stun effect that don't let entity move. In the created Effect Class I write this lines with the "LivingEvent.LivingUpdateEvent", but when the entity have the Effect, it don't take damage, don't have gravity and other limitations. Is there some way to cancel only the move from it? @SubscribeEvent public static void dontMove(LivingEvent.LivingUpdateEvent event){ LivingEntity livingEntity = event.getEntityLiving(); if (livingEntity.hasEffect(stunningInstance)) { event.setCanceled(true); } }
  10. Actually, no. Is that a problem? If is I can add the lines here.
  11. I was creating my cusotm container and, when I tested, everytime that I "shift+click" or quick move an ItemStack, the game starts to loop. I've searched in all the container methods, and I realized what is causing this loop, but I don't know how to fix it. I'd like to know if someone is having trouble with this loop and if someone could help. I know I could rewrite the method to change, but I don't even know how to do that.
  12. I already fixed it. Don't know how but, when I remove the containerId from the constructor as an integer, this bug won't happen.
  13. I was creating a container, and, to do this, I looked the DispenserContainer to understand the methods. So I created the container and added the slots(of container and player inventory). But, when I open the container, the item in the container slots or in the player inventory slots duplicate, and one of them its in my cursor(the image explain better). I'd like to know if its a bug or an error in the code writing. Thanks.
  14. Hi! I've started to modding like 3 days ago. I need help in the "en_us" file, when I'll set the name of the item/block(whatever). I'm registering so many items, and I'd like to know if have a method or exist some way to write in the file by the code. I'm really sorry if what I said got confused, anyway, I don't speak english very well, so hope you'll understand.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.