3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01:00

Use axolotl tempt tag to determine axolotl food

Dieser Commit ist enthalten in:
Camotoy 2022-02-11 13:37:19 -05:00
Ursprung 0ca77233ed
Commit 44af9da01d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
2 geänderte Dateien mit 8 neuen und 1 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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