[1.17.x] Change expected type of LootTable fields to arrays (#8194)

#8184 reverted some LootTable patches, including the types of fields `f_79023_` and `f_79024_`. However, `ForgeLootTableProvider` still expects a list, however the type of the fields is an array now.
This PR changes the expected type in `ForgeLootTableProvider` to an array as well.
This commit is contained in:
SuperMartijn642 authored and GitHub committed 2021-11-21 10:26:31 -08:00
1 parent 55db597baa
commit 4a2572d545
1 file changed
+6 -6
@@ -98,8 +98,8 @@ public final class ForgeLootTableProvider extends LootTableProvider {
}
private boolean findAndReplaceInLootPool(LootPool lootPool, Item from, ToolAction toolAction) {
List<LootPoolEntryContainer> lootEntries = ObfuscationReflectionHelper.getPrivateValue(LootPool.class, lootPool, "f_7902" +"3_");
List<LootItemCondition> lootConditions = ObfuscationReflectionHelper.getPrivateValue(LootPool.class, lootPool, "f_7902" + "4_");
LootPoolEntryContainer[] lootEntries = ObfuscationReflectionHelper.getPrivateValue(LootPool.class, lootPool, "f_7902" +"3_");
LootItemCondition[] lootConditions = ObfuscationReflectionHelper.getPrivateValue(LootPool.class, lootPool, "f_7902" + "4_");
boolean found = false;
if (lootEntries == null) {
@@ -118,16 +118,16 @@ public final class ForgeLootTableProvider extends LootTableProvider {
throw new IllegalStateException(LootPool.class.getName() + " is missing field f_7902" + "4_");
}
for (int i = 0; i < lootConditions.size(); i++) {
LootItemCondition lootCondition = lootConditions.get(i);
for (int i = 0; i < lootConditions.length; i++) {
LootItemCondition lootCondition = lootConditions[i];
if (lootCondition instanceof MatchTool && checkMatchTool((MatchTool) lootCondition, from)) {
lootConditions.set(i, CanToolPerformAction.canToolPerformAction(toolAction).build());
lootConditions[i] = CanToolPerformAction.canToolPerformAction(toolAction).build();
found = true;
} else if (lootCondition instanceof InvertedLootItemCondition) {
LootItemCondition invLootCondition = ObfuscationReflectionHelper.getPrivateValue(InvertedLootItemCondition.class, (InvertedLootItemCondition) lootCondition, "f_8168" + "1_");
if (invLootCondition instanceof MatchTool && checkMatchTool((MatchTool) invLootCondition, from)) {
lootConditions.set(i, InvertedLootItemCondition.invert(CanToolPerformAction.canToolPerformAction(toolAction)).build());
lootConditions[i] = InvertedLootItemCondition.invert(CanToolPerformAction.canToolPerformAction(toolAction)).build();
found = true;
} else if (invLootCondition instanceof AlternativeLootItemCondition && findAndReplaceInAlternative((AlternativeLootItemCondition) invLootCondition, from, toolAction)) {
found = true;