Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Liyan Zhao <[email protected]>
  • Loading branch information
zly2006 committed Jan 31, 2024
1 parent 76e40bb commit 86303ae
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ plugins {
id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.20'
id 'me.fallenbreath.yamlang' version '1.3.0'
id "com.jfrog.artifactory" version "5.1.10"
id 'com.github.johnrengelman.shadow' version '8.1.1'
}

ext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(EntityPlayerActionPack.class)
@Mixin(value = EntityPlayerActionPack.class, remap = false)
public class MixinEntityPlayerActionPack implements IEntityPlayerActionPack {
@Unique
boolean isNetworkPhase = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.zly2006.reden.rvc.gui.SelectionListScreenKt;
import com.github.zly2006.reden.rvc.tracking.WorldInfo;
import com.github.zly2006.reden.utils.UtilsKt;
import net.minecraft.block.BlockState;
import net.minecraft.client.MinecraftClient;
import net.minecraft.util.math.BlockPos;
Expand Down Expand Up @@ -29,14 +30,15 @@ public abstract class MixinWorldChunk {
)
private void onBlockChanged(BlockPos pos, BlockState state, boolean moved, CallbackInfoReturnable<BlockState> cir) {
//todo
if (world.isClient) {
if (UtilsKt.isClient()) {
var repo = SelectionListScreenKt.getSelectedRepository();
if (repo == null) return;
if (repo.getPlacementInfo() == null) return;
WorldInfo worldInfo = WorldInfo.Companion.getWorldInfo(MinecraftClient.getInstance());
if (!worldInfo.equals(repo.getPlacementInfo().getWorldInfo())) return;

var structure = repo.head();
if (structure.world == null || structure.world != world) return;
if (structure.isInArea(structure.getRelativeCoordinate(pos))) {
if (state.isAir()) {
structure.onBlockRemoved(pos);
Expand All @@ -46,6 +48,7 @@ private void onBlockChanged(BlockPos pos, BlockState state, boolean moved, Callb
} else if (Arrays.stream(Direction.values()).anyMatch(dir -> structure.isInArea(structure.getRelativeCoordinate(pos.offset(dir))))) {
structure.onBlockAdded(pos);
}
structure.refreshPositions();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ object BlockOutline {
val mc = MinecraftClient.getInstance()
val renderManager = mc.blockRenderManager
val random = Random.create()
blocks.forEach { (pos, state) ->
synchronized(blocks) {
// Note: ConcurrentModificationException
blocks.toList()
}.forEach { (pos, state) ->
if (state.fluidState != null) {
renderManager.renderFluid(
pos,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,8 @@ class TrackedStructure(

fun onBlockRemoved(pos: BlockPos) {
dirty = true
val trackPoint = trackPoints.find { it.pos == pos }
if (trackPoint != null) {
trackPoints.remove(trackPoint)
}
removeTrackpoint(pos)
cachedPositions -= pos
}

init {
Expand Down Expand Up @@ -482,7 +480,7 @@ class TrackedStructure(
val existing = trackPoints.find { it.pos == pos }
if (existing != null) {
cachedPositions.entries.removeIf { it.value == existing }
trackPoints.remove(existing)
trackPoints -= existing
}
}

Expand Down

0 comments on commit 86303ae

Please sign in to comment.