Krypton infusion pedestal fix

This commit is contained in:
Necrontyr 2022-10-27 02:38:05 +02:00
parent ac96841372
commit 105f8cd862
3 changed files with 9 additions and 4 deletions

View file

@ -84,7 +84,7 @@ public class InfusionPedestal extends PedestalBlock {
BlockState blockState, BlockState blockState,
BlockEntityType<T> blockEntityType BlockEntityType<T> blockEntityType
) { ) {
return InfusionPedestalEntity::tickEnity; return InfusionPedestalEntity::tickEntity;
} }
static { static {

View file

@ -52,13 +52,15 @@ public class InfusionPedestalEntity extends PedestalBlockEntity {
protected void fromTag(CompoundTag tag) { protected void fromTag(CompoundTag tag) {
super.fromTag(tag); super.fromTag(tag);
if (tag.contains("ritual")) { if (tag.contains("ritual")) {
if (!hasRitual()) {
linkedRitual = new InfusionRitual(this, level, worldPosition); linkedRitual = new InfusionRitual(this, level, worldPosition);
}
linkedRitual.fromTag(tag.getCompound("ritual")); linkedRitual.fromTag(tag.getCompound("ritual"));
linkedRitual.configure(); linkedRitual.configure();
} }
} }
public static <T extends BlockEntity> void tickEnity( public static <T extends BlockEntity> void tickEntity(
Level level, Level level,
BlockPos blockPos, BlockPos blockPos,
BlockState blockState, BlockState blockState,

View file

@ -16,6 +16,7 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.chunk.LevelChunk.EntityCreationType;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import java.awt.*; import java.awt.*;
@ -56,7 +57,9 @@ public class InfusionRitual implements Container {
for (int i = 0; i < catalysts.length; i++) { for (int i = 0; i < catalysts.length; i++) {
Point point = PEDESTALS_MAP[i]; Point point = PEDESTALS_MAP[i];
MutableBlockPos checkPos = worldPos.mutable().move(Direction.EAST, point.x).move(Direction.NORTH, point.y); MutableBlockPos checkPos = worldPos.mutable().move(Direction.EAST, point.x).move(Direction.NORTH, point.y);
BlockEntity catalystEntity = world.getBlockEntity(checkPos); BlockEntity catalystEntity = world.isClientSide
? world.getChunkAt(checkPos).getBlockEntity(checkPos, EntityCreationType.CHECK)
: world.getBlockEntity(checkPos);
if (catalystEntity instanceof PedestalBlockEntity) { if (catalystEntity instanceof PedestalBlockEntity) {
catalysts[i] = (PedestalBlockEntity) catalystEntity; catalysts[i] = (PedestalBlockEntity) catalystEntity;
} else { } else {