Skip to content

Commit

Permalink
Check for silk touch/shears on enlightened bushes
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSpen210 committed Dec 26, 2019
1 parent 974a5c6 commit c4405ff
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 26 deletions.
Expand Up @@ -55,26 +55,18 @@ private void addIf(String pulseID, Runnable registrar) {

private LootTable.Builder droppingWithNameAndTexture(Block block) {
return LootTable.builder()
.addLootPool(withSurvivesExplosion(block, LootPool.builder()
.addEntry(ItemLootEntry.builder(block)
.acceptFunction(CopyName.builder(CopyName.Source.BLOCK_ENTITY))
.acceptFunction(FillTexturedBlockLootFunction::new)
)));
}

private LootTable.Builder droppingWithTexture(Block block) {
return LootTable.builder()
.addLootPool(withSurvivesExplosion(block, LootPool.builder()
.addEntry(ItemLootEntry.builder(block)
.acceptFunction(FillTexturedBlockLootFunction::new)
)));
.addLootPool(withSurvivesExplosion(block, LootPool.builder()
.addEntry(ItemLootEntry.builder(block)
.acceptFunction(CopyName.builder(CopyName.Source.BLOCK_ENTITY))
.acceptFunction(FillTexturedBlockLootFunction::new)
)));
}

private void registerRedirect(Block block, Block originalBlock) {
this.registerLootTable(block, LootTable.builder()
.addLootPool(LootPool.builder()
.addEntry(TableLootEntry.builder(originalBlock.getLootTable()))
));
.addLootPool(LootPool.builder()
.addEntry(TableLootEntry.builder(originalBlock.getLootTable()))
));
}

private void addBuilding() {
Expand All @@ -83,10 +75,10 @@ private void addBuilding() {
this.registerLootTable(InspirationsBuilding.shelf_ancient, this::droppingWithNameAndTexture);
this.registerLootTable(InspirationsBuilding.shelf_tomes, this::droppingWithNameAndTexture);

this.registerLootTable(InspirationsBuilding.whiteEnlightenedBush, this::droppingWithTexture);
this.registerLootTable(InspirationsBuilding.redEnlightenedBush, this::droppingWithTexture);
this.registerLootTable(InspirationsBuilding.greenEnlightenedBush, this::droppingWithTexture);
this.registerLootTable(InspirationsBuilding.blueEnlightenedBush, this::droppingWithTexture);
this.registerLootTable(InspirationsBuilding.whiteEnlightenedBush, this::enlightenedBush);
this.registerLootTable(InspirationsBuilding.redEnlightenedBush, this::enlightenedBush);
this.registerLootTable(InspirationsBuilding.greenEnlightenedBush, this::enlightenedBush);
this.registerLootTable(InspirationsBuilding.blueEnlightenedBush, this::enlightenedBush);

this.registerDropSelfLootTable(InspirationsBuilding.plainMulch);
this.registerDropSelfLootTable(InspirationsBuilding.blackMulch);
Expand Down Expand Up @@ -131,7 +123,16 @@ private LootTable.Builder rope(Block block) {
));
}


private LootTable.Builder enlightenedBush(Block bush) {
return LootTable.builder()
// No explosion check, since that's not going to pass a
// tool check.
.addLootPool(LootPool.builder()
.addEntry(ItemLootEntry.builder(bush)
.acceptFunction(FillTexturedBlockLootFunction::new))
.acceptCondition(SILK_TOUCH_OR_SHEARS)
);
}

private void addTools() {
// func_218482 = droppingNothing()
Expand Down Expand Up @@ -163,12 +164,12 @@ private void addUtility() {
// We don't use these values.
Item carpet = trapdoor.getPickBlock(null, null, null, null, null).getItem();
this.registerLootTable(trapdoor, LootTable.builder()
.addLootPool(withExplosionDecay(trapdoor, LootPool.builder()
.addEntry(ItemLootEntry.builder(Items.STONE_PRESSURE_PLATE))
))
.addLootPool(withExplosionDecay(carpet, LootPool.builder()
.addLootPool(withSurvivesExplosion(trapdoor, LootPool.builder()
.addEntry(ItemLootEntry.builder(carpet))
))
.addLootPool(withSurvivesExplosion(carpet, LootPool.builder()
.addEntry(ItemLootEntry.builder(Items.STONE_PRESSURE_PLATE))
))
);
}

Expand Down
9 changes: 8 additions & 1 deletion src/main/resources/META-INF/accesstransformer.cfg
Expand Up @@ -23,4 +23,11 @@ public net.minecraft.tileentity.LockableTileEntity field_174901_a # code
public net.minecraft.world.LockCode field_180161_b # lock

# Portal color
public net.minecraft.client.renderer.chunk.ChunkRenderCache field_212408_i # world
public net.minecraft.client.renderer.chunk.ChunkRenderCache field_212408_i # world

# Loot table constants.
protected net.minecraft.data.loot.BlockLootTables field_218573_a # SILK_TOUCH
protected net.minecraft.data.loot.BlockLootTables field_218574_b # NO_SILK_TOUCH
protected net.minecraft.data.loot.BlockLootTables field_218575_c # SHEARS
protected net.minecraft.data.loot.BlockLootTables field_218576_d # SILK_TOUCH_OR_SHEARS
protected net.minecraft.data.loot.BlockLootTables field_218577_e # NOT_SILK_TOUCH_OR_SHEARS

0 comments on commit c4405ff

Please sign in to comment.