u27
This commit is contained in:
parent
af50d17c9a
commit
aae277ed5d
20 changed files with 495 additions and 57 deletions
|
|
@ -10,7 +10,7 @@ public class EaglercraftVersion {
|
|||
/// Customize these to fit your fork:
|
||||
|
||||
public static final String projectForkName = "EaglercraftX";
|
||||
public static final String projectForkVersion = "u26";
|
||||
public static final String projectForkVersion = "u27";
|
||||
public static final String projectForkVendor = "lax1dude";
|
||||
|
||||
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
|
||||
|
|
@ -20,7 +20,7 @@ public class EaglercraftVersion {
|
|||
public static final String projectOriginName = "EaglercraftX";
|
||||
public static final String projectOriginAuthor = "lax1dude";
|
||||
public static final String projectOriginRevision = "1.8";
|
||||
public static final String projectOriginVersion = "u26";
|
||||
public static final String projectOriginVersion = "u27";
|
||||
|
||||
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ public class EaglercraftVersion {
|
|||
public static final boolean enableUpdateService = true;
|
||||
|
||||
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
|
||||
public static final int updateBundlePackageVersionInt = 26;
|
||||
public static final int updateBundlePackageVersionInt = 27;
|
||||
|
||||
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public interface IClientConfigAdapter {
|
|||
|
||||
String getResourcePacksDB();
|
||||
|
||||
JSONObject dumpConfig();
|
||||
JSONObject getIntegratedServerOpts();
|
||||
|
||||
List<RelayEntry> getRelays();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package net.minecraft.entity;
|
||||
package net.lax1dude.eaglercraft.v1_8.minecraft;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.update;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
|
|
@ -36,8 +38,30 @@ public class UpdateService {
|
|||
|
||||
private static UpdateCertificate latestUpdateFound = null;
|
||||
private static final Set<UpdateCertificate> availableUpdates = new HashSet();
|
||||
private static final Set<RawKnownCertHolder> fastUpdateKnownCheckSet = new HashSet();
|
||||
private static final Set<UpdateCertificate> dismissedUpdates = new HashSet();
|
||||
|
||||
private static class RawKnownCertHolder {
|
||||
|
||||
private final byte[] data;
|
||||
private final int hashcode;
|
||||
private final long age;
|
||||
|
||||
public RawKnownCertHolder(byte[] data) {
|
||||
this.data = data;
|
||||
this.hashcode = Arrays.hashCode(data);
|
||||
this.age = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return hashcode;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return o != null && (o == this || ((o instanceof RawKnownCertHolder) && Arrays.equals(((RawKnownCertHolder)o).data, data)));
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean supported() {
|
||||
return EaglercraftVersion.enableUpdateService && EagRuntime.getConfiguration().allowUpdateSvc() && PlatformUpdateSvc.supported();
|
||||
}
|
||||
|
|
@ -102,6 +126,16 @@ public class UpdateService {
|
|||
if (EagRuntime.getConfiguration().allowUpdateDL()) {
|
||||
synchronized(availableUpdates) {
|
||||
try {
|
||||
if(certificateData.length > 32767) {
|
||||
throw new CertificateInvalidException("Certificate is too large! (" + certificateData.length + " bytes)");
|
||||
}
|
||||
if(!fastUpdateKnownCheckSet.add(new RawKnownCertHolder(certificateData))) {
|
||||
if (EagRuntime.getConfiguration().isLogInvalidCerts()) {
|
||||
logger.info("Ignoring {} byte certificate that has already been processed", certificateData.length);
|
||||
}
|
||||
freeMemory();
|
||||
return;
|
||||
}
|
||||
UpdateCertificate cert = UpdateCertificate.parseAndVerifyCertificate(certificateData);
|
||||
if (EaglercraftVersion.updateBundlePackageName.equalsIgnoreCase(cert.bundlePackageName)) {
|
||||
if (myUpdateCert == null || !Arrays.equals(cert.bundleDataHash, myUpdateCert.bundleDataHash)) {
|
||||
|
|
@ -140,6 +174,17 @@ public class UpdateService {
|
|||
}
|
||||
}
|
||||
|
||||
private static void freeMemory() {
|
||||
if(fastUpdateKnownCheckSet.size() > 127) {
|
||||
List<RawKnownCertHolder> lst = new ArrayList(fastUpdateKnownCheckSet);
|
||||
fastUpdateKnownCheckSet.clear();
|
||||
lst.sort((c1, c2) -> { return (int)(c2.age - c1.age); });
|
||||
for(int i = 0; i < 64; ++i) {
|
||||
fastUpdateKnownCheckSet.add(lst.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void startClientUpdateFrom(UpdateCertificate clientUpdate) {
|
||||
PlatformUpdateSvc.startClientUpdateFrom(clientUpdate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import net.lax1dude.eaglercraft.v1_8.EaglercraftSoundManager;
|
|||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.IOUtils;
|
||||
import net.lax1dude.eaglercraft.v1_8.ThreadLocalRandom;
|
||||
import net.lax1dude.eaglercraft.v1_8.json.JSONTypeProvider;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
|
|
@ -266,7 +267,7 @@ public class SoundHandler implements IResourceManagerReloadListener, ITickable {
|
|||
if (arraylist.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
return (SoundEventAccessorComposite) arraylist.get((new EaglercraftRandom()).nextInt(arraylist.size()));
|
||||
return (SoundEventAccessorComposite) arraylist.get(ThreadLocalRandom.current().nextInt(arraylist.size()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
||||
import net.lax1dude.eaglercraft.v1_8.HString;
|
||||
import net.lax1dude.eaglercraft.v1_8.ThreadLocalRandom;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
|
@ -115,7 +116,7 @@ public class CommandSpreadPlayers extends CommandBase {
|
|||
|
||||
private void func_110669_a(ICommandSender worldIn, List<Entity> parList, CommandSpreadPlayers.Position parPosition,
|
||||
double parDouble1, double parDouble2, World parWorld, boolean parFlag) throws CommandException {
|
||||
EaglercraftRandom random = new EaglercraftRandom();
|
||||
EaglercraftRandom random = ThreadLocalRandom.current();
|
||||
double d0 = parPosition.field_111101_a - parDouble2;
|
||||
double d1 = parPosition.field_111100_b - parDouble2;
|
||||
double d2 = parPosition.field_111101_a + parDouble2;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package net.minecraft.command;
|
|||
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
||||
import net.lax1dude.eaglercraft.v1_8.ThreadLocalRandom;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.WorldServer;
|
||||
|
|
@ -55,7 +56,7 @@ public class CommandWeather extends CommandBase {
|
|||
*/
|
||||
public void processCommand(ICommandSender parICommandSender, String[] parArrayOfString) throws CommandException {
|
||||
if (parArrayOfString.length >= 1 && parArrayOfString.length <= 2) {
|
||||
int i = (300 + (new EaglercraftRandom()).nextInt(600)) * 20 * 2;
|
||||
int i = (300 + ThreadLocalRandom.current().nextInt(600)) * 20 * 2;
|
||||
if (parArrayOfString.length >= 2) {
|
||||
i = parseInt(parArrayOfString[1], 1, 1000000) * 20;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.google.common.collect.Maps;
|
|||
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
import net.lax1dude.eaglercraft.v1_8.minecraft.EntityConstructor;
|
||||
import net.minecraft.entity.ai.EntityMinecartMobSpawner;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.boss.EntityWither;
|
||||
|
|
|
|||
|
|
@ -79,6 +79,10 @@ public abstract class EntityFireball extends Entity {
|
|||
this.setLocationAndAngles(x, y, z, this.rotationYaw, this.rotationPitch);
|
||||
this.setPosition(x, y, z);
|
||||
double d0 = (double) MathHelper.sqrt_double(accelX * accelX + accelY * accelY + accelZ * accelZ);
|
||||
if (d0 == 0.0) {
|
||||
this.accelerationX = this.accelerationY = this.accelerationZ = 0.0D;
|
||||
return;
|
||||
}
|
||||
this.accelerationX = accelX / d0 * 0.1D;
|
||||
this.accelerationY = accelY / d0 * 0.1D;
|
||||
this.accelerationZ = accelZ / d0 * 0.1D;
|
||||
|
|
@ -95,6 +99,10 @@ public abstract class EntityFireball extends Entity {
|
|||
accelY = accelY + this.rand.nextGaussian() * 0.4D;
|
||||
accelZ = accelZ + this.rand.nextGaussian() * 0.4D;
|
||||
double d0 = (double) MathHelper.sqrt_double(accelX * accelX + accelY * accelY + accelZ * accelZ);
|
||||
if (d0 == 0.0) {
|
||||
this.accelerationX = this.accelerationY = this.accelerationZ = 0.0D;
|
||||
return;
|
||||
}
|
||||
this.accelerationX = accelX / d0 * 0.1D;
|
||||
this.accelerationY = accelY / d0 * 0.1D;
|
||||
this.accelerationZ = accelZ / d0 * 0.1D;
|
||||
|
|
@ -144,7 +152,7 @@ public abstract class EntityFireball extends Entity {
|
|||
.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
|
||||
double d0 = 0.0D;
|
||||
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
for (int i = 0, l = list.size(); i < l; ++i) {
|
||||
Entity entity1 = (Entity) list.get(i);
|
||||
if (entity1.canBeCollidedWith()
|
||||
&& (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue