Skip to content

Instantly share code, notes, and snippets.

@noobanidus
Last active August 27, 2020 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noobanidus/3528e99e64ebe3de9e8cf8a81fe54961 to your computer and use it in GitHub Desktop.
Save noobanidus/3528e99e64ebe3de9e8cf8a81fe54961 to your computer and use it in GitHub Desktop.
diff --git a/src/main/java/vazkii/quark/world/gen/structure/processor/BigDungeonChestProcessor.java b/src/main/java/vazkii/quark/world/gen/structure/processor/BigDungeonChestProcessor.java
index 772b0668..79da083a 100644
--- a/src/main/java/vazkii/quark/world/gen/structure/processor/BigDungeonChestProcessor.java
+++ b/src/main/java/vazkii/quark/world/gen/structure/processor/BigDungeonChestProcessor.java
@@ -34,25 +34,17 @@ public class BigDungeonChestProcessor extends StructureProcessor {
public BigDungeonChestProcessor(Dynamic<?> dyn) {
this();
}
-
+
@Override
public BlockInfo process(IWorldReader worldReaderIn, BlockPos pos, BlockInfo p_215194_3_, BlockInfo blockInfo, PlacementSettings placementSettingsIn, Template template) {
if(blockInfo.state.getBlock() instanceof ChestBlock) {
Random rand = placementSettingsIn.getRandom(blockInfo.pos);
if(rand.nextDouble() > BigDungeonModule.chestChance)
return new BlockInfo(blockInfo.pos, Blocks.CAVE_AIR.getDefaultState(), new CompoundNBT());
-
- TileEntity tile = TileEntity.create(blockInfo.nbt);
- if(tile instanceof ChestTileEntity) {
- ChestTileEntity chest = (ChestTileEntity) tile;
- chest.setLootTable(null, 0);
- for(int i = 0; i < chest.getSizeInventory(); i++)
- chest.setInventorySlotContents(i, ItemStack.EMPTY);
-
- chest.setLootTable(new ResourceLocation(BigDungeonModule.lootTable), rand.nextLong());
- CompoundNBT nbt = new CompoundNBT();
- chest.write(nbt);
- return new BlockInfo(blockInfo.pos, blockInfo.state, nbt);
+ if (blockInfo.nbt.getString("id").equals("minecraft:chest")) {
+ blockInfo.nbt.putString("LootTable", BigDungeonModule.lootTable);
+ blockInfo.nbt.putLong("LootTableSeed", rand.nextLong());
+ return new BlockInfo(blockInfo.pos, blockInfo.state, blockInfo.nbt);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment