|
8 | 8 | import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
9 | 9 | import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
10 | 10 |
|
| 11 | +import net.minecraftforge.api.distmarker.Dist; |
| 12 | +import net.minecraftforge.api.distmarker.OnlyIn; |
| 13 | +import net.minecraftforge.common.ForgeMod; |
| 14 | +import net.minecraftforge.fml.DistExecutor; |
| 15 | + |
11 | 16 | import net.minecraft.client.Minecraft;
|
12 | 17 | import net.minecraft.core.BlockPos;
|
13 | 18 | import net.minecraft.core.Direction;
|
|
23 | 28 | import net.minecraft.world.level.block.state.BlockState;
|
24 | 29 | import net.minecraft.world.phys.Vec3;
|
25 | 30 |
|
26 |
| -import net.minecraftforge.api.distmarker.Dist; |
27 |
| -import net.minecraftforge.api.distmarker.OnlyIn; |
28 |
| -import net.minecraftforge.common.ForgeMod; |
29 |
| -import net.minecraftforge.fml.DistExecutor; |
30 |
| - |
31 | 31 | public class LecternControllerBlockEntity extends SmartBlockEntity {
|
32 | 32 |
|
33 | 33 | private CompoundTag controllerNbt = new CompoundTag();
|
@@ -150,7 +150,7 @@ private void tryToggleActive() {
|
150 | 150 |
|
151 | 151 | public void setController(ItemStack newController) {
|
152 | 152 | if (newController != null) {
|
153 |
| - controllerNbt = newController.getTag(); |
| 153 | + controllerNbt = newController.getOrCreateTag(); |
154 | 154 | AllSoundEvents.CONTROLLER_PUT.playOnServer(level, worldPosition);
|
155 | 155 | }
|
156 | 156 | }
|
@@ -189,7 +189,7 @@ public static boolean playerInRange(Player player, Level world, BlockPos pos) {
|
189 | 189 |
|
190 | 190 | private ItemStack createLinkedController() {
|
191 | 191 | ItemStack stack = AllItems.LINKED_CONTROLLER.asStack();
|
192 |
| - stack.setTag(controllerNbt); |
| 192 | + stack.setTag(controllerNbt.copy()); |
193 | 193 | return stack;
|
194 | 194 | }
|
195 | 195 |
|
|
0 commit comments