3
0

Avoid to use Derived.incrementTotalWorldTickTime

This commit is contained in:
Prototik 2015-05-25 18:27:17 +07:00
parent 1e5cd36314
commit ea868d4998
6 changed files with 82 additions and 32 deletions

View File

@ -45,9 +45,9 @@ group = 'pw.prok.kcauldron'
archivesBaseName = 'kcauldron' archivesBaseName = 'kcauldron'
ext.mcVersion = "1.7.10" ext.mcVersion = "1.7.10"
ext.cauldronVersion = "4" ext.cauldronVersion = "5"
ext.forgeVersion = "1403" ext.forgeVersion = "1403"
ext.revision = "69" ext.revision = "71"
version = "${mcVersion}-${cauldronVersion}.${forgeVersion}.${revision}" version = "${mcVersion}-${cauldronVersion}.${forgeVersion}.${revision}"
launch4j { launch4j {

View File

@ -1795,7 +1795,7 @@
{ {
packetbuffer = new PacketBuffer(Unpooled.wrappedBuffer(p_147349_1_.func_149558_e())); packetbuffer = new PacketBuffer(Unpooled.wrappedBuffer(p_147349_1_.func_149558_e()));
@@ -1093,16 +2398,18 @@ @@ -1093,16 +2398,18 @@
{
if (itemstack.getItem() == Items.writable_book && itemstack.getItem() == itemstack1.getItem()) if (itemstack.getItem() == Items.writable_book && itemstack.getItem() == itemstack1.getItem())
{ {
- itemstack1.setTagInfo("pages", itemstack.getTagCompound().getTagList("pages", 8)); - itemstack1.setTagInfo("pages", itemstack.getTagCompound().getTagList("pages", 8));
@ -1818,7 +1818,7 @@
finally finally
{ {
@@ -1135,19 +2442,18 @@ @@ -1135,19 +2442,18 @@
{
if (itemstack.getItem() == Items.written_book && itemstack1.getItem() == Items.writable_book) if (itemstack.getItem() == Items.written_book && itemstack1.getItem() == Items.writable_book)
{ {
- itemstack1.setTagInfo("author", new NBTTagString(this.playerEntity.getCommandSenderName())); - itemstack1.setTagInfo("author", new NBTTagString(this.playerEntity.getCommandSenderName()));

View File

@ -1,17 +1,45 @@
--- ../src-base/minecraft/net/minecraft/world/WorldServer.java --- ../src-base/minecraft/net/minecraft/world/WorldServer.java
+++ ../src-work/minecraft/net/minecraft/world/WorldServer.java +++ ../src-work/minecraft/net/minecraft/world/WorldServer.java
@@ -67,11 +67,25 @@ @@ -1,8 +1,10 @@
package net.minecraft.world;
import com.google.common.collect.Lists;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
import java.io.File;
import java.util.ArrayList;
import java.util.HashSet;
@@ -11,6 +13,7 @@
import java.util.Random;
import java.util.Set;
import java.util.TreeSet;
+
import net.minecraft.block.Block;
import net.minecraft.block.BlockEventData;
import net.minecraft.block.material.Material;
@@ -56,6 +59,7 @@
import net.minecraft.world.chunk.storage.IChunkLoader;
import net.minecraft.world.gen.ChunkProviderServer;
import net.minecraft.world.gen.feature.WorldGeneratorBonusChest;
+import net.minecraft.world.storage.DerivedWorldInfo;
import net.minecraft.world.storage.ISaveHandler;
import net.minecraftforge.common.ChestGenHooks;
import static net.minecraftforge.common.ChestGenHooks.BONUS_CHEST;
@@ -67,11 +71,26 @@
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
+
+// CraftBukkit start +// CraftBukkit start
+import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.BlockJukebox; +import net.minecraft.block.BlockJukebox;
+import net.minecraft.tileentity.*; +import net.minecraft.tileentity.*;
+
+import org.bukkit.WeatherType; +import org.bukkit.WeatherType;
+import org.bukkit.block.BlockState; +import org.bukkit.block.BlockState;
+import org.bukkit.craftbukkit.util.LongHash; +import org.bukkit.craftbukkit.util.LongHash;
+
+import org.bukkit.event.block.BlockFormEvent; +import org.bukkit.event.block.BlockFormEvent;
+import org.bukkit.event.weather.LightningStrikeEvent; +import org.bukkit.event.weather.LightningStrikeEvent;
+import org.bukkit.event.weather.ThunderChangeEvent; +import org.bukkit.event.weather.ThunderChangeEvent;
@ -27,7 +55,7 @@
private final PlayerManager thePlayerManager; private final PlayerManager thePlayerManager;
private Set pendingTickListEntriesHashSet; private Set pendingTickListEntriesHashSet;
private TreeSet pendingTickListEntriesTreeSet; private TreeSet pendingTickListEntriesTreeSet;
@@ -92,9 +106,13 @@ @@ -92,9 +111,13 @@
protected Set<ChunkCoordIntPair> doneChunks = new HashSet<ChunkCoordIntPair>(); protected Set<ChunkCoordIntPair> doneChunks = new HashSet<ChunkCoordIntPair>();
public List<Teleporter> customTeleporters = new ArrayList<Teleporter>(); public List<Teleporter> customTeleporters = new ArrayList<Teleporter>();
@ -41,7 +69,7 @@
this.mcServer = p_i45284_1_; this.mcServer = p_i45284_1_;
this.theEntityTracker = new EntityTracker(this); this.theEntityTracker = new EntityTracker(this);
this.thePlayerManager = new PlayerManager(this); this.thePlayerManager = new PlayerManager(this);
@@ -124,6 +142,47 @@ @@ -124,6 +147,47 @@
this.mapStorage.setData("scoreboard", scoreboardsavedata); this.mapStorage.setData("scoreboard", scoreboardsavedata);
} }
@ -89,7 +117,7 @@
if (!(this instanceof WorldServerMulti)) //Forge: We fix the global mapStorage, which causes us to share scoreboards early. So don't associate the save data with the temporary scoreboard if (!(this instanceof WorldServerMulti)) //Forge: We fix the global mapStorage, which causes us to share scoreboards early. So don't associate the save data with the temporary scoreboard
{ {
scoreboardsavedata.func_96499_a(this.worldScoreboard); scoreboardsavedata.func_96499_a(this.worldScoreboard);
@@ -132,6 +191,31 @@ @@ -132,6 +196,31 @@
DimensionManager.setWorld(p_i45284_4_, this); DimensionManager.setWorld(p_i45284_4_, this);
} }
@ -121,7 +149,7 @@
public void tick() public void tick()
{ {
super.tick(); super.tick();
@@ -155,12 +239,19 @@ @@ -155,12 +244,19 @@
} }
this.theProfiler.startSection("mobSpawner"); this.theProfiler.startSection("mobSpawner");
@ -144,7 +172,15 @@
this.theProfiler.endStartSection("chunkSource"); this.theProfiler.endStartSection("chunkSource");
this.chunkProvider.unloadQueuedChunks(); this.chunkProvider.unloadQueuedChunks();
int j = this.calculateSkylightSubtracted(1.0F); int j = this.calculateSkylightSubtracted(1.0F);
@@ -177,23 +268,40 @@ @@ -170,30 +266,47 @@
this.skylightSubtracted = j;
}
- this.worldInfo.incrementTotalWorldTime(this.worldInfo.getWorldTotalTime() + 1L);
+ this.worldInfo.tick();
if (this.getGameRules().getGameRuleBooleanValue("doDaylightCycle"))
{
this.worldInfo.setWorldTime(this.worldInfo.getWorldTime() + 1L); this.worldInfo.setWorldTime(this.worldInfo.getWorldTime() + 1L);
} }
@ -185,7 +221,7 @@
} }
public BiomeGenBase.SpawnListEntry spawnRandomCreature(EnumCreatureType p_73057_1_, int p_73057_2_, int p_73057_3_, int p_73057_4_) public BiomeGenBase.SpawnListEntry spawnRandomCreature(EnumCreatureType p_73057_1_, int p_73057_2_, int p_73057_3_, int p_73057_4_)
@@ -212,7 +320,7 @@ @@ -212,7 +325,7 @@
{ {
EntityPlayer entityplayer = (EntityPlayer)iterator.next(); EntityPlayer entityplayer = (EntityPlayer)iterator.next();
@ -194,7 +230,7 @@
{ {
this.allPlayersSleeping = false; this.allPlayersSleeping = false;
break; break;
@@ -240,7 +348,25 @@ @@ -240,7 +353,25 @@
private void resetRainAndThunder() private void resetRainAndThunder()
{ {
@ -221,7 +257,7 @@
} }
public boolean areAllPlayersAsleep() public boolean areAllPlayersAsleep()
@@ -248,19 +374,26 @@ @@ -248,19 +379,26 @@
if (this.allPlayersSleeping && !this.isRemote) if (this.allPlayersSleeping && !this.isRemote)
{ {
Iterator iterator = this.playerEntities.iterator(); Iterator iterator = this.playerEntities.iterator();
@ -251,7 +287,7 @@
return false; return false;
} }
else else
@@ -302,15 +435,29 @@ @@ -302,15 +440,29 @@
super.func_147456_g(); super.func_147456_g();
int i = 0; int i = 0;
int j = 0; int j = 0;
@ -287,7 +323,7 @@
this.func_147467_a(k, l, chunk); this.func_147467_a(k, l, chunk);
this.theProfiler.endStartSection("tickChunk"); this.theProfiler.endStartSection("tickChunk");
chunk.func_150804_b(false); chunk.func_150804_b(false);
@@ -346,12 +493,32 @@ @@ -346,12 +498,32 @@
if (this.isBlockFreezableNaturally(j1 + k, l1 - 1, k1 + l)) if (this.isBlockFreezableNaturally(j1 + k, l1 - 1, k1 + l))
{ {
@ -322,7 +358,7 @@
} }
if (this.isRaining()) if (this.isRaining())
@@ -388,6 +555,7 @@ @@ -388,6 +560,7 @@
if (block.getTickRandomly()) if (block.getTickRandomly())
{ {
++i; ++i;
@ -330,7 +366,7 @@
block.updateTick(this, j2 + k, l2 + extendedblockstorage.getYLocation(), k2 + l, this.rand); block.updateTick(this, j2 + k, l2 + extendedblockstorage.getYLocation(), k2 + l, this.rand);
} }
} }
@@ -396,6 +564,13 @@ @@ -396,6 +569,13 @@
this.theProfiler.endSection(); this.theProfiler.endSection();
} }
@ -344,7 +380,7 @@
} }
public boolean isBlockTickScheduledThisTick(int p_147477_1_, int p_147477_2_, int p_147477_3_, Block p_147477_4_) public boolean isBlockTickScheduledThisTick(int p_147477_1_, int p_147477_2_, int p_147477_3_, Block p_147477_4_)
@@ -474,7 +649,7 @@ @@ -474,7 +654,7 @@
public void updateEntities() public void updateEntities()
{ {
@ -353,7 +389,7 @@
{ {
if (this.updateEntityTick++ >= 1200) if (this.updateEntityTick++ >= 1200)
{ {
@@ -506,7 +681,16 @@ @@ -506,7 +686,16 @@
{ {
if (i > 1000) if (i > 1000)
{ {
@ -371,7 +407,7 @@
} }
this.theProfiler.startSection("cleaning"); this.theProfiler.startSection("cleaning");
@@ -651,7 +835,37 @@ @@ -651,7 +840,37 @@
protected IChunkProvider createChunkProvider() protected IChunkProvider createChunkProvider()
{ {
IChunkLoader ichunkloader = this.saveHandler.getChunkLoader(this.provider); IChunkLoader ichunkloader = this.saveHandler.getChunkLoader(this.provider);
@ -410,7 +446,7 @@
return this.theChunkProviderServer; return this.theChunkProviderServer;
} }
@@ -659,29 +873,31 @@ @@ -659,29 +878,31 @@
{ {
ArrayList arraylist = new ArrayList(); ArrayList arraylist = new ArrayList();
@ -457,7 +493,7 @@
return arraylist; return arraylist;
} }
@@ -733,7 +949,28 @@ @@ -733,7 +954,28 @@
int i = 0; int i = 0;
int j = this.provider.getAverageGroundLevel(); int j = this.provider.getAverageGroundLevel();
int k = 0; int k = 0;
@ -486,7 +522,7 @@
if (chunkposition != null) if (chunkposition != null)
{ {
i = chunkposition.chunkPosX; i = chunkposition.chunkPosX;
@@ -876,6 +1113,20 @@ @@ -876,6 +1118,20 @@
public boolean addWeatherEffect(Entity p_72942_1_) public boolean addWeatherEffect(Entity p_72942_1_)
{ {
@ -507,7 +543,7 @@
if (super.addWeatherEffect(p_72942_1_)) if (super.addWeatherEffect(p_72942_1_))
{ {
this.mcServer.getConfigurationManager().sendToAllNear(p_72942_1_.posX, p_72942_1_.posY, p_72942_1_.posZ, 512.0D, this.provider.dimensionId, new S2CPacketSpawnGlobalEntity(p_72942_1_)); this.mcServer.getConfigurationManager().sendToAllNear(p_72942_1_.posX, p_72942_1_.posY, p_72942_1_.posZ, 512.0D, this.provider.dimensionId, new S2CPacketSpawnGlobalEntity(p_72942_1_));
@@ -894,13 +1145,23 @@ @@ -894,13 +1150,23 @@
public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_)
{ {
@ -532,7 +568,7 @@
if (!p_72885_10_) if (!p_72885_10_)
{ {
explosion.affectedBlockPositions.clear(); explosion.affectedBlockPositions.clear();
@@ -977,7 +1238,7 @@ @@ -977,7 +1243,7 @@
{ {
boolean flag = this.isRaining(); boolean flag = this.isRaining();
super.updateWeather(); super.updateWeather();
@ -541,7 +577,7 @@
if (this.prevRainingStrength != this.rainingStrength) if (this.prevRainingStrength != this.rainingStrength)
{ {
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId);
@@ -988,10 +1249,6 @@ @@ -988,10 +1254,6 @@
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId);
} }
@ -552,7 +588,7 @@
if (flag != this.isRaining()) if (flag != this.isRaining())
{ {
if (flag) if (flag)
@@ -1006,6 +1263,33 @@ @@ -1006,6 +1268,33 @@
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId);
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId);
} }
@ -586,7 +622,7 @@
} }
protected int func_152379_p() protected int func_152379_p()
@@ -1069,4 +1353,51 @@ @@ -1069,4 +1358,51 @@
this(); this();
} }
} }

View File

@ -11,8 +11,8 @@
+ // CraftBukkit end + // CraftBukkit end
+ this.mapStorage = p_i45283_6_.mapStorage; + this.mapStorage = p_i45283_6_.mapStorage;
+ this.worldScoreboard = p_i45283_6_.getScoreboard(); + this.worldScoreboard = p_i45283_6_.getScoreboard();
+ this.worldInfo = new DerivedWorldInfo(p_i45283_6_.getWorldInfo()); + //this.worldInfo = new DerivedWorldInfo(p_i45283_6_.getWorldInfo());
+ this.worldInfo.setWorldName(p_i45283_3_); + //this.worldInfo.setWorldName(p_i45283_3_);
+ } + }
+ +
+ // Cauldron start - vanilla compatibility + // Cauldron start - vanilla compatibility

View File

@ -19,7 +19,7 @@
public void setSaveVersion(int p_76078_1_) {} public void setSaveVersion(int p_76078_1_) {}
public void setThundering(boolean p_76069_1_) {} public void setThundering(boolean p_76069_1_) {}
@@ -174,4 +173,12 @@ @@ -174,4 +173,17 @@
{ {
return this.theWorldInfo.getGameRulesInstance(); return this.theWorldInfo.getGameRulesInstance();
} }
@ -30,5 +30,10 @@
+ +
+ public void setDimension(int dim) { + public void setDimension(int dim) {
+ this.theWorldInfo.setDimension(dim); + this.theWorldInfo.setDimension(dim);
+ }
+
+ @Override
+ public void tick() {
+ theWorldInfo.tick();
+ } + }
} }

View File

@ -46,3 +46,12 @@
public int getVanillaDimension() public int getVanillaDimension()
{ {
return this.dimension; return this.dimension;
@@ -556,4 +574,8 @@
{
return this.additionalProperties!=null? this.additionalProperties.get(additionalProperty) : null;
}
+
+ public void tick() {
+ totalTime++;
+ }
}