Merge 1.18.2

This commit is contained in:
simibubi 2022-03-23 19:46:49 +01:00
parent 9db9c3f710
commit 92e48c3307
4 changed files with 10 additions and 15 deletions

View file

@ -28,8 +28,8 @@
"trigger": "create:bracket_apply", "trigger": "create:bracket_apply",
"conditions": { "conditions": {
"accepted_entries": [ "accepted_entries": [
"create:large_cogwheel", "create:cogwheel",
"create:cogwheel" "create:large_cogwheel"
] ]
} }
}, },

View file

@ -18,7 +18,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
public class ControlsMovementBehaviour extends MovementBehaviour { public class ControlsMovementBehaviour implements MovementBehaviour {
// TODO: rendering the levers should be specific to Carriage Contraptions - // TODO: rendering the levers should be specific to Carriage Contraptions -
static class LeverAngles { static class LeverAngles {
@ -29,7 +29,7 @@ public class ControlsMovementBehaviour extends MovementBehaviour {
@Override @Override
public void tick(MovementContext context) { public void tick(MovementContext context) {
super.tick(context); MovementBehaviour.super.tick(context);
if (!context.world.isClientSide) if (!context.world.isClientSide)
return; return;
if (!(context.temporaryData instanceof LeverAngles)) if (!(context.temporaryData instanceof LeverAngles))

View file

@ -25,7 +25,6 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.Entity.RemovalReason; import net.minecraft.world.entity.Entity.RemovalReason;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
@ -175,14 +174,10 @@ public class Carriage {
this.entity = new WeakReference<>(cce); this.entity = new WeakReference<>(cce);
} }
public ChunkPos getChunk() {
return new ChunkPos(new BlockPos(positionAnchor));
}
public void manageEntity(Level level) { public void manageEntity(Level level) {
CarriageContraptionEntity entity = this.entity.get(); CarriageContraptionEntity entity = this.entity.get();
if (entity == null) { if (entity == null) {
if (CarriageEntityHandler.isActiveChunk(level, getChunk())) if (CarriageEntityHandler.isActiveChunk(level, new BlockPos(positionAnchor)))
createEntity(level); createEntity(level);
} else { } else {
CarriageEntityHandler.validateCarriageEntity(entity); CarriageEntityHandler.validateCarriageEntity(entity);

View file

@ -1,9 +1,9 @@
package com.simibubi.create.content.logistics.trains.entity; package com.simibubi.create.content.logistics.trains.entity;
import net.minecraft.core.BlockPos;
import net.minecraft.core.SectionPos; import net.minecraft.core.SectionPos;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraftforge.event.entity.EntityEvent; import net.minecraftforge.event.entity.EntityEvent;
@ -22,7 +22,7 @@ public class CarriageEntityHandler {
Level level = entity.getLevel(); Level level = entity.getLevel();
if (level.isClientSide) if (level.isClientSide)
return; return;
if (!isActiveChunk(level, newPos.chunk())) if (!isActiveChunk(level, newPos.center()))
cce.leftTickingChunks = true; cce.leftTickingChunks = true;
} }
@ -32,13 +32,13 @@ public class CarriageEntityHandler {
Level level = entity.getLevel(); Level level = entity.getLevel();
if (level.isClientSide) if (level.isClientSide)
return; return;
if (!isActiveChunk(level, entity.chunkPosition())) if (!isActiveChunk(level, entity.blockPosition()))
entity.leftTickingChunks = true; entity.leftTickingChunks = true;
} }
public static boolean isActiveChunk(Level level, ChunkPos chunk) { public static boolean isActiveChunk(Level level, BlockPos pos) {
if (level instanceof ServerLevel serverLevel) if (level instanceof ServerLevel serverLevel)
return serverLevel.isPositionEntityTicking(chunk); return serverLevel.isPositionEntityTicking(pos);
return false; return false;
} }