More Lidded Block API

This commit is contained in:
LemonCaramel 2021-05-23 17:49:51 +09:00
parent f61b2947ad
commit cd9caecbde
4 changed files with 29 additions and 1 deletions

View file

@ -73,4 +73,11 @@ public class CraftBarrel extends CraftLootable<BarrelBlockEntity> implements Bar
public CraftBarrel copy(Location location) {
return new CraftBarrel(this, location);
}
// Paper start - More Lidded Block API
@Override
public boolean isOpen() {
return getTileEntity().openersCounter.opened;
}
// Paper end - More Lidded Block API
}

View file

@ -92,4 +92,11 @@ public class CraftChest extends CraftLootable<ChestBlockEntity> implements Chest
public CraftChest copy(Location location) {
return new CraftChest(this, location);
}
// Paper start - More Lidded Block API
@Override
public boolean isOpen() {
return getTileEntity().openersCounter.opened;
}
// Paper end - More Lidded Block API
}

View file

@ -51,4 +51,11 @@ public class CraftEnderChest extends CraftBlockEntityState<EnderChestBlockEntity
public CraftEnderChest copy(Location location) {
return new CraftEnderChest(this, location);
}
// Paper start - More Lidded Block API
@Override
public boolean isOpen() {
return getTileEntity().openersCounter.opened;
}
// Paper end - More Lidded Block API
}

View file

@ -59,7 +59,7 @@ public class CraftShulkerBox extends CraftLootable<ShulkerBoxBlockEntity> implem
if (this.getTileEntity().opened && this.getWorldHandle() instanceof net.minecraft.world.level.Level) {
net.minecraft.world.level.Level world = this.getTileEntity().getLevel();
world.blockEvent(this.getPosition(), this.getTileEntity().getBlockState().getBlock(), 1, 0);
world.playSound(null, this.getPosition(), SoundEvents.SHULKER_BOX_OPEN, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
world.playSound(null, this.getPosition(), SoundEvents.SHULKER_BOX_CLOSE, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F); // Paper - More Lidded Block API (Wrong sound)
}
this.getTileEntity().opened = false;
}
@ -73,4 +73,11 @@ public class CraftShulkerBox extends CraftLootable<ShulkerBoxBlockEntity> implem
public CraftShulkerBox copy(Location location) {
return new CraftShulkerBox(this, location);
}
// Paper start - More Lidded Block API
@Override
public boolean isOpen() {
return getTileEntity().opened;
}
// Paper end - More Lidded Block API
}