Skip to content

Commit 82c80ac

Browse files
committed
Multiblock handling improvements, QoL updates
1 parent 4a96970 commit 82c80ac

30 files changed

+115
-114
lines changed

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ dependencies {
111111
transitive = false
112112
}
113113

114-
implementation fg.deobf("dev.latvian.mods:kubejs-forge:${kubejs_version}")
115-
implementation fg.deobf("dev.latvian.mods:rhino-forge:${rhino_version}")
116-
implementation fg.deobf("dev.architectury:architectury-forge:${architectury_version}")
114+
compileOnly fg.deobf("dev.latvian.mods:kubejs-forge:${kubejs_version}")
115+
compileOnly fg.deobf("dev.latvian.mods:rhino-forge:${rhino_version}")
116+
compileOnly fg.deobf("dev.architectury:architectury-forge:${architectury_version}")
117117
//implementation fg.deobf("curse.maven:ftb-library-forge-404465:5282375")
118118
//implementation fg.deobf("curse.maven:ftb-teams-forge-404468:5267190")
119119
//implementation fg.deobf("curse.maven:ftb-chunks-forge-314906:5267364")
@@ -124,7 +124,7 @@ dependencies {
124124
compileOnly fg.deobf("curse.maven:emi-580555:5872526")
125125

126126
implementation fg.deobf("mekanism:Mekanism:${mc_version}-${mekanism_version}")
127-
implementation fg.deobf("mekanism:Mekanism:${mc_version}-${mekanism_version}:generators")
127+
compileOnly fg.deobf("mekanism:Mekanism:${mc_version}-${mekanism_version}:generators")
128128
//compileOnly fg.deobf("mekanism:Mekanism:${mc_version}-${mekanism_version}:api")
129129

130130
compileOnly("cc.tweaked:cc-tweaked-${mc_version}-core-api:${cc_version}")

src/generated/resources/assets/nuclearcraft/lang/en_us.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,6 +2160,10 @@
21602160
"speed.multiplier": "Speed Multiplier: x%s",
21612161
"speed.parallel_processing": "Parallel processing: x%s",
21622162
"tooltip.active_heatsink": "Needs coolant fluid supply into reactor to work.",
2163+
"tooltip.kugelblitz.block_event_horizon_stabilizer": "Helps to stabilize blackhole",
2164+
"tooltip.kugelblitz.block_neutronium_frame": "Casing block of Kugelblitz Chamber",
2165+
"tooltip.kugelblitz.block_quantum_flux_regulator": "Increases FE generation of Kugelblitz Chamber",
2166+
"tooltip.kugelblitz.block_quantum_transformer": "Increases Quantum Transformation rate of Kugelblitz Chamber",
21632167
"tooltip.kugelblitz.flux_regulators": "Flux Regulators: %s",
21642168
"tooltip.kugelblitz.photon_concentrator": "Concentrates photons into a single point. \n Need to be placed at center of all 6 chamber walls.",
21652169
"tooltip.kugelblitz.ready_for_burst": "Ready for Laser Burst",

src/main/java/igentuman/nc/block/MultiblockBlock.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ public boolean skipRendering(@NotNull BlockState state, @NotNull BlockState adja
3939

4040
@Override
4141
public void onNeighborChange(BlockState state, LevelReader level, BlockPos pos, BlockPos neighbor){
42-
MultiblockHandler.trackBlockChange(neighbor);
42+
MultiblockHandler.instance.trackBlockChange(neighbor);
4343
}
4444

4545
@Override
4646
public void onPlace(BlockState pState, Level pLevel, BlockPos pPos, BlockState pOldState, boolean pMovedByPiston) {
4747
super.onPlace(pState, pLevel, pPos, pOldState, pMovedByPiston);
48-
MultiblockHandler.trackBlockChange(pPos);
48+
MultiblockHandler.instance.trackBlockChange(pPos);
4949
}
5050

5151
@Override
5252
public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) {
5353
super.onRemove(state, level, pos, newState, isMoving);
54-
MultiblockHandler.trackBlockChange(pos);
54+
MultiblockHandler.instance.trackBlockChange(pos);
5555
}
5656

5757
@Override

src/main/java/igentuman/nc/block/entity/MultiblockControllerBE.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import net.minecraftforge.common.util.LazyOptional;
1616
import net.minecraftforge.energy.IEnergyStorage;
1717

18+
import static igentuman.nc.NuclearCraft.debugLog;
19+
1820
public class MultiblockControllerBE extends NuclearCraftBE implements MultiblockAttachable<AbstractNCMultiblock, MultiblockControllerBE> {
1921

2022
@NBTField
@@ -124,12 +126,26 @@ public void load(CompoundTag tag) {
124126
}
125127
}
126128

129+
@Override
130+
public void setRemoved() {
131+
super.setRemoved();
132+
if(getLevel().isClientSide()) {
133+
return;
134+
}
135+
if(getMultiblock() != null) {
136+
getMultiblock().onControllerRemoved();
137+
}
138+
}
139+
127140
@Override
128141
public void setChanged() {
142+
MultiblockHandler.instance.addIgnoreToUpdate(getBlockPos());
143+
if(!MultiblockHandler.instance.ignoreUpdate.contains(getBlockPos().asLong())) {
144+
debugLog("failed to suppress update for " + getBlockPos());
145+
}
129146
super.setChanged();
130147
wasUpdated = true;
131148
changed = true;
132-
MultiblockHandler.addIgnoreToUpdate(getBlockPos());
133149
}
134150

135151
@Override

src/main/java/igentuman/nc/block/entity/fission/FissionControllerBE.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -472,16 +472,6 @@ private void handleMeltdown() {
472472

473473
}
474474

475-
public void setRemoved() {
476-
super.setRemoved();
477-
if(getLevel().isClientSide()) {
478-
return;
479-
}
480-
if(getMultiblock() != null) {
481-
getMultiblock().onControllerRemoved();
482-
}
483-
}
484-
485475
private boolean coolDown() {
486476
double wasHeat = heat;
487477
heat -= coolingPerTick();

src/main/java/igentuman/nc/block/entity/fission/FissionPortBE.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void tickServer() {
9696
}
9797

9898
if (updated) {
99-
MultiblockHandler.addIgnoreToUpdate(getBlockPos());
99+
MultiblockHandler.instance.addIgnoreToUpdate(getBlockPos());
100100
setChanged();
101101
level.sendBlockUpdated(worldPosition, getBlockState(), getBlockState(), Block.UPDATE_NEIGHBORS);
102102
}

src/main/java/igentuman/nc/block/entity/fusion/FusionCoreProxyBE.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public void tickServer()
8787

8888
if(wasSignal != core.analogSignal) {
8989
wasSignal = core.analogSignal;
90-
MultiblockHandler.addIgnoreToUpdate(getBlockPos());
90+
MultiblockHandler.instance.addIgnoreToUpdate(getBlockPos());
9191
setChanged();
9292
level.updateNeighbourForOutputSignal(worldPosition, getBlockState().getBlock());
9393
}

src/main/java/igentuman/nc/block/entity/kugelblitz/ChamberPortBE.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public void tickServer() {
100100
}
101101

102102
if(updated) {
103-
MultiblockHandler.addIgnoreToUpdate(getBlockPos());
103+
MultiblockHandler.instance.addIgnoreToUpdate(getBlockPos());
104104
setChanged();
105105
level.sendBlockUpdated(worldPosition, getBlockState(), getBlockState(), Block.UPDATE_ALL);
106106
}
@@ -240,7 +240,7 @@ public void toggleComparatorMode() {
240240
if(comparatorMode > SignalSource.TRANSFORMATION_ENERGY_RATE) {
241241
comparatorMode = SignalSource.ENERGY;
242242
}
243-
MultiblockHandler.addIgnoreToUpdate(getBlockPos());
243+
MultiblockHandler.instance.addIgnoreToUpdate(getBlockPos());
244244
setChanged();
245245
level.sendBlockUpdated(worldPosition, getBlockState(), getBlockState(), Block.UPDATE_ALL);
246246
}

src/main/java/igentuman/nc/block/entity/kugelblitz/ChamberTerminalBE.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ public ChamberTerminalBE(BlockPos pPos, BlockState pBlockState) {
9696
super(KUGELBLITZ_BE.get(NAME).get(), pPos, pBlockState);
9797
energyStorage = createEnergy();
9898
energy = LazyOptional.of(() -> energyStorage);
99-
multiblock = new KugelblitzMultiblock(this);
10099
contentHandler = new SidedContentHandler(
101100
1, 1,
102101
1, 0, 1000);
@@ -199,7 +198,7 @@ public void handleSliderUpdate(int buttonId, int ratio) {
199198
}
200199
}
201200
setChanged();
202-
MultiblockHandler.addIgnoreToUpdate(getBlockPos());
201+
MultiblockHandler.instance.addIgnoreToUpdate(getBlockPos());
203202
level.sendBlockUpdated(worldPosition, getBlockState(), getBlockState().setValue(POWERED, controllerEnabled), Block.UPDATE_ALL);
204203
level.setBlockAndUpdate(worldPosition, getBlockState().setValue(POWERED, controllerEnabled));
205204
}
@@ -228,7 +227,7 @@ public void tickServer() {
228227
if (controllerEnabled) {
229228
trackChanges(contentHandler().tick());
230229
long wasMass = mass;
231-
updateBlackholeMass();
230+
updateBlackhole();
232231
trackChanges(false, wasMass != mass);
233232
handleMeltdown();
234233
trackChanges(processRecipe());
@@ -243,7 +242,7 @@ public void tickServer() {
243242
}
244243
if(refreshCacheFlag || changed) {
245244
try {
246-
MultiblockHandler.addIgnoreToUpdate(getBlockPos());
245+
MultiblockHandler.instance.addIgnoreToUpdate(getBlockPos());
247246
level.sendBlockUpdated(worldPosition, getBlockState(), getBlockState().setValue(POWERED, controllerEnabled), Block.UPDATE_ALL);
248247
level.setBlockAndUpdate(worldPosition, getBlockState().setValue(POWERED, controllerEnabled));
249248
} catch (NullPointerException ignored) {}
@@ -265,7 +264,7 @@ public boolean hasBlackhole() {
265264
return false;
266265
}
267266

268-
private void updateBlackholeMass()
267+
private void updateBlackhole()
269268
{
270269
if (!hasBlackhole()) {
271270
mass = 0;
@@ -291,7 +290,7 @@ private void updateBlackholeStability() {
291290
return;
292291
}
293292

294-
if(getLevel().random.nextInt(256) < getMultiblock().stabilizers()) {
293+
if(getLevel().getGameTime() % 2 == 0 || getLevel().random.nextInt(128) < getMultiblock().stabilizers()) {
295294
return;
296295
}
297296

@@ -300,7 +299,7 @@ private void updateBlackholeStability() {
300299
return;
301300
}
302301

303-
double massRange = MAX_MASS - MIN_MASS;
302+
double massRange = MAX_MASS - MIN_MASS*5;
304303
double normalizedMass = (mass - MIN_MASS) / massRange;
305304
double distanceFromOptimal = Math.abs(normalizedMass - 0.5) * 2.0;
306305

src/main/java/igentuman/nc/block/entity/processor/IrradiatorBE.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void processRecipe() {
113113
@Deprecated
114114
public void upadteMultiblockConnection()
115115
{
116-
AbstractNCMultiblock mb = MultiblockHandler.getMultiblockByPos(getBlockPos());
116+
AbstractNCMultiblock mb = MultiblockHandler.instance.getMultiblockByPos(getBlockPos());
117117
if(mb != null) {
118118
if(mb.isFormed()) {
119119
if(mb.controller() != null) {

0 commit comments

Comments
 (0)