mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
Fix Schematicannon rail placement crash
This commit is contained in:
parent
c5a3306d56
commit
0a9c10a13d
1 changed files with 11 additions and 8 deletions
|
@ -11,6 +11,7 @@ import com.simibubi.create.content.contraptions.components.actors.SeatBlock;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
|
import net.minecraft.core.SectionPos;
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
@ -194,17 +195,19 @@ public class BlockHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void placeRailWithoutUpdate(Level world, BlockState state, BlockPos target) {
|
private static void placeRailWithoutUpdate(Level world, BlockState state, BlockPos target) {
|
||||||
int i = target.getX() & 15;
|
|
||||||
int j = target.getY();
|
|
||||||
int k = target.getZ() & 15;
|
|
||||||
LevelChunk chunk = world.getChunkAt(target);
|
LevelChunk chunk = world.getChunkAt(target);
|
||||||
LevelChunkSection chunksection = chunk.getSections()[j >> 4];
|
int idx = chunk.getSectionIndex(target.getY());
|
||||||
|
LevelChunkSection chunksection = chunk.getSection(idx);
|
||||||
if (chunksection == null) {
|
if (chunksection == null) {
|
||||||
chunksection = new LevelChunkSection(j >> 4 << 4, world.registryAccess()
|
chunksection = new LevelChunkSection(chunk.getSectionYFromSectionIndex(idx),
|
||||||
.registryOrThrow(Registry.BIOME_REGISTRY));
|
world.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY));
|
||||||
chunk.getSections()[j >> 4] = chunksection;
|
chunk.getSections()[idx] = chunksection;
|
||||||
}
|
}
|
||||||
BlockState old = chunksection.setBlockState(i, j & 15, k, state);
|
BlockState old = chunksection.setBlockState(
|
||||||
|
SectionPos.sectionRelative(target.getX()),
|
||||||
|
SectionPos.sectionRelative(target.getY()),
|
||||||
|
SectionPos.sectionRelative(target.getZ()),
|
||||||
|
state);
|
||||||
chunk.setUnsaved(true);
|
chunk.setUnsaved(true);
|
||||||
world.markAndNotifyBlock(target, chunk, old, state, 82, 512);
|
world.markAndNotifyBlock(target, chunk, old, state, 82, 512);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue