Merge branch 'master' into 1.17

# Conflicts:
#	src/main/java/carpet/script/value/NBTSerializableValue.java
This commit is contained in:
gnembon committed 2020-11-26 03:03:03 -04:00
commit f4f289b0ec
14 files changed
+830 -188

No files matched your search

@@ -330,4 +330,49 @@ public class ValueConversions
}
throw new InternalExpressionException("Unknown property type: "+p.getName());
}
private static final Map<Integer, ListValue> slotIdsToSlotParams = new HashMap<Integer, ListValue>() {{
int n;
//covers blocks, player hotbar and inventory, and all default inventories
for(n = 0; n < 54; ++n) {
put(n, ListValue.of(Value.NULL, NumericValue.of(n)));
}
for(n = 0; n < 27; ++n) {
put(200+n, ListValue.of(StringValue.of("enderchest"), NumericValue.of(n)));
}
// villager
for(n = 0; n < 8; ++n) {
put(300+n, ListValue.of(Value.NULL, NumericValue.of(n)));
}
// horse, llamas, donkeys, etc.
// two first slots are for saddle and armour
for(n = 0; n < 15; ++n) {
put(500+n, ListValue.of(Value.NULL, NumericValue.of(n+2)));
}
Value equipment = StringValue.of("equipment");
// weapon main hand
put(98, ListValue.of(equipment, NumericValue.of(0)));
// offhand
put(99, ListValue.of(equipment, NumericValue.of(5)));
// feet, legs, chest, head
for(n = 0; n < 4; ++n) {
put(100+n, ListValue.of(equipment, NumericValue.of(n+1)));
}
//horse defaults saddle
put(400, ListValue.of(Value.NULL, NumericValue.of(0)));
// armor
put(401, ListValue.of(Value.NULL, NumericValue.of(1)));
// chest itself on the donkey is wierd - use NBT to alter that.
//hashMap.put("horse.chest", 499);
}};
public static Value ofVanillaSlotResult(int itemSlot)
{
Value ret = slotIdsToSlotParams.get(itemSlot);
if (ret == null) return ListValue.of(Value.NULL, NumericValue.of(itemSlot));
return ret;
}
}