Make definition of ci and projects dynamic (#33)
* Make definition of ci and projects dynamic * Try defining matrix properly * Working impl * Fix target task * Fix path
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
||||
package dev.u9g.minecraftdatagenerator.generators;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import dev.u9g.minecraftdatagenerator.mixin.LanguageAccessor;
|
||||
import net.minecraft.util.Language;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class AttributesDataGenerator implements IDataGenerator {
|
||||
@Override
|
||||
public String getDataName() {
|
||||
return "attributes";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement generateDataJson() {
|
||||
Language lang = new Language();
|
||||
Map<String, String> translations = ((LanguageAccessor) lang).translations();
|
||||
JsonArray arr = new JsonArray();
|
||||
for (Map.Entry<String, String> translation : translations.entrySet()) {
|
||||
String key = translation.getKey();
|
||||
if (!key.startsWith("attribute.name.")) continue;
|
||||
JsonObject obj = new JsonObject();
|
||||
key = key.replace("attribute.name.", "");
|
||||
obj.addProperty("name", key.split("\\.")[1]);
|
||||
obj.addProperty("resource", key);
|
||||
arr.add(obj);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
package dev.u9g.minecraftdatagenerator.generators;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import dev.u9g.minecraftdatagenerator.mixin.BiomeAccessor;
|
||||
import dev.u9g.minecraftdatagenerator.util.Registries;
|
||||
import net.minecraft.world.biome.*;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class BiomesDataGenerator implements IDataGenerator {
|
||||
|
||||
private static String guessBiomeDimensionFromCategory(Biome biome) {
|
||||
if (biome instanceof NetherBiome) {
|
||||
return "nether";
|
||||
} else if (biome instanceof EndBiome) {
|
||||
return "end";
|
||||
}
|
||||
return "overworld";
|
||||
}
|
||||
|
||||
public static JsonObject generateBiomeInfo(Biome biome) {
|
||||
JsonObject biomeDesc = new JsonObject();
|
||||
// Identifier registryKey = registry.getIdentifier(biome);
|
||||
|
||||
biomeDesc.addProperty("id", Registries.BIOMES.getRawId(biome));
|
||||
biomeDesc.addProperty("name", String.join("_", ((BiomeAccessor) biome).name().toLowerCase(Locale.ENGLISH).split(" ")));
|
||||
biomeDesc.addProperty("category", category(biome));
|
||||
biomeDesc.addProperty("temperature", biome.temperature);
|
||||
biomeDesc.addProperty("precipitation", precipitation(biome));
|
||||
biomeDesc.addProperty("depth", biome.depth);
|
||||
biomeDesc.addProperty("dimension", guessBiomeDimensionFromCategory(biome));
|
||||
biomeDesc.addProperty("displayName", ((BiomeAccessor) biome).name());
|
||||
biomeDesc.addProperty("color", biome.getSkyColor(biome.temperature));
|
||||
biomeDesc.addProperty("rainfall", biome.downfall);
|
||||
|
||||
return biomeDesc;
|
||||
}
|
||||
|
||||
private static String category(Biome biome) {
|
||||
if (biome instanceof ForestBiome) {
|
||||
return "forest";
|
||||
} else if (biome instanceof OceanBiome) {
|
||||
return "ocean";
|
||||
} else if (biome instanceof PlainsBiome) {
|
||||
return "plains";
|
||||
} else if (biome instanceof DesertBiome) {
|
||||
return "desert";
|
||||
} else if (biome instanceof ExtremeHillsBiome) {
|
||||
return "extreme_hills";
|
||||
} else if (biome instanceof TaigaBiome) {
|
||||
return "taiga";
|
||||
} else if (biome instanceof SwampBiome) {
|
||||
return "swamp";
|
||||
} else if (biome instanceof RiverBiome) {
|
||||
return "river";
|
||||
} else if (biome instanceof NetherBiome) {
|
||||
return "nether";
|
||||
} else if (biome instanceof EndBiome) {
|
||||
return "the_end";
|
||||
} else if (biome instanceof IceBiome) {
|
||||
return "icy";
|
||||
} else if (biome instanceof MushroomBiome) {
|
||||
return "mushroom";
|
||||
} else if (biome instanceof BeachBiome) {
|
||||
return "beach";
|
||||
} else if (biome instanceof JungleBiome) {
|
||||
return "jungle";
|
||||
} else if (biome instanceof SavannaBiome) {
|
||||
return "savanna";
|
||||
} else if (biome instanceof MesaBiome) {
|
||||
return "mesa";
|
||||
} else if (biome instanceof StoneBeachBiome) {
|
||||
return "none"; // Should StoneBeachBiome be beach too? this is how it is now in mcdata
|
||||
}
|
||||
throw new IllegalStateException("Unable to find biome category for " + biome.getClass().getName());
|
||||
}
|
||||
|
||||
private static String precipitation(Biome biome) {
|
||||
float rainfall = biome.downfall;
|
||||
float temperature = biome.temperature;
|
||||
if (rainfall == 0) {
|
||||
return "none";
|
||||
} else if (temperature < 0.2f) {
|
||||
return "snow";
|
||||
}
|
||||
return "rain";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataName() {
|
||||
return "biomes";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonArray generateDataJson() {
|
||||
JsonArray biomesArray = new JsonArray();
|
||||
|
||||
for (Biome biome : Registries.BIOMES) {
|
||||
biomesArray.add(generateBiomeInfo(biome));
|
||||
}
|
||||
return biomesArray;
|
||||
}
|
||||
}
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
package dev.u9g.minecraftdatagenerator.generators;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import dev.u9g.minecraftdatagenerator.util.DGU;
|
||||
import dev.u9g.minecraftdatagenerator.util.Registries;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class BlockCollisionShapesDataGenerator implements IDataGenerator {
|
||||
private static final Box ENTITY_BOX = new Box(0.0D, 0.0D, 0.0D, 1.0D, 2.0D, 1.0D);
|
||||
|
||||
private static String nameOf(Block block) {
|
||||
return Objects.requireNonNull(Registries.BLOCKS.getIdentifier(block)).getPath();
|
||||
}
|
||||
|
||||
private static JsonArray jsonOf(Box box) {
|
||||
JsonArray arr = new JsonArray();
|
||||
if (box == null) return arr;
|
||||
arr.add(new JsonPrimitive(box.minX));
|
||||
arr.add(new JsonPrimitive(box.minY));
|
||||
arr.add(new JsonPrimitive(box.minZ));
|
||||
arr.add(new JsonPrimitive(box.maxX));
|
||||
arr.add(new JsonPrimitive(box.maxY));
|
||||
arr.add(new JsonPrimitive(box.maxZ));
|
||||
return arr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataName() {
|
||||
return "blockCollisionShapes";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonObject generateDataJson() {
|
||||
ShapeCache shapeCache = new ShapeCache();
|
||||
JsonObject blocksObject = new JsonObject();
|
||||
for (Block block : Registries.BLOCKS) {
|
||||
Object val = shapeCache.addShapesFrom(block);
|
||||
if (val instanceof JsonArray) {
|
||||
blocksObject.add(nameOf(block), (JsonElement) val);
|
||||
} else {
|
||||
blocksObject.addProperty(nameOf(block), (Integer) val);
|
||||
}
|
||||
}
|
||||
JsonObject resultObject = new JsonObject();
|
||||
resultObject.add("blocks", blocksObject);
|
||||
resultObject.add("shapes", shapeCache.toJSON());
|
||||
return resultObject;
|
||||
}
|
||||
|
||||
public static class ShapeCache {
|
||||
private final ArrayList<Shapes> shapesCache = new ArrayList<>();
|
||||
|
||||
public Object addShapesFrom(Block block) {
|
||||
List<Integer> indexesOfBoxesInTheShapesCache = new ArrayList<>();
|
||||
for (BlockState state : block.getStateManager().getBlockStates().reverse()) {
|
||||
List<Box> boxes = new ArrayList<>();
|
||||
try {
|
||||
// Fix needed for StairsBlock because it requires the state of the block to be set
|
||||
DGU.getWorld().setBlockState(BlockPos.ORIGIN, state);
|
||||
block.appendCollisionBoxes(DGU.getWorld(), BlockPos.ORIGIN, state, ENTITY_BOX, boxes, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Shapes thisBlockStateShapes = new Shapes(boxes);
|
||||
int indexOfThisBlockStatesShapes = shapesCache.indexOf(thisBlockStateShapes);
|
||||
if (indexOfThisBlockStatesShapes != -1) {
|
||||
indexesOfBoxesInTheShapesCache.add(indexOfThisBlockStatesShapes);
|
||||
} else {
|
||||
shapesCache.add(thisBlockStateShapes);
|
||||
indexesOfBoxesInTheShapesCache.add(shapesCache.size() - 1);
|
||||
}
|
||||
}
|
||||
if (indexesOfBoxesInTheShapesCache.stream().distinct().count() < 2) {
|
||||
return indexesOfBoxesInTheShapesCache.getFirst();
|
||||
} else {
|
||||
JsonArray shapeIndexes = new JsonArray();
|
||||
indexesOfBoxesInTheShapesCache.forEach(shapeIndex -> shapeIndexes.add(new JsonPrimitive(shapeIndex)));
|
||||
return shapeIndexes;
|
||||
}
|
||||
}
|
||||
|
||||
public JsonObject toJSON() {
|
||||
JsonObject shapes = new JsonObject();
|
||||
int i = 0;
|
||||
for (Shapes s : shapesCache) {
|
||||
shapes.add(String.valueOf(i++), s.toJSON());
|
||||
}
|
||||
return shapes;
|
||||
}
|
||||
|
||||
private record Shapes(List<Box> boxes) {
|
||||
|
||||
public JsonArray toJSON() {
|
||||
JsonArray arr = new JsonArray();
|
||||
boxes.forEach(box -> arr.add(jsonOf(box)));
|
||||
return arr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Shapes shapes = (Shapes) o;
|
||||
return Objects.equals(boxes, shapes.boxes);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
package dev.u9g.minecraftdatagenerator.generators;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import dev.u9g.minecraftdatagenerator.mixin.BlockAccessor;
|
||||
import dev.u9g.minecraftdatagenerator.mixin.MiningToolItemAccessor;
|
||||
import dev.u9g.minecraftdatagenerator.util.DGU;
|
||||
import dev.u9g.minecraftdatagenerator.util.Registries;
|
||||
import net.minecraft.block.AirBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.TransparentBlock;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ToolItem;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.state.property.IntProperty;
|
||||
import net.minecraft.state.property.Property;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class BlocksDataGenerator implements IDataGenerator {
|
||||
private static List<Item> getItemsEffectiveForBlock(Block block) {
|
||||
List<Item> items = new ArrayList<>();
|
||||
for (Item item : Registries.ITEMS) {
|
||||
if (item instanceof ToolItem && ((MiningToolItemAccessor) item).getEffectiveBlocks().contains(block)) {
|
||||
items.add(item);
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
private static List<ItemStack> populateDropsIfPossible(BlockState blockState, Item firstToolItem) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
private static String getPropertyTypeName(Property<?> property) {
|
||||
//Explicitly handle default minecraft properties
|
||||
if (property instanceof BooleanProperty) {
|
||||
return "bool";
|
||||
}
|
||||
if (property instanceof IntProperty) {
|
||||
return "int";
|
||||
}
|
||||
if (property instanceof EnumProperty) {
|
||||
return "enum";
|
||||
}
|
||||
|
||||
//Use simple class name as fallback, this code will give something like
|
||||
//example_type for ExampleTypeProperty class name
|
||||
String rawPropertyName = property.getClass().getSimpleName().replace("Property", "");
|
||||
return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, rawPropertyName);
|
||||
}
|
||||
|
||||
private static <T extends Comparable<T>> JsonObject generateStateProperty(Property<T> property) {
|
||||
JsonObject propertyObject = new JsonObject();
|
||||
Collection<T> propertyValues = property.getValues();
|
||||
|
||||
propertyObject.addProperty("name", property.getName());
|
||||
propertyObject.addProperty("type", getPropertyTypeName(property));
|
||||
propertyObject.addProperty("num_values", propertyValues.size());
|
||||
|
||||
//Do not add values for vanilla boolean properties, they are known by default
|
||||
if (!(property instanceof BooleanProperty)) {
|
||||
JsonArray propertyValuesArray = new JsonArray();
|
||||
for (T propertyValue : propertyValues) {
|
||||
propertyValuesArray.add(new JsonPrimitive(property.name(propertyValue)));
|
||||
}
|
||||
propertyObject.add("values", propertyValuesArray);
|
||||
}
|
||||
return propertyObject;
|
||||
}
|
||||
|
||||
public static JsonObject generateBlock(Block block) {
|
||||
JsonObject blockDesc = new JsonObject();
|
||||
|
||||
List<BlockState> blockStates = block.getStateManager().getBlockStates();
|
||||
BlockState defaultState = block.getDefaultState();
|
||||
Identifier registryKey = Registries.BLOCKS.getIdentifier(block);
|
||||
List<Item> effectiveTools = getItemsEffectiveForBlock(block);
|
||||
|
||||
blockDesc.addProperty("id", Registries.BLOCKS.getRawId(block));
|
||||
blockDesc.addProperty("name", Objects.requireNonNull(registryKey).getPath());
|
||||
if (!block.getTranslatedName().startsWith("tile.")) {
|
||||
blockDesc.addProperty("displayName", block.getTranslatedName());
|
||||
}
|
||||
|
||||
float hardness = block.getStrength(null, null);
|
||||
|
||||
blockDesc.addProperty("hardness", hardness);
|
||||
blockDesc.addProperty("resistance", ((BlockAccessor) block).getBlastResistance());
|
||||
blockDesc.addProperty("diggable", hardness != -1.0f && !(block instanceof AirBlock));
|
||||
JsonObject effTools = new JsonObject();
|
||||
effectiveTools.forEach(item -> effTools.addProperty(
|
||||
String.valueOf(Registries.ITEMS.getRawId(item)), // key
|
||||
item.getMiningSpeedMultiplier(DGU.stackFor(item), block) // value
|
||||
));
|
||||
blockDesc.add("effectiveTools", effTools);
|
||||
blockDesc.addProperty("transparent", block instanceof TransparentBlock);
|
||||
blockDesc.addProperty("emitLight", block.getLightLevel());
|
||||
blockDesc.addProperty("filterLight", block.getOpacity());
|
||||
|
||||
JsonArray stateProperties = new JsonArray();
|
||||
for (Property<?> property : block.getStateManager().getProperties()) {
|
||||
stateProperties.add(generateStateProperty(property));
|
||||
}
|
||||
blockDesc.add("states", stateProperties);
|
||||
blockDesc.add("drops", new JsonArray());
|
||||
blockDesc.addProperty("boundingBox", boundingBox(block, defaultState));
|
||||
|
||||
return blockDesc;
|
||||
}
|
||||
|
||||
private static String boundingBox(Block block, BlockState state) {
|
||||
// Fix needed for StairsBlock because it requires the state of the block to be set
|
||||
DGU.getWorld().setBlockState(BlockPos.ORIGIN, state);
|
||||
if (block.getCollisionBox(DGU.getWorld(), BlockPos.ORIGIN, state) == null) {
|
||||
return "empty";
|
||||
}
|
||||
return "block";
|
||||
}
|
||||
|
||||
private static Item getItemFromBlock(Block block) {
|
||||
return Registries.ITEMS.get(Registries.BLOCKS.getIdentifier(block));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataName() {
|
||||
return "blocks";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonArray generateDataJson() {
|
||||
JsonArray resultBlocksArray = new JsonArray();
|
||||
for (Block block : Registries.BLOCKS) {
|
||||
resultBlocksArray.add(generateBlock(block));
|
||||
}
|
||||
return resultBlocksArray;
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package dev.u9g.minecraftdatagenerator.generators;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import dev.u9g.minecraftdatagenerator.mixin.StatusEffectAccessor;
|
||||
import dev.u9g.minecraftdatagenerator.util.DGU;
|
||||
import dev.u9g.minecraftdatagenerator.util.Registries;
|
||||
import net.minecraft.entity.effect.StatusEffect;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class EffectsDataGenerator implements IDataGenerator {
|
||||
public static JsonObject generateEffect(StatusEffect statusEffect) {
|
||||
JsonObject effectDesc = new JsonObject();
|
||||
@NotNull Identifier registryKey = Objects.requireNonNull(Registries.STATUS_EFFECTS.getIdentifier(statusEffect));
|
||||
|
||||
effectDesc.addProperty("id", Registries.STATUS_EFFECTS.getRawId(statusEffect));
|
||||
effectDesc.addProperty("name", Arrays.stream(registryKey.getPath().split("_")).map(StringUtils::capitalize).collect(Collectors.joining()));
|
||||
effectDesc.addProperty("displayName", DGU.translateText(statusEffect.getTranslationKey()));
|
||||
|
||||
effectDesc.addProperty("type", !((StatusEffectAccessor) statusEffect).negative() ? "good" : "bad");
|
||||
return effectDesc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataName() {
|
||||
return "effects";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonArray generateDataJson() {
|
||||
JsonArray resultsArray = new JsonArray();
|
||||
for (StatusEffect effect : Registries.STATUS_EFFECTS) {
|
||||
resultsArray.add(generateEffect(effect));
|
||||
}
|
||||
return resultsArray;
|
||||
}
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
package dev.u9g.minecraftdatagenerator.generators;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import dev.u9g.minecraftdatagenerator.util.DGU;
|
||||
import dev.u9g.minecraftdatagenerator.util.Registries;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentTarget;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
public class EnchantmentsDataGenerator implements IDataGenerator {
|
||||
|
||||
private static final ImmutableMap<EnchantmentTarget, String> ENCHANTMENT_TARGET_NAMES = ImmutableMap.<EnchantmentTarget, String>builder()
|
||||
.put(EnchantmentTarget.ALL_ARMOR, "armor")
|
||||
.put(EnchantmentTarget.FEET, "armor_feet")
|
||||
.put(EnchantmentTarget.LEGS, "armor_legs")
|
||||
.put(EnchantmentTarget.TORSO, "armor_chest")
|
||||
.put(EnchantmentTarget.HEAD, "armor_head")
|
||||
.put(EnchantmentTarget.WEAPON, "weapon")
|
||||
.put(EnchantmentTarget.DIGGER, "digger")
|
||||
.put(EnchantmentTarget.FISHING_ROD, "fishing_rod")
|
||||
.put(EnchantmentTarget.BREAKABLE, "breakable")
|
||||
.put(EnchantmentTarget.BOW, "bow")
|
||||
.build();
|
||||
|
||||
public static String getEnchantmentTargetName(EnchantmentTarget target) {
|
||||
return ENCHANTMENT_TARGET_NAMES.getOrDefault(target, target.name().toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
// Equation enchantment costs follow is a * level + b, so we can easily retrieve a and b by passing zero level
|
||||
private static JsonObject generateEnchantmentMinPowerCoefficients(Enchantment enchantment) {
|
||||
int b = enchantment.getMinimumPower(0);
|
||||
int a = enchantment.getMinimumPower(1) - b;
|
||||
|
||||
JsonObject resultObject = new JsonObject();
|
||||
resultObject.addProperty("a", a);
|
||||
resultObject.addProperty("b", b);
|
||||
return resultObject;
|
||||
}
|
||||
|
||||
private static JsonObject generateEnchantmentMaxPowerCoefficients(Enchantment enchantment) {
|
||||
int b = enchantment.getMaximumPower(0);
|
||||
int a = enchantment.getMaximumPower(1) - b;
|
||||
|
||||
JsonObject resultObject = new JsonObject();
|
||||
resultObject.addProperty("a", a);
|
||||
resultObject.addProperty("b", b);
|
||||
return resultObject;
|
||||
}
|
||||
|
||||
public static JsonObject generateEnchantment(Enchantment enchantment) {
|
||||
JsonObject enchantmentDesc = new JsonObject();
|
||||
Identifier registryKey = Registries.ENCHANTMENTS.getIdentifier(enchantment);
|
||||
|
||||
enchantmentDesc.addProperty("id", Registries.ENCHANTMENTS.getRawId(enchantment));
|
||||
enchantmentDesc.addProperty("name", Objects.requireNonNull(registryKey).getPath());
|
||||
enchantmentDesc.addProperty("displayName", DGU.translateText(enchantment.getTranslationKey()));
|
||||
|
||||
enchantmentDesc.addProperty("maxLevel", enchantment.getMaximumLevel());
|
||||
enchantmentDesc.add("minCost", generateEnchantmentMinPowerCoefficients(enchantment));
|
||||
enchantmentDesc.add("maxCost", generateEnchantmentMaxPowerCoefficients(enchantment));
|
||||
|
||||
enchantmentDesc.addProperty("treasureOnly", false); // 1.9 added treasure enchants
|
||||
enchantmentDesc.addProperty("curse", false); // 1.10 added curse enchants
|
||||
|
||||
List<Enchantment> incompatibleEnchantments = new ArrayList<>();
|
||||
for (Enchantment other : Registries.ENCHANTMENTS) {
|
||||
if (!enchantment.differs(other) && !other.differs(enchantment) && other != enchantment) {
|
||||
incompatibleEnchantments.add(other);
|
||||
}
|
||||
}
|
||||
|
||||
JsonArray excludes = new JsonArray();
|
||||
for (Enchantment excludedEnchantment : incompatibleEnchantments) {
|
||||
Identifier otherKey = Registries.ENCHANTMENTS.getIdentifier(excludedEnchantment);
|
||||
excludes.add(new JsonPrimitive(Objects.requireNonNull(otherKey).getPath()));
|
||||
}
|
||||
enchantmentDesc.add("exclude", excludes);
|
||||
|
||||
enchantmentDesc.addProperty("category", getEnchantmentTargetName(enchantment.target));
|
||||
enchantmentDesc.addProperty("weight", enchantment.getEnchantmentType()); // see AnvilScreenhandler L209
|
||||
enchantmentDesc.addProperty("tradeable", true); // the first non-tradeable enchant came in 1.16, soul speed
|
||||
enchantmentDesc.addProperty("discoverable", true); // the first non-enchantable enchant came in 1.16, soul speed
|
||||
|
||||
return enchantmentDesc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataName() {
|
||||
return "enchantments";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonArray generateDataJson() {
|
||||
JsonArray resultsArray = new JsonArray();
|
||||
for (Enchantment enchantment : Registries.ENCHANTMENTS) {
|
||||
resultsArray.add(generateEnchantment(enchantment));
|
||||
}
|
||||
return resultsArray;
|
||||
}
|
||||
}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
package dev.u9g.minecraftdatagenerator.generators;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import dev.u9g.minecraftdatagenerator.mixin.EntityTypeAccessor;
|
||||
import dev.u9g.minecraftdatagenerator.util.DGU;
|
||||
import dev.u9g.minecraftdatagenerator.util.Registries;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.mob.AmbientEntity;
|
||||
import net.minecraft.entity.mob.HostileEntity;
|
||||
import net.minecraft.entity.mob.MobEntity;
|
||||
import net.minecraft.entity.mob.WaterCreatureEntity;
|
||||
import net.minecraft.entity.passive.AnimalEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.projectile.FishingBobberEntity;
|
||||
import net.minecraft.entity.projectile.Projectile;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class EntitiesDataGenerator implements IDataGenerator {
|
||||
public static JsonObject generateEntity(Class<? extends Entity> entityClass) {
|
||||
JsonObject entityDesc = new JsonObject();
|
||||
Identifier registryKey = Registries.ENTITY_TYPES.getIdentifier(entityClass);
|
||||
int entityRawId = Registries.ENTITY_TYPES.getRawId(entityClass);
|
||||
@Nullable Entity entity = makeEntity(entityClass);
|
||||
// FIXME: ENTITY ID IS WRONG
|
||||
int id = entityId(entity);
|
||||
entityDesc.addProperty("id", id);
|
||||
entityDesc.addProperty("internalId", id);
|
||||
entityDesc.addProperty("name", Objects.requireNonNull(registryKey).getPath());
|
||||
if (entity instanceof ItemEntity itemEntity) {
|
||||
// Same as 1.9.4
|
||||
itemEntity.setItemStack(new ItemStack(Blocks.STONE));
|
||||
}
|
||||
String displayName = entity != null ? entity.getTranslationKey() : null;
|
||||
if (displayName != null && !displayName.startsWith("entity.")) {
|
||||
entityDesc.addProperty("displayName", displayName);
|
||||
}
|
||||
entityDesc.addProperty("width", entity == null ? 0 : entity.width);
|
||||
entityDesc.addProperty("height", entity == null ? 0 : entity.height);
|
||||
|
||||
String entityTypeString = getEntityTypeForClass(entityClass);
|
||||
entityDesc.addProperty("type", entityTypeString);
|
||||
entityDesc.addProperty("category", getCategoryFrom(entityClass));
|
||||
|
||||
return entityDesc;
|
||||
}
|
||||
|
||||
private static Entity makeEntity(Class<? extends Entity> type) {
|
||||
String name = EntityTypeAccessor.CLASS_NAME_MAP().get(type);
|
||||
return EntityType.createInstanceFromName(name, DGU.getWorld());
|
||||
}
|
||||
|
||||
private static String getCategoryFrom(@NotNull Class<?> entityClass) {
|
||||
if (entityClass == PlayerEntity.class) return "other"; // fail early for player entities
|
||||
String packageName = entityClass.getPackage().getName();
|
||||
return switch (packageName) {
|
||||
case "net.minecraft.entity.decoration", "net.minecraft.entity.decoration.painting" -> "Immobile";
|
||||
case "net.minecraft.entity.boss", "net.minecraft.entity.mob", "net.minecraft.entity.boss.dragon" ->
|
||||
"Hostile mobs";
|
||||
case "net.minecraft.entity.projectile", "net.minecraft.entity.thrown" -> "Projectiles";
|
||||
case "net.minecraft.entity.passive" -> "Passive mobs";
|
||||
case "net.minecraft.entity.vehicle" -> "Vehicles";
|
||||
case "net.minecraft.entity" -> "other";
|
||||
default -> throw new IllegalStateException("Unexpected entity type: " + packageName);
|
||||
};
|
||||
}
|
||||
|
||||
//Honestly, both "type" and "category" fields in the schema and examples do not contain any useful information
|
||||
//Since category is optional, I will just leave it out, and for type I will assume general entity classification
|
||||
//by the Entity class hierarchy (which has some weirdness too by the way)
|
||||
private static String getEntityTypeForClass(Class<? extends Entity> entityClass) {
|
||||
//Top-level classifications
|
||||
if (WaterCreatureEntity.class.isAssignableFrom(entityClass)) {
|
||||
return "water_creature";
|
||||
}
|
||||
if (AnimalEntity.class.isAssignableFrom(entityClass)) {
|
||||
return "animal";
|
||||
}
|
||||
if (HostileEntity.class.isAssignableFrom(entityClass)) {
|
||||
return "hostile";
|
||||
}
|
||||
if (AmbientEntity.class.isAssignableFrom(entityClass)) {
|
||||
return "ambient";
|
||||
}
|
||||
|
||||
//Second level classifications. PathAwareEntity is not included because it
|
||||
//doesn't really make much sense to categorize by it
|
||||
if (PathAwareEntity.class.isAssignableFrom(entityClass)) {
|
||||
return "passive";
|
||||
}
|
||||
if (MobEntity.class.isAssignableFrom(entityClass)) {
|
||||
return "mob";
|
||||
}
|
||||
|
||||
//Other classifications only include living entities and projectiles. everything else is categorized as other
|
||||
if (LivingEntity.class.isAssignableFrom(entityClass)) {
|
||||
return "living";
|
||||
}
|
||||
if (Projectile.class.isAssignableFrom(entityClass)) {
|
||||
return "projectile";
|
||||
}
|
||||
return "other";
|
||||
}
|
||||
|
||||
private static int entityId(Entity entity) {
|
||||
if (!DGU.getCurrentlyRunningServer().getVersion().equals("1.8.9")) {
|
||||
throw new IllegalStateException("These ids were gotten manually for 1.8.9, remake for " + DGU.getCurrentlyRunningServer().getVersion());
|
||||
}
|
||||
int rawId = Registries.ENTITY_TYPES.getRawId(entity.getClass());
|
||||
if (rawId == -1) { // see TrackedEntityInstance
|
||||
if (entity instanceof ItemEntity) {
|
||||
return 2;
|
||||
} else if (entity instanceof FishingBobberEntity) {
|
||||
return 90;
|
||||
} else {
|
||||
throw new IllegalStateException("unable to find rawId for entity: " + entity.getEntity().getClass().getName());
|
||||
}
|
||||
}
|
||||
return rawId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataName() {
|
||||
return "entities";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonArray generateDataJson() {
|
||||
JsonArray resultArray = new JsonArray();
|
||||
for (Class<? extends Entity> entityType : Registries.ENTITY_TYPES) {
|
||||
resultArray.add(generateEntity(entityType));
|
||||
}
|
||||
return resultArray;
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package dev.u9g.minecraftdatagenerator.generators;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import dev.u9g.minecraftdatagenerator.util.DGU;
|
||||
import dev.u9g.minecraftdatagenerator.util.Registries;
|
||||
import net.minecraft.item.FoodItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class FoodsDataGenerator implements IDataGenerator {
|
||||
public static JsonObject generateFoodDescriptor(FoodItem foodItem) {
|
||||
JsonObject foodDesc = new JsonObject();
|
||||
Identifier registryKey = Registries.ITEMS.getIdentifier(foodItem);
|
||||
|
||||
foodDesc.addProperty("id", Registries.ITEMS.getRawId(foodItem));
|
||||
foodDesc.addProperty("name", Objects.requireNonNull(registryKey).getPath());
|
||||
|
||||
foodDesc.addProperty("stackSize", foodItem.getMaxCount());
|
||||
foodDesc.addProperty("displayName", foodItem.getDisplayName(DGU.stackFor(foodItem)));
|
||||
float foodPoints = foodItem.getHungerPoints(DGU.stackFor(foodItem));
|
||||
float saturationRatio = foodItem.getSaturation(DGU.stackFor(foodItem)) * 2.0F;
|
||||
float saturation = foodPoints * saturationRatio;
|
||||
|
||||
foodDesc.addProperty("foodPoints", foodPoints);
|
||||
foodDesc.addProperty("saturation", saturation);
|
||||
|
||||
foodDesc.addProperty("effectiveQuality", foodPoints + saturation);
|
||||
foodDesc.addProperty("saturationRatio", saturationRatio);
|
||||
return foodDesc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataName() {
|
||||
return "foods";
|
||||
}
|
||||
|
||||
public JsonArray generateDataJson() {
|
||||
JsonArray resultsArray = new JsonArray();
|
||||
for (Item item : Registries.ITEMS) {
|
||||
if (item instanceof FoodItem) {
|
||||
resultsArray.add(generateFoodDescriptor((FoodItem) item));
|
||||
}
|
||||
}
|
||||
return resultsArray;
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package dev.u9g.minecraftdatagenerator.generators;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import dev.u9g.minecraftdatagenerator.mixin.NoteBlockAccessor;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class InstrumentsDataGenerator implements IDataGenerator {
|
||||
@Override
|
||||
public String getDataName() {
|
||||
return "instruments";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement generateDataJson() {
|
||||
JsonArray array = new JsonArray();
|
||||
int i = 0;
|
||||
for (String soundName : Objects.requireNonNull(NoteBlockAccessor.TUNES())) {
|
||||
JsonObject object = new JsonObject();
|
||||
object.addProperty("id", i++);
|
||||
object.addProperty("name", soundName);
|
||||
array.add(object);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package dev.u9g.minecraftdatagenerator.generators;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import dev.u9g.minecraftdatagenerator.util.DGU;
|
||||
import dev.u9g.minecraftdatagenerator.util.Registries;
|
||||
import net.minecraft.enchantment.EnchantmentTarget;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ItemsDataGenerator implements IDataGenerator {
|
||||
|
||||
private static List<Item> calculateItemsToRepairWith(Item sourceItem) {
|
||||
List<Item> items = new ArrayList<>();
|
||||
for (Item otherItem : Registries.ITEMS) {
|
||||
if (sourceItem.canRepair(DGU.stackFor(sourceItem), DGU.stackFor(otherItem))) {
|
||||
items.add(otherItem);
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
private static Set<String> getApplicableEnchantmentTargets(Item sourceItem) {
|
||||
return Arrays.stream(EnchantmentTarget.values())
|
||||
.filter(target -> target.isCompatible(sourceItem))
|
||||
.map(EnchantmentsDataGenerator::getEnchantmentTargetName)
|
||||
.sorted()
|
||||
.collect(Collectors.toCollection(LinkedHashSet::new));
|
||||
}
|
||||
|
||||
public static JsonObject generateItem(Item item) {
|
||||
JsonObject itemDesc = new JsonObject();
|
||||
Identifier registryKey = Registries.ITEMS.getIdentifier(item);
|
||||
|
||||
itemDesc.addProperty("id", Registries.ITEMS.getRawId(item));
|
||||
itemDesc.addProperty("name", Objects.requireNonNull(registryKey).getPath());
|
||||
|
||||
itemDesc.addProperty("displayName", item.getDisplayName(DGU.stackFor(item)));
|
||||
itemDesc.addProperty("stackSize", item.getMaxCount());
|
||||
|
||||
JsonArray enchantCategoriesArray = new JsonArray();
|
||||
getApplicableEnchantmentTargets(item).forEach(enchantCategoriesArray::add);
|
||||
if (!enchantCategoriesArray.isEmpty()) {
|
||||
itemDesc.add("enchantCategories", enchantCategoriesArray);
|
||||
}
|
||||
|
||||
if (item.isDamageable()) {
|
||||
List<Item> repairWithItems = calculateItemsToRepairWith(item);
|
||||
|
||||
JsonArray fixedWithArray = new JsonArray();
|
||||
for (Item repairWithItem : repairWithItems) {
|
||||
Identifier repairWithName = Registries.ITEMS.getIdentifier(repairWithItem);
|
||||
fixedWithArray.add(new JsonPrimitive(Objects.requireNonNull(repairWithName).getPath()));
|
||||
}
|
||||
if (!fixedWithArray.isEmpty()) {
|
||||
itemDesc.add("repairWith", fixedWithArray);
|
||||
}
|
||||
|
||||
int maxDurability = item.getMaxDamage();
|
||||
itemDesc.addProperty("maxDurability", maxDurability);
|
||||
}
|
||||
return itemDesc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataName() {
|
||||
return "items";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonArray generateDataJson() {
|
||||
JsonArray resultArray = new JsonArray();
|
||||
for (Item item : Registries.ITEMS) {
|
||||
resultArray.add(generateItem(item));
|
||||
}
|
||||
return resultArray;
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package dev.u9g.minecraftdatagenerator.generators;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import dev.u9g.minecraftdatagenerator.mixin.LanguageAccessor;
|
||||
import dev.u9g.minecraftdatagenerator.util.Registries;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class LanguageDataGenerator implements IDataGenerator {
|
||||
@Override
|
||||
public String getDataName() {
|
||||
return "language";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement generateDataJson() {
|
||||
try {
|
||||
JsonObject obj = new JsonObject();
|
||||
Map<String, String> translations = ((LanguageAccessor) Registries.LANGUAGE).translations();
|
||||
for (Map.Entry<String, String> entry : translations.entrySet()) {
|
||||
obj.addProperty(entry.getKey(), entry.getValue());
|
||||
}
|
||||
return obj;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to generate language file", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package dev.u9g.minecraftdatagenerator.generators;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.minecraft.client.particle.ParticleType;
|
||||
|
||||
public class ParticlesDataGenerator implements IDataGenerator {
|
||||
public static JsonObject generateParticleType(int id, ParticleType particleType) {
|
||||
JsonObject effectDesc = new JsonObject();
|
||||
|
||||
effectDesc.addProperty("id", id);
|
||||
effectDesc.addProperty("name", particleType.getName());
|
||||
return effectDesc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataName() {
|
||||
return "particles";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonArray generateDataJson() {
|
||||
JsonArray resultsArray = new JsonArray();
|
||||
int i = 0;
|
||||
for (ParticleType particleType : ParticleType.values()) {
|
||||
resultsArray.add(generateParticleType(i++, particleType));
|
||||
}
|
||||
return resultsArray;
|
||||
}
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
package dev.u9g.minecraftdatagenerator.generators;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonNull;
|
||||
|
||||
public class RecipeDataGenerator implements IDataGenerator {
|
||||
|
||||
@Override
|
||||
public String getDataName() {
|
||||
return "recipes";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement generateDataJson() {
|
||||
// JsonObject finalObj = new JsonObject();
|
||||
// Multimap<Integer, JsonObject> recipes = ArrayListMultimap.create();
|
||||
// for (Recipe<?> recipe : Objects.requireNonNull(DGU.getWorld()).getRecipeManager().values()) {
|
||||
// if (recipe instanceof ShapedRecipe sr) {
|
||||
// var ingredients = sr.getIngredients();
|
||||
// List<Integer> ingr = new ArrayList<>();
|
||||
// for (int i = 0; i < 9; i++) {
|
||||
// if (i >= ingredients.size()) {
|
||||
// ingr.add(-1);
|
||||
// continue;
|
||||
// }
|
||||
// var stacks = ingredients.get(i);
|
||||
//// var matching = stacks.getMatchingStacks();
|
||||
//// if (matching.length == 0) {
|
||||
//// ingr.add(-1);
|
||||
//// } else {
|
||||
//// ingr.add(getRawIdFor(matching[0].getItem()));
|
||||
//// }
|
||||
// }
|
||||
// Lists.reverse(ingr);
|
||||
//
|
||||
// JsonArray inShape = new JsonArray();
|
||||
//
|
||||
// var iter = ingr.iterator();
|
||||
// for (int y = 0; y < 3; y++) {
|
||||
// var jsonRow = new JsonArray();
|
||||
// int one = iter.next();
|
||||
// int two = iter.next();
|
||||
// int three = iter.next();
|
||||
// if (y > 0 && one == -1 && two == -1 && three == -1) continue;
|
||||
// jsonRow.add(one);
|
||||
// jsonRow.add(two);
|
||||
// jsonRow.add(three);
|
||||
// inShape.add(jsonRow);
|
||||
// }
|
||||
//
|
||||
// JsonObject finalRecipe = new JsonObject();
|
||||
// finalRecipe.add("inShape", inShape);
|
||||
//
|
||||
// var resultObject = new JsonObject();
|
||||
// resultObject.addProperty("id", getRawIdFor(sr.getOutput().getItem()));
|
||||
// resultObject.addProperty("count", sr.getOutput().getCount());
|
||||
// finalRecipe.add("result", resultObject);
|
||||
//
|
||||
// String id = ((Integer) getRawIdFor(sr.getOutput().getItem())).toString();
|
||||
//
|
||||
// if (!finalObj.has(id)) {
|
||||
// finalObj.add(id, new JsonArray());
|
||||
// }
|
||||
// finalObj.get(id).getAsJsonArray().add(finalRecipe);
|
||||
//// var input = new JsonArray();
|
||||
//// var ingredients = sr.getIngredients().stream().toList();
|
||||
//// for (int y = 0; y < sr.getHeight(); y++) {
|
||||
//// var arr = new JsonArray();
|
||||
//// for (int x = 0; x < sr.getWidth(); x++) {
|
||||
//// if ((y*3)+x >= ingredients.size()) {
|
||||
//// arr.add(JsonNull.INSTANCE);
|
||||
//// continue;
|
||||
//// }
|
||||
//// var ingredient = ingredients.get((y*3)+x).getMatchingStacks(); // FIXME: fix when there are more than one matching stack
|
||||
//// if (ingredient.length == 0) {
|
||||
//// arr.add(JsonNull.INSTANCE);
|
||||
//// } else {
|
||||
//// arr.add(getRawIdFor(ingredient[0].getItem()));
|
||||
//// }
|
||||
//// }
|
||||
//// input.add(arr);
|
||||
//// }
|
||||
//// var rootRecipeObject = new JsonObject();
|
||||
//// rootRecipeObject.add("inShape", input);
|
||||
//// var resultObject = new JsonObject();
|
||||
//// resultObject.addProperty("id", getRawIdFor(sr.getOutput().getItem()));
|
||||
//// resultObject.addProperty("count", sr.getOutput().getCount());
|
||||
//// rootRecipeObject.add("result", resultObject);
|
||||
//// recipes.put(getRawIdFor(sr.getOutput().getItem()), rootRecipeObject);
|
||||
// } else if (recipe instanceof ShapelessRecipe sl) {
|
||||
|
||||
// var ingredients = new JsonArray();
|
||||
// for (Ingredient ingredient : sl.getIngredients()) {
|
||||
// if (ingredient.isEmpty()) continue;
|
||||
//// ingredients.add(getRawIdFor(ingredient.getMatchingStacks()[0].getItem()));
|
||||
// }
|
||||
// var rootRecipeObject = new JsonObject();
|
||||
// rootRecipeObject.add("ingredients", ingredients);
|
||||
// var resultObject = new JsonObject();
|
||||
// resultObject.addProperty("id", getRawIdFor(sl.getOutput().getItem()));
|
||||
// resultObject.addProperty("count", sl.getOutput().getCount());
|
||||
// rootRecipeObject.add("result", resultObject);
|
||||
// recipes.put(getRawIdFor(sl.getOutput().getItem()), rootRecipeObject);
|
||||
// }
|
||||
// }
|
||||
// recipes.forEach((a, b) -> {
|
||||
// if (!finalObj.has(a.toString())) {
|
||||
// finalObj.add(a.toString(), new JsonArray());
|
||||
// }
|
||||
// finalObj.get(a.toString()).getAsJsonArray().add(b);
|
||||
// });
|
||||
// return finalObj;
|
||||
return JsonNull.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return false; // TODO: Implement this
|
||||
}
|
||||
//
|
||||
// private static int getRawIdFor (Item item) {
|
||||
// return Registry.ITEM.getRawId(item);
|
||||
// }
|
||||
}
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
package dev.u9g.minecraftdatagenerator.generators;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import dev.u9g.minecraftdatagenerator.mixin.BiomeAccessor;
|
||||
import dev.u9g.minecraftdatagenerator.util.Registries;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.RedstoneWireBlock;
|
||||
import net.minecraft.client.color.world.FoliageColors;
|
||||
import net.minecraft.client.color.world.GrassColors;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
|
||||
public class TintsDataGenerator implements IDataGenerator {
|
||||
public static BiomeTintColors generateBiomeTintColors() {
|
||||
BiomeTintColors colors = new BiomeTintColors();
|
||||
|
||||
for (Biome biome : Registries.BIOMES) {
|
||||
double d = MathHelper.clamp(biome.temperature, 0.0F, 1.0F);
|
||||
double e = MathHelper.clamp(biome.downfall, 0.0F, 1.0F);
|
||||
|
||||
int biomeGrassColor = GrassColors.getColor(d, e);
|
||||
int biomeFoliageColor = FoliageColors.getColor(d, e);
|
||||
int biomeWaterColor = ((BiomeAccessor) biome).waterColor();
|
||||
|
||||
colors.grassColoursMap.computeIfAbsent(biomeGrassColor, k -> new ArrayList<>()).add(biome);
|
||||
colors.foliageColoursMap.computeIfAbsent(biomeFoliageColor, k -> new ArrayList<>()).add(biome);
|
||||
colors.waterColourMap.computeIfAbsent(biomeWaterColor, k -> new ArrayList<>()).add(biome);
|
||||
}
|
||||
return colors;
|
||||
}
|
||||
|
||||
public static Map<Integer, Integer> generateRedstoneTintColors() {
|
||||
Map<Integer, Integer> resultColors = new LinkedHashMap<>();
|
||||
|
||||
RedstoneWireBlock redstoneWireBlock = new RedstoneWireBlock();
|
||||
try {
|
||||
Method colorIntensity = RedstoneWireBlock.class.getDeclaredMethod("getColorIntensity", int.class);
|
||||
colorIntensity.setAccessible(true);
|
||||
for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) {
|
||||
int color = (int) colorIntensity.invoke(redstoneWireBlock, redstoneLevel);
|
||||
resultColors.put(redstoneLevel, color);
|
||||
}
|
||||
} catch (ReflectiveOperationException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return resultColors;
|
||||
}
|
||||
|
||||
public static Map<Block, Integer> generateConstantTintColors() {
|
||||
Map<Block, Integer> resultColors = new LinkedHashMap<>();
|
||||
// FIXME: ?
|
||||
// resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor());
|
||||
// resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor());
|
||||
|
||||
resultColors.put(Blocks.LILY_PAD, Blocks.LILY_PAD.getColor());
|
||||
// FIXME: ?
|
||||
// resultColors.put(Blocks.ATTACHED_MELON_STEM, getBlockColor(Blocks.ATTACHED_MELON_STEM));
|
||||
// resultColors.put(Blocks.ATTACHED_PUMPKIN_STEM, getBlockColor(Blocks.ATTACHED_PUMPKIN_STEM));
|
||||
|
||||
//not really constant, depend on the block age, but kinda have to be handled since textures are literally white without them
|
||||
resultColors.put(Blocks.MELON_STEM, Blocks.MELON_STEM.getColor());
|
||||
resultColors.put(Blocks.PUMPKIN_STEM, Blocks.PUMPKIN_STEM.getColor());
|
||||
|
||||
return resultColors;
|
||||
}
|
||||
|
||||
private static JsonObject encodeBiomeColorMap(Map<Integer, List<Biome>> colorsMap) {
|
||||
JsonArray resultColorsArray = new JsonArray();
|
||||
for (Map.Entry<Integer, List<Biome>> entry : colorsMap.entrySet()) {
|
||||
JsonObject entryObject = new JsonObject();
|
||||
|
||||
JsonArray keysArray = new JsonArray();
|
||||
for (Biome biome : entry.getValue()) {
|
||||
keysArray.add(new JsonPrimitive(biome.name));
|
||||
}
|
||||
|
||||
entryObject.add("keys", keysArray);
|
||||
entryObject.addProperty("color", entry.getKey());
|
||||
resultColorsArray.add(entryObject);
|
||||
}
|
||||
|
||||
JsonObject resultObject = new JsonObject();
|
||||
resultObject.add("data", resultColorsArray);
|
||||
return resultObject;
|
||||
}
|
||||
|
||||
private static JsonObject encodeRedstoneColorMap(Map<Integer, Integer> colorsMap) {
|
||||
JsonArray resultColorsArray = new JsonArray();
|
||||
for (Map.Entry<Integer, Integer> entry : colorsMap.entrySet()) {
|
||||
JsonObject entryObject = new JsonObject();
|
||||
|
||||
JsonArray keysArray = new JsonArray();
|
||||
keysArray.add(new JsonPrimitive(entry.getKey()));
|
||||
|
||||
entryObject.add("keys", keysArray);
|
||||
entryObject.addProperty("color", entry.getValue());
|
||||
resultColorsArray.add(entryObject);
|
||||
}
|
||||
|
||||
JsonObject resultObject = new JsonObject();
|
||||
resultObject.add("data", resultColorsArray);
|
||||
return resultObject;
|
||||
}
|
||||
|
||||
private static JsonObject encodeBlocksColorMap(Map<Block, Integer> colorsMap) {
|
||||
JsonArray resultColorsArray = new JsonArray();
|
||||
for (Map.Entry<Block, Integer> entry : colorsMap.entrySet()) {
|
||||
JsonObject entryObject = new JsonObject();
|
||||
JsonArray keysArray = new JsonArray();
|
||||
Identifier registryKey = Registries.BLOCKS.getIdentifier(entry.getKey());
|
||||
keysArray.add(new JsonPrimitive(Objects.requireNonNull(registryKey).getPath()));
|
||||
|
||||
entryObject.add("keys", keysArray);
|
||||
entryObject.addProperty("color", entry.getValue());
|
||||
resultColorsArray.add(entryObject);
|
||||
}
|
||||
|
||||
JsonObject resultObject = new JsonObject();
|
||||
resultObject.add("data", resultColorsArray);
|
||||
return resultObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataName() {
|
||||
return "tints";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonObject generateDataJson() {
|
||||
BiomeTintColors biomeTintColors = generateBiomeTintColors();
|
||||
Map<Integer, Integer> redstoneColors = generateRedstoneTintColors();
|
||||
Map<Block, Integer> constantTintColors = generateConstantTintColors();
|
||||
|
||||
JsonObject resultObject = new JsonObject();
|
||||
|
||||
resultObject.add("grass", encodeBiomeColorMap(biomeTintColors.grassColoursMap));
|
||||
resultObject.add("foliage", encodeBiomeColorMap(biomeTintColors.foliageColoursMap));
|
||||
resultObject.add("water", encodeBiomeColorMap(biomeTintColors.waterColourMap));
|
||||
|
||||
resultObject.add("redstone", encodeRedstoneColorMap(redstoneColors));
|
||||
resultObject.add("constant", encodeBlocksColorMap(constantTintColors));
|
||||
|
||||
return resultObject;
|
||||
}
|
||||
|
||||
public static class BiomeTintColors {
|
||||
final Map<Integer, List<Biome>> grassColoursMap = new LinkedHashMap<>();
|
||||
final Map<Integer, List<Biome>> foliageColoursMap = new LinkedHashMap<>();
|
||||
final Map<Integer, List<Biome>> waterColourMap = new LinkedHashMap<>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package dev.u9g.minecraftdatagenerator.mixin;
|
||||
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Mixin(Biome.class)
|
||||
public interface BiomeAccessor {
|
||||
@Accessor("BIOMESET")
|
||||
static Set<Biome> BIOMESET() {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Accessor("waterColor")
|
||||
int waterColor();
|
||||
|
||||
@Accessor("name")
|
||||
String name();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package dev.u9g.minecraftdatagenerator.mixin;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(Block.class)
|
||||
public interface BlockAccessor {
|
||||
@Accessor("blastResistance")
|
||||
float getBlastResistance();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package dev.u9g.minecraftdatagenerator.mixin;
|
||||
|
||||
import net.minecraft.server.dedicated.EulaReader;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(EulaReader.class)
|
||||
public class EULAMixin {
|
||||
@Inject(method = "isEulaAgreedTo()Z", at = @At("TAIL"), cancellable = true)
|
||||
public void init(CallbackInfoReturnable<Boolean> cir) {
|
||||
cir.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package dev.u9g.minecraftdatagenerator.mixin;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mixin(Enchantment.class)
|
||||
public interface EnchantmentAccessor {
|
||||
@Accessor("ENCHANTMENT_MAP")
|
||||
static Map<Identifier, Enchantment> ENCHANTMENT_MAP() {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package dev.u9g.minecraftdatagenerator.mixin;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mixin(EntityType.class)
|
||||
public interface EntityTypeAccessor {
|
||||
@Accessor("CLASS_NAME_MAP")
|
||||
static Map<Class<? extends Entity>, String> CLASS_NAME_MAP() {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Accessor("ID_CLASS_MAP")
|
||||
static Map<Integer, Class<? extends Entity>> ID_CLASS_MAP() {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package dev.u9g.minecraftdatagenerator.mixin;
|
||||
|
||||
import net.minecraft.util.Language;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mixin(Language.class)
|
||||
public interface LanguageAccessor {
|
||||
@Accessor("translations")
|
||||
Map<String, String> translations();
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package dev.u9g.minecraftdatagenerator.mixin;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ToolItem;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Mixin(ToolItem.class)
|
||||
public interface MiningToolItemAccessor {
|
||||
|
||||
@Accessor
|
||||
Set<Block> getEffectiveBlocks();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package dev.u9g.minecraftdatagenerator.mixin;
|
||||
|
||||
import net.minecraft.block.NoteBlock;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(NoteBlock.class)
|
||||
public interface NoteBlockAccessor {
|
||||
@Accessor("TUNES")
|
||||
static List<String> TUNES() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package dev.u9g.minecraftdatagenerator.mixin;
|
||||
|
||||
import dev.u9g.minecraftdatagenerator.MinecraftDataGenerator;
|
||||
import dev.u9g.minecraftdatagenerator.util.DGU;
|
||||
import net.minecraft.server.dedicated.MinecraftDedicatedServer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(MinecraftDedicatedServer.class)
|
||||
public class ReadyMixin {
|
||||
@Inject(method = "setupServer()Z", at = @At("HEAD"))
|
||||
private void constructor(CallbackInfoReturnable<Boolean> cir) {
|
||||
((MinecraftDedicatedServer) (Object) this).setServerPort(0);
|
||||
}
|
||||
|
||||
@Inject(method = "setupServer()Z", at = @At("TAIL"))
|
||||
private void init(CallbackInfoReturnable<Boolean> cir) {
|
||||
MinecraftDataGenerator.start(
|
||||
DGU.getCurrentlyRunningServer().getVersion(),
|
||||
DGU.getCurrentlyRunningServer().getRunDirectory().toPath()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package dev.u9g.minecraftdatagenerator.mixin;
|
||||
|
||||
import net.minecraft.entity.effect.StatusEffect;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mixin(StatusEffect.class)
|
||||
public interface StatusEffectAccessor {
|
||||
@Accessor("STATUS_EFFECTS_BY_ID")
|
||||
static Map<Identifier, StatusEffect> STATUS_EFFECTS_BY_ID() {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Accessor("negative")
|
||||
boolean negative();
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package dev.u9g.minecraftdatagenerator.util;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class DGU {
|
||||
public static MinecraftServer getCurrentlyRunningServer() {
|
||||
return MinecraftServer.getServer();
|
||||
}
|
||||
|
||||
public static String translateText(String translationKey) {
|
||||
return Registries.LANGUAGE.translate(translationKey);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static World getWorld() {
|
||||
return getCurrentlyRunningServer().getWorld();
|
||||
}
|
||||
|
||||
public static ItemStack stackFor(Item ic) {
|
||||
return new ItemStack(ic);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package dev.u9g.minecraftdatagenerator.util;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.level.LevelGeneratorType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class EmptyBlockView implements BlockView {
|
||||
public static final EmptyBlockView INSTANCE = new EmptyBlockView();
|
||||
|
||||
@Nullable
|
||||
public BlockEntity getBlockEntity(BlockPos pos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLight(BlockPos pos, int minBlockLight) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public BlockState getBlockState(BlockPos pos) {
|
||||
return Blocks.AIR.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAir(BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getBiome(BlockPos pos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStrongRedstonePower(BlockPos pos, Direction direction) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LevelGeneratorType getGeneratorType() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package dev.u9g.minecraftdatagenerator.util;
|
||||
|
||||
import dev.u9g.minecraftdatagenerator.mixin.BiomeAccessor;
|
||||
import dev.u9g.minecraftdatagenerator.mixin.EnchantmentAccessor;
|
||||
import dev.u9g.minecraftdatagenerator.mixin.EntityTypeAccessor;
|
||||
import dev.u9g.minecraftdatagenerator.mixin.StatusEffectAccessor;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.effect.StatusEffect;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Language;
|
||||
import net.minecraft.util.registry.SimpleRegistry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class Registries {
|
||||
public static final SimpleRegistry<String, Biome> BIOMES = setupBiomeRegistry();
|
||||
public static final SimpleRegistry<Identifier, Block> BLOCKS = Block.REGISTRY;
|
||||
public static final SimpleRegistry<Identifier, Item> ITEMS = Item.REGISTRY;
|
||||
public static final SimpleRegistry<Identifier, StatusEffect> STATUS_EFFECTS = setupStatusEffectRegistry();
|
||||
public static final SimpleRegistry<Identifier, Enchantment> ENCHANTMENTS = setupEnchantmentRegistry();
|
||||
public static final SimpleRegistry<Identifier, Class<? extends Entity>> ENTITY_TYPES = setupEntityTypesRegistry();
|
||||
public static final Language LANGUAGE = new Language();
|
||||
|
||||
private static SimpleRegistry<Identifier, Class<? extends Entity>> setupEntityTypesRegistry() {
|
||||
SimpleRegistry<Identifier, Class<? extends Entity>> registry = new SimpleRegistry<>();
|
||||
for (Map.Entry<Integer, Class<? extends Entity>> entry : EntityTypeAccessor.ID_CLASS_MAP().entrySet()) {
|
||||
String name = EntityTypeAccessor.CLASS_NAME_MAP().get(entry.getValue());
|
||||
if (name.equals("Mob") || name.equals("Monster")) {
|
||||
continue;
|
||||
}
|
||||
registry.add(entry.getKey(), new Identifier(name), entry.getValue());
|
||||
}
|
||||
|
||||
return registry;
|
||||
}
|
||||
|
||||
private static SimpleRegistry<Identifier, Enchantment> setupEnchantmentRegistry() {
|
||||
SimpleRegistry<Identifier, Enchantment> registry = new SimpleRegistry<>();
|
||||
for (Map.Entry<Identifier, Enchantment> entry : EnchantmentAccessor.ENCHANTMENT_MAP().entrySet()) {
|
||||
registry.add(entry.getValue().id, entry.getKey(), entry.getValue());
|
||||
}
|
||||
return registry;
|
||||
}
|
||||
|
||||
private static SimpleRegistry<String, Biome> setupBiomeRegistry() {
|
||||
SimpleRegistry<String, Biome> registry = new SimpleRegistry<>();
|
||||
for (Biome biome : BiomeAccessor.BIOMESET()) {
|
||||
registry.add(biome.id, biome.name, biome);
|
||||
}
|
||||
return registry;
|
||||
}
|
||||
|
||||
private static SimpleRegistry<Identifier, StatusEffect> setupStatusEffectRegistry() {
|
||||
SimpleRegistry<Identifier, StatusEffect> registry = new SimpleRegistry<>();
|
||||
for (Map.Entry<Identifier, StatusEffect> entry : StatusEffectAccessor.STATUS_EFFECTS_BY_ID().entrySet()) {
|
||||
registry.add(entry.getValue().id, entry.getKey(), entry.getValue());
|
||||
}
|
||||
return registry;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "minecraft-data-generator",
|
||||
"version": "${version}",
|
||||
"name": "Minecraft Data Generator",
|
||||
"description": "",
|
||||
"authors": [
|
||||
"Archengius",
|
||||
"U9G"
|
||||
],
|
||||
"contact": {},
|
||||
"license": "MIT",
|
||||
"mixins": [
|
||||
"minecraft-data-generator.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": "*",
|
||||
"minecraft": "*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "dev.u9g.minecraftdatagenerator.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"BiomeAccessor",
|
||||
"BlockAccessor",
|
||||
"EnchantmentAccessor",
|
||||
"EntityTypeAccessor",
|
||||
"LanguageAccessor",
|
||||
"MiningToolItemAccessor",
|
||||
"NoteBlockAccessor",
|
||||
"ReadyMixin",
|
||||
"StatusEffectAccessor"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
},
|
||||
"server": [
|
||||
"EULAMixin"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user