Skip to content

Commit 0b944cf

Browse files
committed
Kugelblitz validation fixes
1 parent be8c29d commit 0b944cf

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,19 @@ public void tickClient() {
6363
false
6464
);
6565
//burst dragon breath particles in a sphere
66-
for (int i = 0; i < 20; i++) {
67-
float x = getBlockPos().getX() + 0.5F + level.random.nextFloat() + (level.random.nextBoolean() ? 2 : -2);
68-
float y = getBlockPos().getY() + 0.5F + level.random.nextFloat() + (level.random.nextBoolean() ? 2 : -2);
69-
float z = getBlockPos().getZ() + 0.5F + level.random.nextFloat() + (level.random.nextBoolean() ? 2 : -2);
66+
for (int i = 0; i < 80; i++) {
67+
float x = getBlockPos().getX() + 0.5F + randomDistance();
68+
float y = getBlockPos().getY() + 0.5F + randomDistance();
69+
float z = getBlockPos().getZ() + 0.5F + randomDistance();
7070
level.addParticle(ParticleTypes.DRAGON_BREATH, x, y, z, 0, 0, 0);
7171
}
7272
}
7373
}
7474

75+
private float randomDistance() {
76+
return level.random.nextFloat() + level.random.nextInt(8) - 4;
77+
}
78+
7579
public void tickServer() {
7680
if(isRemoved()) return;
7781
if (!isInitialized) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ private void updateEvaporation() {
289289
int wasEvaporation = evaporation;
290290
int rate = (int) Math.max(1, energyConvertionRate*Math.log(fluxRegulators));
291291
if (recipeInfo().recipe() != null && !recipeInfo().isCompleted()) {
292-
rate+= (int) ((100 - energyConvertionRate) * Math.log(transformers) * 7);
292+
rate+= (int) ((100 - energyConvertionRate) * Math.log(transformers) * 5);
293293
}
294294
rate = (int) Math.pow(rate, 1.2);
295295
double massRatio = (double)MAX_MASS / Math.max(mass, MIN_MASS);

src/main/java/igentuman/nc/multiblock/MultiblockHandler.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ public static void addMultiblock(AbstractNCMultiblock multiblock, boolean force)
6565

6666
public static void addIgnoreToUpdate(BlockPos blockPos) {
6767
if (!ignoreUpdate.contains(blockPos)) {
68-
ignoreUpdate.add(blockPos);
68+
try {
69+
ignoreUpdate.add(blockPos);
70+
} catch (ArrayIndexOutOfBoundsException ignored) {
71+
}
6972
}
7073
}
7174

@@ -74,7 +77,10 @@ public static void trackBlockChange(BlockPos pos) {
7477
return;
7578
}
7679
if (ignoreUpdate.contains(pos)) {
77-
ignoreUpdate.remove(pos);
80+
try {
81+
ignoreUpdate.remove(pos);
82+
} catch (ArrayIndexOutOfBoundsException ignored) {
83+
}
7884
return;
7985
}
8086
//Iterate chunk cache first for better performance

src/main/java/igentuman/nc/multiblock/kugelblitz/KugelblitzMultiblock.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,11 @@ private void handleBlackHole() {
330330
BlockPos pos = blackHole.getBlockPos();
331331
blackHole = null;
332332
getLevel().setBlockAndUpdate(pos, AIR.defaultBlockState());
333+
controllerBE().mass = 0;
334+
controllerBE().feeding = 0;
335+
controllerBE().energyPerTick = 0;
336+
controllerBE().evaporation = 0;
337+
controllerBE().setChanged();
333338
}
334339
if (blackHole == null) {
335340
boolean energyTransfered = true;

0 commit comments

Comments
 (0)