Use axolotl tempt tag to determine axolotl food

This commit is contained in:
Camotoy 2022-02-11 13:37:19 -05:00
parent 0ca77233ed
commit 44af9da01d
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
2 changed files with 8 additions and 1 deletions

View file

@ -56,7 +56,7 @@ public class AxolotlEntity extends AnimalEntity {
@Override
public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) {
return javaIdentifierStripped.equals("tropical_fish_bucket");
return session.getTagCache().isAxolotlTemptItem(mapping);
}
@Override

View file

@ -53,6 +53,7 @@ public class TagCache {
private IntList requiresDiamondTool;
/* Items */
private IntList axolotlTemptItems;
private IntList flowers;
private IntList foxFood;
private IntList piglinLoved;
@ -77,6 +78,7 @@ public class TagCache {
this.requiresDiamondTool = IntList.of(blockTags.get("minecraft:needs_diamond_tool"));
Map<String, int[]> itemTags = packet.getTags().get("minecraft:item");
this.axolotlTemptItems = IntList.of(itemTags.get("minecraft:axolotl_tempt_items"));
this.flowers = IntList.of(itemTags.get("minecraft:flowers"));
this.foxFood = IntList.of(itemTags.get("minecraft:fox_food"));
this.piglinLoved = IntList.of(itemTags.get("minecraft:piglin_loved"));
@ -102,11 +104,16 @@ public class TagCache {
this.requiresIronTool = IntLists.emptyList();
this.requiresDiamondTool = IntLists.emptyList();
this.axolotlTemptItems = IntLists.emptyList();
this.flowers = IntLists.emptyList();
this.foxFood = IntLists.emptyList();
this.piglinLoved = IntLists.emptyList();
}
public boolean isAxolotlTemptItem(ItemMapping itemMapping) {
return axolotlTemptItems.contains(itemMapping.getJavaId());
}
public boolean isFlower(ItemMapping mapping) {
return flowers.contains(mapping.getJavaId());
}