Jump to content

Tieso2001

Members
  • Posts

    73
  • Joined

  • Last visited

Recent Profile Visitors

1883 profile views

Tieso2001's Achievements

Stone Miner

Stone Miner (3/8)

3

Reputation

  1. I set use LivingEntity#setSprinting in PlayerTickEvent to false to disable sprinting for players. This works in that sprinting is not possible anymore, but there is one problem. If I hold ctrl+space+w to jump sprint forward, it is way faster than holding space+w without ctrl. The sprinting is only disabled for walking. I want to fix this because when the player has a foodLevel of less than 6, the sprinting is also disabled but here holding ctrl+space+w is much slower than when I manually disable it. Any idea how to fix this?
  2. I didn't know that was a thing so thank you, that looks like it is exactly what I need. I tried to use it but I can't get it to work. Here is my accesstransformer.cfg # Makes the fields from the FoodStats class public public net.minecraft.util.FoodStats foodLevel public net.minecraft.util.FoodStats foodSaturationLevel public net.minecraft.util.FoodStats foodExhaustionLevel public net.minecraft.util.FoodStats foodTimer public net.minecraft.util.FoodStats prevFoodLevel And here the line I put into my build.gradle (in the minecraft section, under the line with the mappings) accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') It says that then I should refresh and it should work, but I refreshed and the fields still don't show up. Do you know how I should fix this?
  3. Thank you, I got it working that my custom FoodStats is set. I have one more problem: I created a class named CustomFoodStats that extends FoodStats. When I try to override/copy the tick() method I get lots of errors because all the fields of FoodStats are not accessible. Should I also use reflection to get and set these fields or should I do something else (because that would require a lot of reflection every tick, which I believe is not something I should be doing)? public class CustomFoodStats extends FoodStats { private boolean foodHealthRegen = true; public CustomFoodStats() { super(); } @Override public void tick(PlayerEntity player) { /* this part would be copied from the original FoodStats (don't know if I could post that here) */ boolean flag = player.world.getGameRules().getBoolean(GameRules.NATURAL_REGENERATION) && this.foodHealthRegen; /* this part would be copied from the original FoodStats (don't know if I could post that here) */ } } Also I have an additional question. Because I want to override the tick() method but I only change boolean flag, would that not be allowed because in essence I would then almost be entirely copying a method from the minecraft code.
  4. When do I set it? Is there a PlayerEntity/Entity creation event or something similar that I should use? I only found EntityJoinWorldEvent but then it would create a new FoodStats object everytime the entity joins. How can I check if the entity hasn't been created before? Or should I use something completely different?
  5. Okay, I know how to make my own custom FoodStats using capabilities, but how can I disable/replace the original then?
  6. I'm wondering if it's possible to cancel the healing and NOT to check whether the player heals and then apply damage to them.
  7. I want to disable healing (from food, not from potions). I know you can do this by disabling the gamerule "naturalRegeneration" but if I'm correct, this will disable the healing for all players. Is there a way to disable the natural healing per player?
  8. I have created a custom status bar that is located right above the food bar. The problem is that when you go underwater it overlaps with the oxygenbar. I know that I can move my status bar up when underwater but I want to move the oxygen so that it is located above my custom bar. Is this possible? And if so, how do I do this. I used the RenderGameOverlayEvent.Post event to render my custom bar.
  9. I have created this and it seems to work how I want it to. I can't drag of shift click item into the output slot, hoppers only insert in the input slot and when a crafting operation is completed, the result gets inserted into the output slot. I have a question about this: If I have to guess the reason that this works is that hoppers can only insert from the top or sides, and not from the bottom. That would mean that a machine that can insert items from the bottom of my block will insert the items into the output slot. Am I right about this? If that is indeed the case then I will try to do the two version method you described. If the only way you can insert items into the output slot is by some obscure way that can only be done intentionally, then I think it is fine how it is right now. Anyway here is the code:
  10. Why do I need two versions? Can't I just create an outputslot as an IItemHandler, cast it as an IItemHandlerModifiable when I have to insert a stack internally, and then expose the non-casted version?
  11. If I understand correctly, in your case the non-modifiable version is the outputSlotWrapper, right?
×
×
  • Create New...

Important Information

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