[Feature] Tool template for Spawners
This commit is contained in:
parent
f3ca586f8b
commit
f5cb606ee5
1 changed files with 17 additions and 4 deletions
|
@ -31,10 +31,7 @@ import net.minecraft.world.item.context.UseOnContext;
|
|||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.JigsawBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.JigsawBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.StructureBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.*;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;
|
||||
|
||||
|
@ -241,6 +238,22 @@ public class DebugDataItem extends Item implements ItemModelProvider, AirSelecti
|
|||
);
|
||||
}
|
||||
|
||||
public static DebugDataItem forSpawner(CompoundTag tag, Item icon) {
|
||||
ResourceLocation iconId = BuiltInRegistries.ITEM.getKey(icon);
|
||||
return new DebugDataItem(
|
||||
(player, entity, ctx) -> {
|
||||
if (entity instanceof SpawnerBlockEntity) {
|
||||
entity.load(tag);
|
||||
message(player, "Did set Data to " + tag.toString());
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
return InteractionResult.FAIL;
|
||||
},
|
||||
false,
|
||||
iconId
|
||||
);
|
||||
}
|
||||
|
||||
public static DebugDataItem forSteetJigSaw(
|
||||
String modID,
|
||||
ResourceKey<StructureTemplatePool> pool,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue