1
0
forked from xjboss/KCauldronX

Normalize patches

This commit is contained in:
Prototik 2015-06-01 21:32:10 +07:00
parent 86f83acb7e
commit c427f60e15
16 changed files with 67 additions and 67 deletions

View File

@ -15,14 +15,14 @@
}
+ if (!"false".equals(System.getProperty("kcauldron.fastcraft.disable", "true"))) {
+ java.util.Iterator<ModContainer> iterator = modList.iterator();
+ while(iterator.hasNext()) {
+ ModContainer container = iterator.next();
+ if ("FastCraft".equals(container.getModId())) {
+ FMLLog.log(Level.WARN, "Found FastCraft mod, removing it...");
+ iterator.remove();
+ }
+ }
+ java.util.Iterator<ModContainer> iterator = modList.iterator();
+ while(iterator.hasNext()) {
+ ModContainer container = iterator.next();
+ if ("FastCraft".equals(container.getModId())) {
+ FMLLog.log(Level.WARN, "Found FastCraft mod, removing it...");
+ iterator.remove();
+ }
+ }
+ }
+
return modList;

View File

@ -10,8 +10,8 @@
+ io.netty.util.Attribute<NetworkDispatcher> attr = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER);
+ if (attr != null)
+ {
+ NetworkDispatcher dispatcher = attr.getAndRemove();
+ if (dispatcher != null) dispatcher.completeHandshake(msg.target);
+ NetworkDispatcher dispatcher = attr.getAndRemove();
+ if (dispatcher != null) dispatcher.completeHandshake(msg.target);
+ }
+ // Cauldron end
}

View File

@ -36,7 +36,7 @@
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader)
{
+ // Cauldron end
+ // Cauldron end
FMLRelaunchLog.fine("Injecting coremod %s {%s} class transformers", name, coreModInstance.getClass().getName());
if (coreModInstance.getASMTransformerClass() != null) for (String transformer : coreModInstance.getASMTransformerClass())
{
@ -74,10 +74,10 @@
String cascadedTweaker = mfAttributes.getValue("TweakClass");
if (cascadedTweaker != null)
{
+ if ("fastcraft.Tweaker".equals(cascadedTweaker) && !"false".equals(System.getProperty("kcauldron.fastcraft.disable", "true"))) {
+ FMLRelaunchLog.info("Found FastCraft tweaker, skipping...");
+ continue;
+ }
+ if ("fastcraft.Tweaker".equals(cascadedTweaker) && !"false".equals(System.getProperty("kcauldron.fastcraft.disable", "true"))) {
+ FMLRelaunchLog.info("Found FastCraft tweaker, skipping...");
+ continue;
+ }
FMLRelaunchLog.info("Loading tweaker %s from %s", cascadedTweaker, coreMod.getName());
Integer sortOrder = Ints.tryParse(Strings.nullToEmpty(mfAttributes.getValue("TweakOrder")));
sortOrder = (sortOrder == null ? Integer.valueOf(0) : sortOrder);
@ -87,7 +87,7 @@
}
+ if ("fastcraft.LoadingPlugin".equals(fmlCorePlugin) && !"false".equals(System.getProperty("kcauldron.fastcraft.disable", "true"))) {
+ FMLRelaunchLog.warning("Found FastCraft coremod, skipping...");
+ continue;
+ continue;
+ }
// Support things that are mod jars, but not FML mod jars
try

View File

@ -787,7 +787,7 @@
+
+ // Cauldron start
+ public boolean entityAllowedToSpawn() {
+ return true;
+ return true;
+ }
+ // Cauldron end
}

View File

@ -532,10 +532,10 @@
+ {
+ float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT));
+ if (this instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) this;
+ armorDamage = ArmorProperties.ApplyArmor(player, player.inventory.armorInventory, damagesource, armorDamage, true);
+ EntityPlayer player = (EntityPlayer) this;
+ armorDamage = ArmorProperties.ApplyArmor(player, player.inventory.armorInventory, damagesource, armorDamage, true);
+ } else {
+ this.damageArmor(armorDamage);
+ this.damageArmor(armorDamage);
+ }
+ }
+

View File

