Merge pull request #1857 from BallOfEnergy1/Optimization

Miscellaneous fixes for the optimization update.
This commit is contained in:
HbmMods 2025-01-09 08:30:08 +01:00 committed by GitHub
commit 8f325e9a5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 18 deletions

View File

@ -132,7 +132,8 @@ public class PacketThreading {
for (Future<?> future : futureList) {
nanoTimeWaited = System.nanoTime() - startTime;
future.get(50, TimeUnit.MILLISECONDS); // I HATE EVERYTHING
if(TimeUnit.MILLISECONDS.convert(nanoTimeWaited, TimeUnit.NANOSECONDS) > 50) throw new TimeoutException(); // >50ms total time? timeout? yes sir, ooh rah!
// if(TimeUnit.MILLISECONDS.convert(nanoTimeWaited, TimeUnit.NANOSECONDS) > 50) throw new TimeoutException(); // >50ms total time? timeout? yes sir, ooh rah!
// this seems to cause big problems with large worlds, never mind...
}
}
} catch (ExecutionException ignored) {

View File

@ -32,7 +32,7 @@ public class TileEntityCharge extends TileEntityLoadedBase {
@Override
public void serialize(ByteBuf buf) {
buf.writeLong(this.timer);
buf.writeInt(this.timer);
buf.writeBoolean(this.started);
}

View File

@ -12,7 +12,6 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
@ -52,18 +51,6 @@ public class TileEntityBroadcaster extends TileEntityLoadedBase {
audio = rebootAudio(audio);
}
int intendedVolume = 25;
EntityPlayer player = MainRegistry.proxy.me();
float volume;
if(player != null) {
float f = (float)Math.sqrt(Math.pow(xCoord - player.posX, 2) + Math.pow(yCoord - player.posY, 2) + Math.pow(zCoord - player.posZ, 2));
volume = (f / intendedVolume) * -2 + 2;
} else {
volume = intendedVolume;
}
audio.updateVolume(getVolume(volume));
audio.keepAlive();
}
}
@ -89,7 +76,7 @@ public class TileEntityBroadcaster extends TileEntityLoadedBase {
@Override
public AudioWrapper createAudioLoop() {
Random rand = new Random(xCoord + yCoord + zCoord);
return MainRegistry.proxy.getLoopedSound("hbm:block.broadcast" + (rand.nextInt(3) + 1), xCoord, yCoord, zCoord, 1.0F, 10F, 1.0F);
return MainRegistry.proxy.getLoopedSound("hbm:block.broadcast" + (rand.nextInt(3) + 1), xCoord, yCoord, zCoord, 25F, 25F, 1.0F);
}
@Override

View File

@ -231,6 +231,8 @@ public class TileEntityCustomMachine extends TileEntityMachinePolluting implemen
public void serialize(ByteBuf buf) {
super.serialize(buf);
BufferUtil.writeString(buf, this.machineType);
buf.writeLong(power);
buf.writeInt(progress);
buf.writeInt(flux);
@ -596,13 +598,13 @@ public class TileEntityCustomMachine extends TileEntityMachinePolluting implemen
return 0;
}
@Override
public long getReceiverSpeed() {
if(this.config != null && !this.config.generatorMode) return this.getMaxPower();
return 0;
}
@Override
public long getProviderSpeed() {
if(this.config != null && this.config.generatorMode) return this.getMaxPower();