mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 04:53:43 +01:00
Move event invocation in case transferAll gets re-used
This commit is contained in:
parent
c86c10f1b1
commit
ee33858ddc
2 changed files with 3 additions and 3 deletions
|
@ -19,7 +19,6 @@ import java.util.stream.Collectors;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.api.event.TrackGraphMergeEvent;
|
|
||||||
import com.simibubi.create.content.logistics.trains.TrackNodeLocation.DiscoveredLocation;
|
import com.simibubi.create.content.logistics.trains.TrackNodeLocation.DiscoveredLocation;
|
||||||
import com.simibubi.create.content.logistics.trains.entity.Train;
|
import com.simibubi.create.content.logistics.trains.entity.Train;
|
||||||
import com.simibubi.create.content.logistics.trains.management.edgePoint.EdgeData;
|
import com.simibubi.create.content.logistics.trains.management.edgePoint.EdgeData;
|
||||||
|
@ -42,7 +41,6 @@ import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
import net.minecraft.world.level.LevelAccessor;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
|
|
||||||
public class TrackGraph {
|
public class TrackGraph {
|
||||||
|
|
||||||
|
@ -249,7 +247,6 @@ public class TrackGraph {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void transferAll(TrackGraph toOther) {
|
public void transferAll(TrackGraph toOther) {
|
||||||
MinecraftForge.EVENT_BUS.post(new TrackGraphMergeEvent(this, toOther));
|
|
||||||
nodes.forEach((loc, node) -> {
|
nodes.forEach((loc, node) -> {
|
||||||
if (toOther.addNodeIfAbsent(node))
|
if (toOther.addNodeIfAbsent(node))
|
||||||
Create.RAILWAYS.sync.nodeAdded(toOther, node);
|
Create.RAILWAYS.sync.nodeAdded(toOther, node);
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
|
import com.simibubi.create.api.event.TrackGraphMergeEvent;
|
||||||
import com.simibubi.create.content.logistics.trains.TrackNodeLocation.DiscoveredLocation;
|
import com.simibubi.create.content.logistics.trains.TrackNodeLocation.DiscoveredLocation;
|
||||||
import com.simibubi.create.content.logistics.trains.management.edgePoint.signal.SignalPropagator;
|
import com.simibubi.create.content.logistics.trains.management.edgePoint.signal.SignalPropagator;
|
||||||
|
|
||||||
|
@ -16,6 +17,7 @@ import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
import net.minecraft.world.level.LevelAccessor;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
public class TrackPropagator {
|
public class TrackPropagator {
|
||||||
|
|
||||||
|
@ -135,6 +137,7 @@ public class TrackPropagator {
|
||||||
if (graph == null)
|
if (graph == null)
|
||||||
graph = other;
|
graph = other;
|
||||||
else {
|
else {
|
||||||
|
MinecraftForge.EVENT_BUS.post(new TrackGraphMergeEvent(other, graph));
|
||||||
other.transferAll(graph);
|
other.transferAll(graph);
|
||||||
manager.removeGraphAndGroup(other);
|
manager.removeGraphAndGroup(other);
|
||||||
sync.graphRemoved(other);
|
sync.graphRemoved(other);
|
||||||
|
|
Loading…
Reference in a new issue