@ -41,8 +41,8 @@
{
ItemStack stack = this.getDataWatcher().getWatchableObjectItemStack(10);
+ if (stack == null || stack.stackSize == 0) {
+ setDead();
+ return;
+ setDead();
+ return;
+ }
if (stack != null && stack.getItem() != null)
{
@ -306,7 +306,7 @@
+
+ @Override
+ public boolean entityAllowedToSpawn() {
+ ItemStack stack = getDataWatcher().getWatchableObjectItemStack(10);
+ return stack != null && stack.getItem() != null && stack.stackSize > 0;
+ ItemStack stack = getDataWatcher().getWatchableObjectItemStack(10);
+ return stack != null && stack.getItem() != null && stack.stackSize > 0;
+ }
}

View File

@ -226,7 +226,7 @@
+
+ // Spigot start
+ public boolean areItemStacksEqual(ItemStack is1, ItemStack is2) {
+ return tickCount % fullMatchRate == 0 ? ItemStack.areItemStacksEqual(is1, is2) : ItemStack.fastMatches(is1, is2);
+ return tickCount % fullMatchRate == 0 ? ItemStack.areItemStacksEqual(is1, is2) : ItemStack.fastMatches(is1, is2);
+ }
+ // Spigot
}

View File

@ -155,9 +155,9 @@
+
+ // Spigot start
+ public static boolean fastMatches(ItemStack is1, ItemStack is2) {
+ if (is1 == null && is2 == null) return true;
+ if (is1 != null && is2 != null) return is1.stackSize == is2.stackSize && is1.field_151002_e == is2.field_151002_e && is1.itemDamage == is2.itemDamage;
+ return false;
+ if (is1 == null && is2 == null) return true;
+ if (is1 != null && is2 != null) return is1.stackSize == is2.stackSize && is1.field_151002_e == is2.field_151002_e && is1.itemDamage == is2.itemDamage;
+ return false;
+ }
+ // Spigot end
}

View File

@ -10,8 +10,8 @@
- try
- {
- if (!this.running)
+ while (true)
+ {
+ while (true)
+ {
+ if (!this.running || clientSocket == null)
{
break;
@ -24,7 +24,7 @@
+
+ if (i < 10)
{
+ this.running = false; // Cauldron
+ this.running = false; // Cauldron
return;
}
@ -32,7 +32,7 @@
continue;
}
}
+ }
+ }
}
catch (SocketTimeoutException sockettimeoutexception)
{
@ -63,7 +63,7 @@
private void closeSocket()
{
+ this.running = false;
+ this.running = false;
if (null != this.clientSocket)
{
try

View File

@ -912,8 +912,8 @@
}
+ public int getMaxVisiblePlayers() {
+ int max = mcServer.cauldronConfig.maxPlayersVisible.getValue();
+ return max > 0 ? max : maxPlayers;
+ int max = mcServer.cauldronConfig.maxPlayersVisible.getValue();
+ return max > 0 ? max : maxPlayers;
+ }
+
public String[] getAvailablePlayerDat()

View File

@ -143,22 +143,22 @@
public void processLoginStart(C00PacketLoginStart p_147316_1_)
{
- Validate.validState(this.field_147328_g == NetHandlerLoginServer.LoginState.HELLO, "Unexpected hello packet", new Object[0]);
+ if (debug) logger.info("Login attempt");
+ if (debug) logger.info("Login attempt");
+ Validate.validState(this.field_147328_g == LoginState.HELLO, "Unexpected hello packet", new Object[0]);
this.field_147337_i = p_147316_1_.func_149304_c();
+ if (debug) logger.info("Received profile: " + this.field_147337_i.getName());
+ if (debug) logger.info("Received profile: " + this.field_147337_i.getName());
if (this.field_147327_f.isServerInOnlineMode() && !this.field_147333_a.isLocalChannel())
{
- this.field_147328_g = NetHandlerLoginServer.LoginState.KEY;
+ if (debug) logger.info("Send encryption request to " + this.field_147337_i.getName());
+ if (debug) logger.info("Send encryption request to " + this.field_147337_i.getName());
+ this.field_147328_g = LoginState.KEY;
this.field_147333_a.scheduleOutboundPacket(new S01PacketEncryptionRequest(this.field_147334_j, this.field_147327_f.getKeyPair().getPublic(), this.field_147330_e), new GenericFutureListener[0]);
}
else
{
- this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
+ if (debug) logger.info("Lookup offline UUID for " + this.field_147337_i.getName());
+ if (debug) logger.info("Lookup offline UUID for " + this.field_147337_i.getName());
+ (new ThreadPlayerLookupUUID(this, "User Authenticator #" + field_147331_b.incrementAndGet())).start(); // Spigot
}
}
@ -174,7 +174,7 @@
}
else
{
+ if (debug) logger.info("Enabling encryption for " + this.field_147337_i.getName());
+ if (debug) logger.info("Enabling encryption for " + this.field_147337_i.getName());
this.field_147335_k = p_147315_1_.func_149300_a(privatekey);
this.field_147328_g = NetHandlerLoginServer.LoginState.AUTHENTICATING;
this.field_147333_a.enableEncryption(this.field_147335_k);
@ -223,7 +223,7 @@
- }
- }
- }).start();
+ if (debug) logger.info("Lookup online UUID for " + this.field_147337_i.getName());
+ if (debug) logger.info("Lookup online UUID for " + this.field_147337_i.getName());
+ (new ThreadPlayerLookupUUID(this, "User Authenticator #" + field_147331_b.incrementAndGet())).start();
}
}
@ -246,7 +246,7 @@
+ }
+
+ static GameProfile processPlayerLoginGameProfile(NetHandlerLoginServer loginServer, GameProfile gameprofile) {
+ if (loginServer.debug) logger.info("Player logged in: " + gameprofile);
+ if (loginServer.debug) logger.info("Player logged in: " + gameprofile);
+ return loginServer.field_147337_i = gameprofile;
+ }
+

