Jump to content

Tieso2001

Members
  • Posts

    73
  • Joined

  • Last visited

Everything posted by Tieso2001

  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?
  12. Thanks for the information. I was hoping that it would be easier than that. Hope forge will add an easy way to do this because adding seeds to grass in 1.12.2 was really easy, using just one line of code.
  13. I'm making a machine which has a result slot (same idea as the output slot of the furnace). You only take items out of the slot and not put them in. The problem is that in 1.12.2 you could use setStackInSlot on the ItemHandler to put the resulting item of a recipe into the slot (like when an item in a furnace smelts and the result appears in the output slot). In 1.14.4 I can't use setStackInSlot anymore (it won't let me), so how do I do this in 1.14.4? I'm using isItemValid so that you can't put any items in, which is also what I used in 1.12.2 (and what the furnace uses)
  14. So I tried to make it so that my newly added seeds drop when breaking grass, just like wheat seeds. I couldn't get it working so I tried to do what @Draco18s mentioned in an earlier thread. Here's what I did And here's the json file I created: This is all similar to what Draco18s did in his mod: https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderfarming/EventHandlers.java https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/resources/data/harderfarming/loot_tables/blocks/grass.json The problem is that this adds a new pool to the already existing loot table for minecraft:grass. This makes it so that when you shear grass, the seeds from my mod can still drop. To fix this I don't want to add a new pool to the table, but modify the already existing table (the one which tells it to drop grass when using shears, and when not using shears have a chance to drop wheat seeds). If I can add an entry to this table then grass will: A: drop itself when using shears, B: sometimes drop wheat seeds, or C : sometimes drop my seeds. I tried to add an entry to the pool but because addEntry can not be directly used (it is commented out in LootPool.class, I have no idea why) I did the following: This also didn't work because now the original LootPool is not working and only the entry that I added. Grass can now only drop my seeds, even when using shears. Wheat seeds or grass itself don't drop anymore. I also tried this: The result of this was the same as the thing I tried earlier: only my seeds drop. Wheat seeds and grass itself don't drop anymore. If someone could help me with this that would be greatly appreciated.
  15. Changed it in the json to ingredient. Also I have a question: public static final IRecipeType<SteepingRecipe> steeping = IRecipeType.register("steeping"); If I register the type like this, what does the type in the json have to be. "minecraft:steeping", "boneappletea:steeping", or just "steeping"?
  16. Got everything working except for the following: I created a recipe json named "test_steeping.json". I put the recipe json in "resources.data.boneappletea.recipes". In the TileEntity: RecipeManager#getRecipe only gives null and the recipe I created. I pushed everything to github again so you can take a look again: https://github.com/Tieso2001/BoneAppleTea/tree/1.14.4-dev Any idea what is wrong?
  17. That doesn't work because recipeWrapper gives an error saying that it is the wrong type. Edit: Apparantly there was something wrong with the recipeType which gave an error for both arguments
  18. Okay, did that, that worked. I can acces RecipeWrapper from my TileEntity, but what should I use as the second argument of RecipeManager#getRecipe.
  19. But how do pass the inventory to it recipeWrapper = new RecipeWrapper(); It needs IItemHandlerModifiable but inventory from my TileEntity is IItemHandler
×
×
  • Create New...

Important Information

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