This commit is contained in:
		| @@ -19,12 +19,9 @@ import net.minecraft.block.Block; | ||||
| import net.minecraft.block.Blocks; | ||||
| import net.minecraft.item.Item; | ||||
| import net.minecraft.loot.LootPool; | ||||
| import net.minecraft.loot.LootTable; | ||||
| import net.minecraft.loot.condition.SurvivesExplosionLootCondition; | ||||
| import net.minecraft.loot.entry.ItemEntry; | ||||
| import net.minecraft.loot.entry.LeafEntry.Builder; | ||||
| import net.minecraft.registry.Registry; | ||||
| import net.minecraft.registry.RegistryKey; | ||||
|  | ||||
| /** | ||||
|  * | ||||
| @@ -43,18 +40,17 @@ public class Quickiemod implements ModInitializer { | ||||
| 	} | ||||
|  | ||||
| 	private void registerLootTableChanges() { | ||||
| 		// does not work yet | ||||
| 		// does not work yet right | ||||
| 		LootTableEvents.MODIFY.register((key, tableBuilder, source, registries) -> { | ||||
| 			if (Blocks.SHORT_GRASS.equals(key)) { | ||||
| 				Builder<?> entry = ItemEntry.builder(ModItems.ITEM_COTTON); | ||||
| 				LootPool.Builder poolBuilder = LootPool.builder().with(entry) | ||||
| 						.conditionally(SurvivesExplosionLootCondition.builder()); | ||||
| 				tableBuilder.pool(poolBuilder); | ||||
| 			} else if (Blocks.TALL_GRASS.getLootTableKey().equals(key)) { | ||||
| 				Builder<?> entry = ItemEntry.builder(ModItems.ITEM_CANOLA); | ||||
| 				LootPool.Builder poolBuilder = LootPool.builder().with(entry) | ||||
| 						.conditionally(SurvivesExplosionLootCondition.builder()); | ||||
| 				tableBuilder.pool(poolBuilder); | ||||
| 			if (source.isBuiltin()) { | ||||
| 				if (Blocks.SHORT_GRASS.getLootTableKey().get().getRegistry().equals(key.getRegistry())) { | ||||
| 					tableBuilder.pool(LootPool.builder().with(ItemEntry.builder(ModItems.ITEM_COTTONSEED)) | ||||
| 							.conditionally(SurvivesExplosionLootCondition.builder())); | ||||
| 				} | ||||
| 				if (Blocks.TALL_GRASS.getLootTableKey().get().getRegistry().equals(key.getRegistry())) { | ||||
| 					tableBuilder.pool(LootPool.builder().with(ItemEntry.builder(ModItems.ITEM_CANOLASEED)) | ||||
| 							.conditionally(SurvivesExplosionLootCondition.builder())); | ||||
| 				} | ||||
| 			} | ||||
| 		}); | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user