This commit is contained in:
Ben Kerllenevich
2021-11-25 09:03:05 -05:00
parent a7f145d54c
commit 708c0d05bf
6 changed files with 28 additions and 26 deletions

View File

@@ -30,7 +30,7 @@ index 20444c6887cbdd444b23bf018a6d63f22359e5e7..68321b5e425c0500a5691f8020317612
public static final Item CHEST = registerBlock(Blocks.CHEST, CreativeModeTab.TAB_DECORATIONS);
public static final Item CRAFTING_TABLE = registerBlock(Blocks.CRAFTING_TABLE, CreativeModeTab.TAB_DECORATIONS);
diff --git a/src/main/java/net/minecraft/world/level/block/SpawnerBlock.java b/src/main/java/net/minecraft/world/level/block/SpawnerBlock.java
index 130ffb06b12565efb35afb55b6da20b1b16f6f06..f59883d2b08ff18fd4b7e342f4d899cf08c2ec0f 100644
index 130ffb06b12565efb35afb55b6da20b1b16f6f06..bc4646a7a72c33a3671115953a2bbd7cfe5d7d92 100644
--- a/src/main/java/net/minecraft/world/level/block/SpawnerBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SpawnerBlock.java
@@ -1,9 +1,19 @@
@@ -53,7 +53,7 @@ index 130ffb06b12565efb35afb55b6da20b1b16f6f06..f59883d2b08ff18fd4b7e342f4d899cf
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
@@ -13,6 +23,19 @@ import net.minecraft.world.level.block.entity.SpawnerBlockEntity;
@@ -13,6 +23,20 @@ import net.minecraft.world.level.block.entity.SpawnerBlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
@@ -66,6 +66,7 @@ index 130ffb06b12565efb35afb55b6da20b1b16f6f06..f59883d2b08ff18fd4b7e342f4d899cf
+
+import java.util.List;
+import java.util.Locale;
+import java.util.Optional;
+
+import static net.kyori.adventure.text.format.TextDecoration.ITALIC;
+// Purpur end
@@ -73,7 +74,7 @@ index 130ffb06b12565efb35afb55b6da20b1b16f6f06..f59883d2b08ff18fd4b7e342f4d899cf
public class SpawnerBlock extends BaseEntityBlock {
protected SpawnerBlock(BlockBehaviour.Properties settings) {
@@ -30,6 +53,55 @@ public class SpawnerBlock extends BaseEntityBlock {
@@ -30,6 +54,55 @@ public class SpawnerBlock extends BaseEntityBlock {
return createTickerHelper(type, BlockEntityType.MOB_SPAWNER, world.isClientSide ? SpawnerBlockEntity::clientTick : SpawnerBlockEntity::serverTick);
}
@@ -81,9 +82,9 @@ index 130ffb06b12565efb35afb55b6da20b1b16f6f06..f59883d2b08ff18fd4b7e342f4d899cf
+ @Override
+ public void playerDestroy(Level level, Player player, BlockPos pos, BlockState state, BlockEntity blockEntity, ItemStack stack) {
+ if (level.purpurConfig.silkTouchEnabled && player.getBukkitEntity().hasPermission("purpur.drop.spawners") && isSilkTouch(level, stack)) {
+ ResourceLocation type = ((SpawnerBlockEntity) blockEntity).getSpawner().getEntityId(level, pos);
+ if (type != null) {
+ final Component mobName = PaperAdventure.asAdventure(EntityType.getFromKey(type).getDescription());
+ Optional<EntityType<?>> type = EntityType.by(((SpawnerBlockEntity) blockEntity).getSpawner().nextSpawnData.getEntityToSpawn());
+ if (type.isPresent()) {
+ final Component mobName = PaperAdventure.asAdventure(type.get().getDescription());
+ CompoundTag display = new CompoundTag();
+ CompoundTag tag = new CompoundTag();
+
@@ -112,7 +113,7 @@ index 130ffb06b12565efb35afb55b6da20b1b16f6f06..f59883d2b08ff18fd4b7e342f4d899cf
+ }
+
+ ItemStack item = new ItemStack(Blocks.SPAWNER.asItem());
+ tag.putString("Purpur.mob_type", type.toString());
+ tag.putString("Purpur.mob_type", type.get().getName());
+ item.setTag(tag);
+
+ popResource(level, pos, item);
@@ -129,7 +130,7 @@ index 130ffb06b12565efb35afb55b6da20b1b16f6f06..f59883d2b08ff18fd4b7e342f4d899cf
@Override
public void spawnAfterBreak(BlockState state, ServerLevel world, BlockPos pos, ItemStack stack) {
super.spawnAfterBreak(state, world, pos, stack);
@@ -38,6 +110,7 @@ public class SpawnerBlock extends BaseEntityBlock {
@@ -38,6 +111,7 @@ public class SpawnerBlock extends BaseEntityBlock {
@Override
public int getExpDrop(BlockState iblockdata, ServerLevel worldserver, BlockPos blockposition, ItemStack itemstack) {