+4
-4
@@ -2,13 +2,13 @@
|
|||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx1G
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://modmuss50.me/fabric.html
|
# check these on https://modmuss50.me/fabric.html
|
||||||
minecraft_version=1.19.4
|
minecraft_version=1.20.1
|
||||||
yarn_mappings=1.19.4+build.1
|
yarn_mappings=1.20.1+build.10
|
||||||
loader_version=0.14.17
|
loader_version=0.14.22
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.0-SNAPSHOT
|
mod_version=1.0-SNAPSHOT
|
||||||
maven_group=dev.u9g
|
maven_group=dev.u9g
|
||||||
archives_base_name=minecraft-data-generator-server
|
archives_base_name=minecraft-data-generator-server
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# check this on https://modmuss50.me/fabric.html
|
# check this on https://modmuss50.me/fabric.html
|
||||||
fabric_version=0.76.0+1.19.4
|
fabric_version=0.87.0+1.20.1
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import net.minecraft.block.BlockState;
|
|||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.loot.context.LootContext;
|
import net.minecraft.loot.context.LootContextParameterSet;
|
||||||
import net.minecraft.loot.context.LootContextParameters;
|
import net.minecraft.loot.context.LootContextParameters;
|
||||||
import net.minecraft.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.registry.RegistryKeys;
|
import net.minecraft.registry.RegistryKeys;
|
||||||
@@ -48,12 +48,11 @@ public class BlocksDataGenerator implements IDataGenerator {
|
|||||||
if (minecraftServer != null) {
|
if (minecraftServer != null) {
|
||||||
//If we have local world context, we can actually evaluate loot tables and determine actual data
|
//If we have local world context, we can actually evaluate loot tables and determine actual data
|
||||||
ServerWorld serverWorld = minecraftServer.getOverworld();
|
ServerWorld serverWorld = minecraftServer.getOverworld();
|
||||||
LootContext.Builder lootContext = new LootContext.Builder(serverWorld)
|
LootContextParameterSet.Builder lootContextParameterSet = new LootContextParameterSet.Builder(serverWorld)
|
||||||
.parameter(LootContextParameters.BLOCK_STATE, blockState)
|
.add(LootContextParameters.BLOCK_STATE, blockState)
|
||||||
.parameter(LootContextParameters.ORIGIN, Vec3d.ZERO)
|
.add(LootContextParameters.ORIGIN, Vec3d.ZERO)
|
||||||
.parameter(LootContextParameters.TOOL, firstToolItem.getDefaultStack())
|
.add(LootContextParameters.TOOL, firstToolItem.getDefaultStack());
|
||||||
.random(0L);
|
outDrops.addAll(blockState.getDroppedStacks(lootContextParameterSet));
|
||||||
outDrops.addAll(blockState.getDroppedStacks(lootContext));
|
|
||||||
} else {
|
} else {
|
||||||
//If we're lacking world context to correctly determine drops, assume that default drop is ItemBlock stack in quantity of 1
|
//If we're lacking world context to correctly determine drops, assume that default drop is ItemBlock stack in quantity of 1
|
||||||
Item itemBlock = blockState.getBlock().asItem();
|
Item itemBlock = blockState.getBlock().asItem();
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import dev.u9g.minecraftdatagenerator.util.DGU;
|
|||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.Material;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.item.MiningToolItem;
|
import net.minecraft.item.MiningToolItem;
|
||||||
@@ -114,8 +113,10 @@ public class MaterialsDataGenerator implements IDataGenerator {
|
|||||||
resultList.add(new MaterialInfo("leaves", blockState -> blockState.isIn(BlockTags.LEAVES)));
|
resultList.add(new MaterialInfo("leaves", blockState -> blockState.isIn(BlockTags.LEAVES)));
|
||||||
resultList.add(new MaterialInfo("wool", blockState -> blockState.isIn(BlockTags.WOOL)));
|
resultList.add(new MaterialInfo("wool", blockState -> blockState.isIn(BlockTags.WOOL)));
|
||||||
|
|
||||||
resultList.add(new MaterialInfo("gourd", blockState -> blockState.getMaterial() == Material.GOURD));
|
// Block Materials were removed in 1.20 in favor of block tags
|
||||||
resultList.add(new MaterialInfo("plant", blockState -> blockState.getMaterial() == Material.PLANT || blockState.getMaterial() == Material.REPLACEABLE_PLANT));
|
resultList.add(new MaterialInfo("gourd", blockState -> blockState.isOf(Blocks.MELON) || blockState.isOf(Blocks.PUMPKIN) || blockState.isOf(Blocks.JACK_O_LANTERN)));
|
||||||
|
// 'sword_efficient' tag is for all plants, and includes everything from the old PLANT and REPLACEABLE_PLANT materials (see https://minecraft.fandom.com/wiki/Tag#Blocks)
|
||||||
|
resultList.add(new MaterialInfo("plant", blockState -> blockState.isIn(BlockTags.SWORD_EFFICIENT)));
|
||||||
|
|
||||||
HashSet<String> uniqueMaterialNames = new HashSet<>();
|
HashSet<String> uniqueMaterialNames = new HashSet<>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user