Skip to content

Commit 2091397

Browse files
author
Circulate233
committed
大概修复了几个问题
1 parent 7194550 commit 2091397

File tree

6 files changed

+38
-47
lines changed

6 files changed

+38
-47
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/java/github/kasuminova/novaeng/client/handler/ClientEventHandler.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@ public void onClientTick(TickEvent.ClientTickEvent event) {
6262
if (event.phase != TickEvent.Phase.START) {
6363
return;
6464
}
65-
clientTick++;
65+
this.clientTick++;
6666

67-
if (clientTick % 5 == 0) {
67+
if (this.clientTick % 5 == 0) {
6868
if (NovaEngCoreConfig.CLIENT.enableNovaEngTitle) {
6969
TitleUtils.checkTitleState();
7070
}
71-
debugMessageUpdateRequired = true;
71+
this.debugMessageUpdateRequired = true;
7272
}
7373

74-
if (clientTick % 20 == 0) {
74+
if (this.clientTick % 20 == 0) {
7575
checkParticleEffects();
7676
}
7777
}
@@ -82,27 +82,27 @@ public void onDebugText(RenderGameOverlayEvent.Text event) {
8282
return;
8383
}
8484

85-
if (debugMessageUpdateRequired) {
85+
if (this.debugMessageUpdateRequired) {
8686
final ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
8787
if (effectRenderer == null) {
8888
NovaEngineeringCore.log.warn("Particle effect renderer is null.");
8989
}
9090

91-
debugMessageUpdateRequired = false;
92-
debugMessageCache.clear();
93-
debugMessageCache.add("");
94-
debugMessageCache.add(TextFormatting.BLUE + "[NovaEngineering-Core] Ver: " + NovaEngineeringCore.VERSION);
91+
this.debugMessageUpdateRequired = false;
92+
this.debugMessageCache.clear();
93+
this.debugMessageCache.add("");
94+
this.debugMessageCache.add(TextFormatting.BLUE + "[NovaEngineering-Core] Ver: " + NovaEngineeringCore.VERSION);
9595

9696
if (effectRenderer != null) {
97-
debugMessageCache.add(TextFormatting.GREEN + "Particles: " + TextFormatting.DARK_GREEN + getTotalParticles((AccessorParticleManager) effectRenderer));
97+
this.debugMessageCache.add(TextFormatting.GREEN + "Particles: " + TextFormatting.DARK_GREEN + getTotalParticles((AccessorParticleManager) effectRenderer));
9898
}
9999

100-
debugMessageCache.addAll(CPacketProfiler.getProfilerMessages(debugPacketProfilerMessageLimit));
101-
debugMessageCache.addAll(TEUpdatePacketProfiler.getProfilerMessages(debugTEPacketProfilerMessageLimit));
100+
this.debugMessageCache.addAll(CPacketProfiler.getProfilerMessages(debugPacketProfilerMessageLimit));
101+
this.debugMessageCache.addAll(TEUpdatePacketProfiler.getProfilerMessages(debugTEPacketProfilerMessageLimit));
102102
}
103103

104104
List<String> right = event.getRight();
105-
right.addAll(debugMessageCache);
105+
right.addAll(this.debugMessageCache);
106106
}
107107

108108
@SubscribeEvent

src/main/java/github/kasuminova/novaeng/common/handler/WorldLoadedHandler.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import it.unimi.dsi.fastutil.ints.IntLinkedOpenHashSet;
55
import it.unimi.dsi.fastutil.ints.IntSet;
66
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
7-
import net.minecraft.util.math.ChunkPos;
87
import net.minecraft.world.WorldServer;
98
import net.minecraftforge.common.DimensionManager;
109
import net.minecraftforge.common.ForgeChunkManager;
@@ -14,7 +13,6 @@
1413
import stanhebben.zenscript.annotations.ZenMethod;
1514

1615
import java.util.Map;
17-
import java.util.Random;
1816

1917
import static github.kasuminova.novaeng.NovaEngCoreConfig.SERVER;
2018

@@ -27,10 +25,6 @@ public class WorldLoadedHandler {
2725
public static final IntSet REGISTERED_DIMENSIONS = new IntLinkedOpenHashSet();
2826
public static final IntSet ERRORWROLD = new IntLinkedOpenHashSet();
2927
public static boolean init = true;
30-
static Random random = new Random();
31-
static final int randomX = random.nextInt(100000) + 150000;
32-
static final int randomY = random.nextInt(100000) + 150000;
33-
public static final ChunkPos chunk = new ChunkPos(randomX, randomY);
3428
int time = 0;
3529

3630
public static void loadWorld(int... id) {
@@ -70,10 +64,10 @@ public void onServerTick(TickEvent.ServerTickEvent event) {
7064
switch (event.phase) {
7165
case START -> {
7266
if (SERVER.forceChunkHandler) {
73-
if (time % 100 == 0) {
74-
request();
67+
if (this.time % 100 == 0) {
68+
this.request();
7569
}
76-
++time;
70+
++this.time;
7771
}
7872
}
7973
}

src/main/java/github/kasuminova/novaeng/mixin/ae2/MixinCraftingCPUCluster.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private void injectCancel(final CallbackInfo ci) {
9090
}
9191
// Ensure inventory is empty
9292
if (this.inventory.getItemList().isEmpty()) {
93-
destroy();
93+
this.destroy();
9494
}
9595
}
9696

@@ -108,7 +108,7 @@ private void injectUpdateCraftingLogicStoreItems(final IGrid grid, final IEnergy
108108
if (this.isComplete) {
109109
// Ensure inventory is empty
110110
if (this.inventory.getItemList().isEmpty()) {
111-
destroy();
111+
this.destroy();
112112
ci.cancel();
113113
}
114114
}
@@ -117,7 +117,7 @@ private void injectUpdateCraftingLogicStoreItems(final IGrid grid, final IEnergy
117117
@Inject(method = "updateCraftingLogic", at = @At("TAIL"))
118118
private void injectUpdateCraftingLogicTail(final IGrid grid, final IEnergyGrid eg, final CraftingGridCache cgc, final CallbackInfo ci) {
119119
int currentParallelism = this.usedOps[0];
120-
novaeng_ec$parallelismRecorder.addUsedTime(currentParallelism);
120+
this.novaeng_ec$parallelismRecorder.addUsedTime(currentParallelism);
121121
}
122122

123123
@WrapOperation(
@@ -133,7 +133,7 @@ private boolean redirectUpdateCraftingLogicIsActive(final TileCraftingTile insta
133133
return controller != null && controller.getChannel() != null && controller.getChannel().getProxy().isActive();
134134
}
135135
if (this.novaeng_ec$virtualCPUOwner != null) {
136-
ECalculatorController controller = novaeng_ec$virtualCPUOwner;
136+
ECalculatorController controller = this.novaeng_ec$virtualCPUOwner;
137137
return controller.getChannel() != null && controller.getChannel().getProxy().isActive();
138138
}
139139
return original.call(instance);
@@ -161,7 +161,7 @@ private void injectIsActive(final CallbackInfoReturnable<Boolean> cir) {
161161
cir.setReturnValue(controller != null && controller.getChannel() != null && controller.getChannel().getProxy().isActive());
162162
}
163163
if (this.novaeng_ec$virtualCPUOwner != null) {
164-
ECalculatorController controller = novaeng_ec$virtualCPUOwner;
164+
ECalculatorController controller = this.novaeng_ec$virtualCPUOwner;
165165
cir.setReturnValue(controller.getChannel() != null && controller.getChannel().getProxy().isActive());
166166
}
167167
}
@@ -181,7 +181,7 @@ private void injectGetGrid(final CallbackInfoReturnable<IGrid> cir) {
181181
cir.setReturnValue(node == null ? null : node.getGrid());
182182
}
183183
if (this.novaeng_ec$virtualCPUOwner != null) {
184-
final ECalculatorMEChannel channel = novaeng_ec$virtualCPUOwner.getChannel();
184+
final ECalculatorMEChannel channel = this.novaeng_ec$virtualCPUOwner.getChannel();
185185
if (channel == null) {
186186
return;
187187
}
@@ -203,7 +203,7 @@ private void injectGetWorld(final CallbackInfoReturnable<World> cir) {
203203
cir.setReturnValue(this.novaeng_ec$core.getWorld());
204204
}
205205
if (this.novaeng_ec$virtualCPUOwner != null) {
206-
cir.setReturnValue(novaeng_ec$virtualCPUOwner.getWorld());
206+
cir.setReturnValue(this.novaeng_ec$virtualCPUOwner.getWorld());
207207
}
208208
}
209209

@@ -234,7 +234,7 @@ private void injectMarkDirty(final CallbackInfo ci) {
234234
@Unique
235235
@Override
236236
public ECalculatorThreadCore novaeng_ec$getController() {
237-
return novaeng_ec$core;
237+
return this.novaeng_ec$core;
238238
}
239239

240240
@Unique
@@ -293,7 +293,7 @@ private void injectMarkDirty(final CallbackInfo ci) {
293293
@Unique
294294
@Override
295295
public long novaeng_ec$getUsedExtraStorage() {
296-
return novaeng_ec$usedExtraStorage;
296+
return this.novaeng_ec$usedExtraStorage;
297297
}
298298

299299
@Unique
@@ -306,13 +306,13 @@ private void injectMarkDirty(final CallbackInfo ci) {
306306
@Unique
307307
@Override
308308
public TimeRecorder novaeng_ec$getTimeRecorder() {
309-
return novaeng_ec$timeRecorder;
309+
return this.novaeng_ec$timeRecorder;
310310
}
311311

312312
@Unique
313313
@Override
314314
public TimeRecorder novaeng_ec$getParallelismRecorder() {
315-
return novaeng_ec$parallelismRecorder;
315+
return this.novaeng_ec$parallelismRecorder;
316316
}
317317

318318
}

src/main/java/github/kasuminova/novaeng/mixin/ae2/MixinCraftingCPUClusterTwo.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,6 @@ private void executeCrafting(IEnergyGrid eg, CraftingGridCache cc) {
160160
if (size > max) max = size;
161161
}
162162

163-
this.r$craftingFrequency = e.getValue().getValue();
164-
if (max * this.r$craftingFrequency > Integer.MAX_VALUE) {
165-
this.r$craftingFrequency = Integer.MAX_VALUE / max;
166-
}
167-
168163
if (this.canCraft(key, key.getCondensedInputs())) {
169164
if (key instanceof VirtualPatternDetails) {
170165
this.completeJob();
@@ -175,6 +170,11 @@ private void executeCrafting(IEnergyGrid eg, CraftingGridCache cc) {
175170
boolean didPatternCraft;
176171
doWhileCraftingLoop:
177172
do {
173+
this.r$craftingFrequency = e.getValue().getValue();
174+
if (max * this.r$craftingFrequency > Integer.MAX_VALUE) {
175+
this.r$craftingFrequency = Integer.MAX_VALUE / max;
176+
}
177+
178178
InventoryCrafting ic = null;
179179
didPatternCraft = false;
180180

@@ -190,9 +190,9 @@ private void executeCrafting(IEnergyGrid eg, CraftingGridCache cc) {
190190
IAEItemStack[] input = key.getInputs();
191191
final var sum = n$getSum(input);
192192
double energy;
193-
long s = 1;
193+
long s = this.r$craftingFrequency;
194194
if (mediumType != MediumType.NULL) {
195-
double sum1 = sum * this.r$craftingFrequency;
195+
double sum1 = sum * s;
196196
double o = eg.extractAEPower(sum1, Actionable.SIMULATE, PowerMultiplier.CONFIG);
197197
if (o < sum1 - 0.01) {
198198
this.r$craftingFrequency = (long) (o / sum1 * this.r$craftingFrequency);
@@ -238,12 +238,9 @@ private void executeCrafting(IEnergyGrid eg, CraftingGridCache cc) {
238238
fuzz.setStackSize(input[x].getStackSize());
239239
if (key.isValidItemForSlot(x, fuzz.createItemStack(), this.getWorld())) {
240240
IAEItemStack ais = this.r$extractItemsR(this.inventory, fuzz, Actionable.MODULATE, this.machineSrc, mediumType);
241-
ItemStack is = ais == null ? ItemStack.EMPTY : ais.createItemStack();
241+
ItemStack is = ais == null ? ItemStack.EMPTY : ais.getDefinition();
242242
if (!is.isEmpty()) {
243-
IAEItemStack receiver = AEItemStack.fromItemStack(is);
244-
if (mediumType == MediumType.EF)
245-
receiver = receiver.copy().setStackSize(receiver.getStackSize() * this.r$craftingFrequency);
246-
243+
IAEItemStack receiver = ais.copy();
247244
this.postChange(receiver, this.machineSrc);
248245
ic.setInventorySlotContents(x, is);
249246
found = true;

src/main/java/github/kasuminova/novaeng/mixin/ae2/MixinPacketInventoryAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ private void injectServerPacketData(final INetworkInfo manager, final AppEngPack
3030
if (!(sender.openContainer instanceof AEBaseContainer)) {
3131
return;
3232
}
33-
if (action == InventoryAction.MOVE_REGION && AEPktInvActionSpamHandler.receivePacketAndCheckSpam(sender)) {
33+
if (this.action == InventoryAction.MOVE_REGION && AEPktInvActionSpamHandler.receivePacketAndCheckSpam(sender)) {
3434
sender.connection.disconnect(new TextComponentString("[NovaEng-Core]" + TextFormatting.RED + " Disconnected by AE2 Packet Spam."));
3535
ci.cancel();
3636
}

0 commit comments

Comments
 (0)