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

MonkeyKnight

Members
  • Content Count

    17
  • Joined

  • Last visited

Community Reputation

1 Neutral

About MonkeyKnight

  • Rank
    Tree Puncher

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Sure, here are my two classes that I used. The render event: @EventBusSubscriber(modid = Epidemics.MOD_ID, bus = Bus.FORGE) public class GuiRenderEvents { @SubscribeEvent public static void renderGameOverlay(RenderGameOverlayEvent.Post event) { if (event.getType() == RenderGameOverlayEvent.ElementType.ALL) { System.out.println(1); RenderTest render = new RenderTest(Minecraft.getInstance()); render.renderTestPumpkin(Minecraft.getInstance()); } } } The renderer: public class RenderTest extends IngameGui{ public static fin
  2. I have another update! I changed my render event code to this: @EventBusSubscriber(modid = Epidemics.MOD_ID, bus = Bus.FORGE) public class GuiRenderEvents { @SubscribeEvent public static void renderGameOverlay(RenderGameOverlayEvent.Post event) { if (event.getType() == RenderGameOverlayEvent.ElementType.HOTBAR) { System.out.println(1); RenderTest render = new RenderTest(Minecraft.getInstance()); render.renderTestPumpkin(Minecraft.getInstance()); } } } public class RenderTest extends IngameGui{ private int screenWidth; private int
  3. I have a quick update. I have narrowed down the issue to the renderGameOverlay.post event. I changed the code of the renderTest constructor to just trigger the vanilla renderPumpkin() method and there still was no pumpkin face shown. public RenderTest(Minecraft minecraft) { super(minecraft); renderPumpkin(); /* screenWidth = minecraft.getWindow().getGuiScaledWidth(); screenHeight = minecraft.getWindow().getGuiScaledHeight(); renderTest(minecraft); */ } Do you have any suggestions on what I should change in my render event?
  4. The only further suggestion I would have is to check Minecraft's code for the fire aspect enchantment. You may find what you are looking for there.
  5. I know this might be stupid but for deferedRegisters, that error normally goes away when you put .get() at the end. Something like this: if (event.getSource().equals(ItemInit.EMBERCLEAVE.get())) I have only coded blocks and potions in 1.16 so I am a little rusty on items but this might work.
  6. I have coded a little test to experiment with rendering fullscreen overlays for my mod in Minecraft. As it is my first time delving into this kind of rendering, I started off simple, basically copying the renderPumpkin() method but I am having issues. My goal is to render textures that will show up on a player's screen in certain situations. For this test, I just went with the standard pumpkinblur. I used a RenderGameOverlayEvent.Post to trigger the rendering of the pumpkin. Here is my event code: @EventBusSubscriber(modid = Epidemics.MOD_ID, bus = Bus.FORGE) public class GuiRenderEvents {
  7. I have solved the issue as I called the wrong method in the ReadNBT class. Here is my final updated code. @Override public INBT writeNBT(Capability<IDiseases> capability, IDiseases instance, Direction side) { CompoundNBT tag = new CompoundNBT(); tag.putInt("diseases", instance.getDiseases()); tag.putInt("diseasesTime", instance.getDiseasesTime()); return tag; } @Override public void readNBT(Capability<IDiseases> capability, IDiseases instance, Direction side, INBT nbt) { CompoundNBT tag = (CompoundNBT) nbt; instance.setDiseases(tag.getInt("diseases")); insta
  8. I have done some further testing and have noticed something quite strange. I have changed my readNBT method to read from the INBT. @Override public INBT writeNBT(Capability<IDiseases> capability, IDiseases instance, Direction side) { CompoundNBT tag = new CompoundNBT(); tag.putInt("diseases", instance.getDiseases()); tag.putInt("diseasesTime", instance.getDiseasesTime()); return tag; } @Override public void readNBT(Capability<IDiseases> capability, IDiseases instance, Direction side, INBT nbt) { CompoundNBT tag = (CompoundNBT) nbt; instance.setDiseases(tag.get
  9. I am not too familiar with the eclipse debugger, (The last time I modded was on 1.7.10 using Intellij). I know that my getCapability() method is working, but after adding print statements to the serializeNBT and deserializeNBT, I did not see any printouts so I do not believe they have been invoked. @Override public INBT serializeNBT() { System.out.println("serialize diseases"); return DISEASES_CAPABILITY.getStorage().writeNBT(DISEASES_CAPABILITY, this.instance.orElseThrow(() -> new IllegalArgumentException("LazyOptional must not be empty!")), null); } @Override public void de
  10. I have used this class in other classes without any issues and have not found anything else wrong with the class. Am I supposed to call serializeNBT and deserializeNBT from somewhere else when the player is leaving?
  11. I have already added a ICapabilitySerializable. It still does not save any data. I am not getting any errors in my Capability as it works as intended each time, except that it resets after leaving and reentering the world. Is there something wrong with my class? public class DiseasesProvider implements ICapabilitySerializable<INBT> { @CapabilityInject(IDiseases.class) public static final Capability<IDiseases> DISEASES_CAPABILITY = null; private LazyOptional<IDiseases> instance = LazyOptional.of(DISEASES_CAPABILITY::getDefaultInstance); @Override public <T>
  12. For saving the Capability, I have looked at the documentation and some forum posts as well but still cannot figure out what classes to use. I want my capability to reset upon player death so I never used the playerClone event. All I am trying to do is to save and load my capability when changing dimensions and leaving and rejoining a world. Other than that though, my Capability works like a charm!
  13. Thanks, now it works perfectly. To anyone else who may have the same problem as me in the future, I changed the event to this: @EventBusSubscriber(modid = Epidemics.MOD_ID, bus = Bus.FORGE) public class DiseaseStartEvents { @SubscribeEvent public static void onPlayerTick(PlayerTickEvent event) { if(event.side == LogicalSide.SERVER && event.phase == Phase.START) { Random rand = new Random(); int i = rand.nextInt(800); System.out.println(DiseaseStats.getSickness(event.player)); if(i == 2 && DiseaseStats.getSickness(event.player) == 0) { ITextCompon
  14. I have successfully created a capability value which stores if a player has a disease. While to code runs with no errors, I have run into difficulties with storing the value and using it in my code. I have created an event which triggered on each tick. After a random number of ticks, if the diseases value in my capability is zero, it changes it to one and the player becomes sick. I outputted the value of diseases on every tick to help me debug. Looking at my print statements, after becoming sick it outputs mostly ones, but continues outputting zeros sometimes. Additionally, when the game is ex
×
×
  • Create New...

Important Information

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