Skip to content

Commit

Permalink
Update to 24w12a
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Mar 20, 2024
1 parent b756d42 commit 2039e96
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
22 changes: 10 additions & 12 deletions src/main/java/net/wurstclient/hacks/AutoEatHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,22 @@
import java.util.Comparator;
import java.util.stream.Stream;

import com.mojang.datafixers.util.Pair;

import net.minecraft.block.Block;
import net.minecraft.block.BlockWithEntity;
import net.minecraft.block.CraftingTableBlock;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.entity.Entity;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.passive.TameableEntity;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.entity.player.HungerManager;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.FoodComponent;
import net.minecraft.item.FoodComponent.StatusEffectEntry;
import net.minecraft.item.FoodComponents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.EntityHitResult;
Expand Down Expand Up @@ -217,21 +216,21 @@ private int findBestFoodSlot(int maxPoints)
.forEach(i -> slots.add(i));

Comparator<FoodComponent> comparator =
Comparator.comparingDouble(FoodComponent::getSaturationModifier);
Comparator.comparingDouble(FoodComponent::saturationModifier);

for(int slot : slots)
{
Item item = inventory.getStack(slot).getItem();
ItemStack stack = inventory.getStack(slot);

// filter out non-food items
if(!item.isFood())
if(!stack.contains(DataComponentTypes.FOOD))
continue;

FoodComponent food = item.getFoodComponent();
FoodComponent food = stack.get(DataComponentTypes.FOOD);
if(!isAllowedFood(food))
continue;

if(maxPoints >= 0 && food.getHunger() > maxPoints)
if(maxPoints >= 0 && food.hunger() > maxPoints)
continue;

// compare to previously found food
Expand Down Expand Up @@ -275,10 +274,9 @@ private boolean isAllowedFood(FoodComponent food)
if(!allowChorus.isChecked() && food == FoodComponents.CHORUS_FRUIT)
return false;

for(Pair<StatusEffectInstance, Float> pair : food.getStatusEffects())
for(StatusEffectEntry entry : food.statusEffects())
{
RegistryEntry<StatusEffect> effect =
pair.getFirst().getEffectType();
RegistryEntry<StatusEffect> effect = entry.effect().getEffectType();

if(!allowHunger.isChecked() && effect == StatusEffects.HUNGER)
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/wurstclient/hacks/AutoToolHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private float getMiningSpeed(ItemStack stack, BlockState state)

private boolean isDamageable(ItemStack stack)
{
return !stack.isEmpty() && stack.getItem().isDamageable();
return !stack.isEmpty() && stack.isDamageable();
}

private boolean isTooDamaged(ItemStack stack, int repairMode)
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

"depends": {
"fabricloader": ">=0.15.7",
"fabric-api": ">=0.96.9",
"minecraft": "~1.20.5-alpha.24.11.a",
"fabric-api": ">=0.96.12",
"minecraft": "~1.20.5-alpha.24.12.a",
"java": ">=17"
},
"suggests": {
Expand Down

0 comments on commit 2039e96

Please sign in to comment.