* 1.20.1

* Removed commented code
This commit is contained in:
Mathias Elgaard
2023-09-04 11:53:21 +02:00
committed by GitHub
parent 83fca69075
commit b7af1a264f
3 changed files with 14 additions and 14 deletions
@@ -10,7 +10,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
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.registry.Registry;
import net.minecraft.registry.RegistryKeys;
@@ -48,12 +48,11 @@ public class BlocksDataGenerator implements IDataGenerator {
if (minecraftServer != null) {
//If we have local world context, we can actually evaluate loot tables and determine actual data
ServerWorld serverWorld = minecraftServer.getOverworld();
LootContext.Builder lootContext = new LootContext.Builder(serverWorld)
.parameter(LootContextParameters.BLOCK_STATE, blockState)
.parameter(LootContextParameters.ORIGIN, Vec3d.ZERO)
.parameter(LootContextParameters.TOOL, firstToolItem.getDefaultStack())
.random(0L);
outDrops.addAll(blockState.getDroppedStacks(lootContext));
LootContextParameterSet.Builder lootContextParameterSet = new LootContextParameterSet.Builder(serverWorld)
.add(LootContextParameters.BLOCK_STATE, blockState)
.add(LootContextParameters.ORIGIN, Vec3d.ZERO)
.add(LootContextParameters.TOOL, firstToolItem.getDefaultStack());
outDrops.addAll(blockState.getDroppedStacks(lootContextParameterSet));
} else {
//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();
@@ -10,7 +10,6 @@ import dev.u9g.minecraftdatagenerator.util.DGU;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.Material;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
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("wool", blockState -> blockState.isIn(BlockTags.WOOL)));
resultList.add(new MaterialInfo("gourd", blockState -> blockState.getMaterial() == Material.GOURD));
resultList.add(new MaterialInfo("plant", blockState -> blockState.getMaterial() == Material.PLANT || blockState.getMaterial() == Material.REPLACEABLE_PLANT));
// Block Materials were removed in 1.20 in favor of block tags
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<>();