View File

@ -256,7 +256,7 @@
+ org.bukkit.World.Environment env)
+ {
+ this.spigotConfig = new org.spigotmc.SpigotWorldConfig(p_i45369_2_); // Spigot
+ initLimiter(); // Spigot
+ initLimiter(); // Spigot
+ // Cauldron start
+ this.cauldronConfig = new CauldronWorldConfig(p_i45369_2_, MinecraftServer.getServer().cauldronConfig);
+ this.tileentityConfig = new TileEntityWorldConfig(p_i45369_2_, MinecraftServer.getServer().tileEntityConfig);
@ -401,7 +401,7 @@
+ if (DimensionManager.getWorld(0) != null)
+ {
+ this.spigotConfig = new org.spigotmc.SpigotWorldConfig(p_i45369_2_); // Spigot
+ initLimiter(); // Spigot
+ initLimiter(); // Spigot
+ this.cauldronConfig = new CauldronWorldConfig(p_i45369_2_, MinecraftServer.getServer().cauldronConfig);
+ this.tileentityConfig = new TileEntityWorldConfig(p_i45369_2_, MinecraftServer.getServer().tileEntityConfig);
+ this.world = DimensionManager.getWorld(0).getWorld();
@ -627,7 +627,7 @@
+
+ public boolean addEntity(Entity p_72838_1_, SpawnReason spawnReason) // Changed signature, added SpawnReason
+ {
+ if (!p_72838_1_.entityAllowedToSpawn()) return false; // Cauldron
+ if (!p_72838_1_.entityAllowedToSpawn()) return false; // Cauldron
// do not drop any items while restoring blocksnapshots. Prevents dupes
if (!this.isRemote && (p_72838_1_ == null || (p_72838_1_ instanceof net.minecraft.entity.item.EntityItem && this.restoringBlockSnapshots))) return false;
@ -875,7 +875,7 @@
+ int entitiesThisCycle = 0;
+ if (tickPosition < 0) tickPosition = 0;
+ for (entityLimiter.initTick(); entitiesThisCycle < loadedEntityList.size() && (entitiesThisCycle % 10 == 0 || entityLimiter.shouldContinue()); tickPosition++, entitiesThisCycle++) {
+ tickPosition = (tickPosition < loadedEntityList.size()) ? tickPosition : 0;
+ tickPosition = (tickPosition < loadedEntityList.size()) ? tickPosition : 0;
+ entity = (Entity)this.loadedEntityList.get(this.tickPosition);
if (entity.ridingEntity != null)
@ -925,9 +925,9 @@
- if (!tileentity.isInvalid() && tileentity.hasWorldObj() && this.blockExists(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord))
+ int tilesThisCycle = 0;
+ for (tileLimiter.initTick(); tilesThisCycle < loadedTileEntityList.size() && (tilesThisCycle % 10 == 0 || tileLimiter.shouldContinue()); tileTickPosition++, tilesThisCycle++) {
+ tileTickPosition = (tileTickPosition < loadedTileEntityList.size()) ? tileTickPosition : 0;
+ TileEntity tileentity = (TileEntity) this.loadedTileEntityList.get(tileTickPosition);
+
+ tileTickPosition = (tileTickPosition < loadedTileEntityList.size()) ? tileTickPosition : 0;
+ TileEntity tileentity = (TileEntity) this.loadedTileEntityList.get(tileTickPosition);
+
+ // Spigot start
+ if (tileentity == null)
{
@ -1365,14 +1365,14 @@
+
+ // Spigot start
+ private void initLimiter() {
+ entityLimiter = new TickLimiter(spigotConfig.entityMaxTickTime);
+ tileLimiter = new TickLimiter(spigotConfig.tileMaxTickTime);
+ entityLimiter = new TickLimiter(spigotConfig.entityMaxTickTime);
+ tileLimiter = new TickLimiter(spigotConfig.tileMaxTickTime);
+ }
+ // Spigot end
+
+ // Cauldron start
+ public boolean isProfilingWorld() {
+ return provider.dimensionId == Integer.MIN_VALUE; // Mystcraft
+ return provider.dimensionId == Integer.MIN_VALUE; // Mystcraft
+ }
+ // Cauldron end
}

View File

@ -100,7 +100,7 @@
public void unloadAllChunks()
{
- Iterator iterator = this.loadedChunks.iterator();
+ mUnloading = true;
+ mUnloading = true;
+ Iterator iterator = this.loadedChunkHashMap.values().iterator(); // CraftBukkit
while (iterator.hasNext())
@ -119,7 +119,7 @@
- long k = ChunkCoordIntPair.chunkXZ2Int(par1, par2);
- this.chunksToUnload.remove(Long.valueOf(k));
- Chunk chunk = (Chunk)this.loadedChunkHashMap.getValueByKey(k);
+ if (mUnloading) return null;
+ if (mUnloading) return null;
+ this.chunksToUnload.remove(par1, par2);
+ Chunk chunk = (Chunk) this.loadedChunkHashMap.get(LongHash.toLong(par1, par2));
+ boolean newChunk = false;
@ -142,7 +142,7 @@
- long k = ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_);
- this.chunksToUnload.remove(Long.valueOf(k));
- Chunk chunk = (Chunk)this.loadedChunkHashMap.getValueByKey(k);
+ if (mUnloading) return null;
+ if (mUnloading) return null;
+ this.chunksToUnload.remove(p_73158_1_, p_73158_2_);
+ Chunk chunk = (Chunk) this.loadedChunkHashMap.get(LongHash.toLong(p_73158_1_, p_73158_2_));
+ boolean newChunk = false; // CraftBukkit
@ -213,7 +213,7 @@
{
- Chunk chunk = (Chunk)this.loadedChunkHashMap.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(p_73154_1_, p_73154_2_));
- return chunk == null ? (!this.worldObj.findingSpawnPoint && !this.loadChunkOnProvideRequest ? this.defaultEmptyChunk : this.loadChunk(p_73154_1_, p_73154_2_)) : chunk;
+ if (mUnloading) return null;
+ if (mUnloading) return null;
+ // CraftBukkit start
+ Chunk chunk = (Chunk) this.loadedChunkHashMap.get(LongHash.toLong(p_73154_1_, p_73154_2_));
+ chunk = chunk == null ? (shouldLoadChunk() ? this.loadChunk(p_73154_1_, p_73154_2_) : this.defaultEmptyChunk) : chunk; // Cauldron handle forge server tick events and load the chunk within 5 seconds of the world being loaded (for chunk loaders)

View File

@ -5,7 +5,7 @@
public String getWorldName()
{
- return this.theWorldInfo.getWorldName();
+ String name = super.getWorldName();
+ String name = super.getWorldName();
+ return name != null ? name : this.theWorldInfo.getWorldName();
}
@ -25,15 +25,15 @@
}
+
+ public int getDimension() {
+ return this.theWorldInfo.getDimension();
+ return this.theWorldInfo.getDimension();
+ }
+
+ public void setDimension(int dim) {
+ this.theWorldInfo.setDimension(dim);
+ this.theWorldInfo.setDimension(dim);
+ }
+
+ @Override
+ public void tick() {
+ theWorldInfo.tick();
+ theWorldInfo.tick();
+ }
}

View File

@ -52,6 +52,6 @@
}
+
+ public void tick() {
+ totalTime++;
+ totalTime++;
+ }
}

View File

@ -18,12 +18,12 @@
UNKNOWN;
+
+ public boolean isPortal() {
+ switch(this) {
+ case NETHER_PORTAL:
+ case END_PORTAL:
+ return true;
+ }
+ return false;
+ switch(this) {
+ case NETHER_PORTAL:
+ case END_PORTAL:
+ return true;
+ }
+ return false;
+ }
}