remove server side debug
This commit is contained in:
parent
f4c024cde7
commit
374e0c4617
22 changed files with 1084 additions and 801 deletions
|
@ -22,7 +22,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
|
@ -111,6 +110,7 @@ import common.entity.Entity;
|
|||
import common.entity.animal.EntityHorse;
|
||||
import common.entity.npc.Energy;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.npc.PlayerCharacter;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.future.Futures;
|
||||
import common.future.ListenableFuture;
|
||||
|
@ -286,6 +286,8 @@ public class Client implements IThreadListener {
|
|||
private final List<Message> feed = Lists.newArrayList();
|
||||
private final List<Message> hotbar = Lists.newArrayList();
|
||||
private final File config = new File(System.getProperty("config.file", "client.cfg"));
|
||||
public final Map<String, Integer> playerList = Maps.<String, Integer>newTreeMap();
|
||||
public final List<PlayerCharacter> characterList = Lists.<PlayerCharacter>newArrayList();
|
||||
|
||||
private boolean primary;
|
||||
private boolean secondary;
|
||||
|
@ -295,7 +297,7 @@ public class Client implements IThreadListener {
|
|||
public boolean jump;
|
||||
public boolean sneak;
|
||||
public boolean debugCamEnable;
|
||||
public boolean debugWorld;
|
||||
public boolean noResolve;
|
||||
public boolean zooming;
|
||||
public boolean sprint;
|
||||
public boolean renderOutlines;
|
||||
|
@ -316,6 +318,7 @@ public class Client implements IThreadListener {
|
|||
public int thirdPersonView;
|
||||
public int timeFactor = 1;
|
||||
public int chunksUpdated;
|
||||
public int selectedCharacter = -1;
|
||||
|
||||
private long lastTicked = 0L;
|
||||
private long debugUpdateTime = System.currentTimeMillis();
|
||||
|
@ -578,7 +581,7 @@ public class Client implements IThreadListener {
|
|||
ClientPlayer netHandler = this.getNetHandler();
|
||||
if(netHandler != null)
|
||||
netHandler.cleanup();
|
||||
this.debugWorld = false;
|
||||
this.noResolve = false;
|
||||
this.charEditor = false;
|
||||
this.viewEntity = null;
|
||||
this.connection = null;
|
||||
|
@ -586,6 +589,9 @@ public class Client implements IThreadListener {
|
|||
this.player = null;
|
||||
this.serverInfo = null;
|
||||
this.lastTickTime = -1;
|
||||
this.selectedCharacter = -1;
|
||||
this.playerList.clear();
|
||||
this.characterList.clear();
|
||||
this.soundManager.stopSounds();
|
||||
}
|
||||
|
||||
|
@ -1885,7 +1891,7 @@ public class Client implements IThreadListener {
|
|||
BlockPos pos = this.pointed.block;
|
||||
State block = this.world.getState(pos);
|
||||
|
||||
if(!this.debugWorld) {
|
||||
if(!this.noResolve) {
|
||||
block = block.getBlock().getActualState(block, this.world, pos);
|
||||
}
|
||||
|
||||
|
@ -2472,7 +2478,7 @@ public class Client implements IThreadListener {
|
|||
|
||||
public void unload(boolean loading) {
|
||||
if(this.world != null && this.getNetHandler() != null)
|
||||
this.getNetHandler().getNetworkManager().closeChannel("Quitting");
|
||||
this.getNetHandler().getConnection().closeChannel("Quitting");
|
||||
this.unloadWorld();
|
||||
this.displayGuiScreen(GuiMenu.INSTANCE);
|
||||
}
|
||||
|
@ -2701,7 +2707,7 @@ public class Client implements IThreadListener {
|
|||
this.registerDebug(Keysym.AE, "Programm sofort beenden und server beenden", new DebugRunner() {
|
||||
public void execute(Keysym key) {
|
||||
if(Client.this.getNetHandler() != null) {
|
||||
Client.this.getNetHandler().getNetworkManager().sendPacket(new CPacketMessage(CPacketMessage.Type.COMMAND, "shutdown"), new GenericFutureListener<Future<? super Void>>() {
|
||||
Client.this.getNetHandler().getConnection().sendPacket(new CPacketMessage(CPacketMessage.Type.COMMAND, "shutdown"), new GenericFutureListener<Future<? super Void>>() {
|
||||
public void operationComplete(Future<? super Void> u) throws Exception {
|
||||
try {
|
||||
Thread.sleep(1000L);
|
||||
|
@ -3192,13 +3198,12 @@ public class Client implements IThreadListener {
|
|||
public void drawInfo() {
|
||||
ClientPlayer netHandler = this.getNetHandler();
|
||||
if(netHandler != null) {
|
||||
Set<Entry<String, Integer>> list = netHandler.getPlayerList();
|
||||
int size = list.size();
|
||||
int size = this.playerList.size();
|
||||
int w = size > 80 ? 4 : (size > 40 ? 3 : (size > 10 ? 2 : 1));
|
||||
w = Math.min(w, Math.max(1, this.fb_x / 300));
|
||||
int bx = 0;
|
||||
int by = 0;
|
||||
for(Entry<String, Integer> elem : list) {
|
||||
for(Entry<String, Integer> elem : this.playerList.entrySet()) {
|
||||
int x = this.fb_x / 2 - (w * 300) / 2 + bx * 300;
|
||||
int y = 10 + by * Font.YGLYPH;
|
||||
Drawing.drawGradient(x, y, 300, Font.YGLYPH, 0x7f404040, 0x7f000000);
|
||||
|
|
|
@ -10,7 +10,6 @@ import client.gui.element.PressType;
|
|||
import client.gui.element.FieldAction;
|
||||
import client.gui.element.Field;
|
||||
import client.gui.element.FieldCallback;
|
||||
import client.network.ClientPlayer;
|
||||
import client.vars.BoolVar;
|
||||
import client.vars.CVar;
|
||||
import client.gui.element.TransparentArea;
|
||||
|
@ -218,7 +217,7 @@ public class GuiConsole extends Gui implements FieldCallback {
|
|||
s = argv[argv.length - 1];
|
||||
Iterable<String> res = pre.startsWith("#") ?
|
||||
(argv.length == 1 ? this.gm.getVars() : (argv.length == 2 ? getVarCompletion(argv[0].substring(1)) : Lists.newArrayList())) :
|
||||
(this.gm.player == null ? Lists.newArrayList() : ((ClientPlayer)this.gm.player.client).getPlayerNames());
|
||||
(this.gm.player == null ? Lists.newArrayList() : this.gm.playerList.keySet());
|
||||
if(argv.length == 1 && pre.startsWith("#"))
|
||||
s = s.substring(1);
|
||||
for(String s1 : res) {
|
||||
|
|
|
@ -9,6 +9,7 @@ import client.gui.element.Label;
|
|||
import client.gui.element.NavButton;
|
||||
import client.gui.element.PressType;
|
||||
import client.gui.options.GuiOptions;
|
||||
import client.network.DummyPlayer;
|
||||
import client.renderer.Drawing;
|
||||
import client.window.Keysym;
|
||||
import common.color.TextColor;
|
||||
|
@ -53,6 +54,10 @@ public class GuiMenu extends Gui {
|
|||
this.resetAnimation();
|
||||
this.add(new ActButton(0, -28, 400, 24, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
if(action == PressType.SECONDARY) {
|
||||
new DummyPlayer(GuiMenu.this.gm).join();
|
||||
return;
|
||||
}
|
||||
if(GuiMenu.this.hacked == 9) {
|
||||
GuiMenu.this.hacked++;
|
||||
GuiMenu.this.splashLabel.setText(TextColor.VIOLET + "Hax!");
|
||||
|
|
|
@ -13,6 +13,7 @@ import client.renderer.Drawing;
|
|||
import common.color.TextColor;
|
||||
import common.entity.npc.PlayerCharacter;
|
||||
import common.packet.CPacketAction;
|
||||
import common.util.ExtMath;
|
||||
|
||||
public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry> implements ButtonCallback
|
||||
{
|
||||
|
@ -71,14 +72,12 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry> impleme
|
|||
super.init(width, height);
|
||||
this.setDimensions(600, height, 32, height - 32);
|
||||
this.elements.clear();
|
||||
if(this.gm.getNetHandler() != null) {
|
||||
int initialSelection = this.gm.getNetHandler().getSelectedCharacter();
|
||||
for(PlayerCharacter character : this.gm.getNetHandler().getCharacterList()) {
|
||||
this.elements.add(new CharacterEntry(initialSelection == this.elements.size() ? new PlayerCharacter(character.name(), character.info(), character.align(), this.gm.player.worldObj.dimension.getFormattedName(false), this.gm.player.getPosition(), character.type(), this.gm.player.experienceLevel) : character, initialSelection == this.elements.size()));
|
||||
}
|
||||
this.elements.add(new CharacterEntry(null, false));
|
||||
this.setSelected(initialSelection);
|
||||
}
|
||||
int selected = this.gm.selectedCharacter;
|
||||
for(PlayerCharacter character : this.gm.characterList) {
|
||||
this.elements.add(new CharacterEntry(selected == this.elements.size() ? new PlayerCharacter(character.name(), character.info(), character.align(), this.gm.player.worldObj.dimension.getFormattedName(false), this.gm.player.getPosition(), character.type(), this.gm.player.experienceLevel) : character, selected == this.elements.size()));
|
||||
}
|
||||
this.elements.add(new CharacterEntry(null, false));
|
||||
this.setSelected(ExtMath.clampi(selected, -1, this.elements.size() - 1));
|
||||
this.descField = this.add(new TransparentArea(width - 390, 62, 380, height - 124, "", false));
|
||||
this.deleteButtom = this.add(new ActButton(width / 2 - 304, height - 28, 200, 24, this, "Charakter löschen"));
|
||||
this.actionButtom = this.add(new ActButton(width / 2 - 100, height - 28, 200, 24, this, ""));
|
||||
|
|
|
@ -198,7 +198,6 @@ public class ClientLoginHandler implements IClientLoginHandler {
|
|||
return;
|
||||
}
|
||||
this.state = LoginState.DONE;
|
||||
this.gm.debugWorld = packet.isDebug();
|
||||
this.connection.setConnectionState(PacketRegistry.PLAY);
|
||||
this.connection.setNetHandler(new ClientPlayer(this.gm, this.connection));
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
67
client/src/main/java/client/network/DummyConnection.java
Normal file
67
client/src/main/java/client/network/DummyConnection.java
Normal file
|
@ -0,0 +1,67 @@
|
|||
package client.network;
|
||||
|
||||
import javax.crypto.SecretKey;
|
||||
|
||||
import common.net.channel.ChannelHandlerContext;
|
||||
import common.net.util.concurrent.Future;
|
||||
import common.net.util.concurrent.GenericFutureListener;
|
||||
import common.network.NetConnection;
|
||||
import common.network.NetHandler;
|
||||
import common.network.Packet;
|
||||
import common.network.PacketRegistry;
|
||||
|
||||
public class DummyConnection extends NetConnection {
|
||||
public void channelActive(ChannelHandlerContext context) throws Exception {
|
||||
}
|
||||
|
||||
public void setConnectionState(PacketRegistry newState) {
|
||||
}
|
||||
|
||||
public void channelInactive(ChannelHandlerContext context) throws Exception {
|
||||
}
|
||||
|
||||
public void exceptionCaught(ChannelHandlerContext context, Throwable throwable) throws Exception {
|
||||
}
|
||||
|
||||
protected void channelRead0(ChannelHandlerContext context, Packet packet) throws Exception {
|
||||
}
|
||||
|
||||
public void setNetHandler(NetHandler handler) {
|
||||
}
|
||||
|
||||
public void sendPacket(Packet packet) {
|
||||
}
|
||||
|
||||
public void sendPacket(Packet packet, GenericFutureListener<? extends Future<? super Void>> listener) {
|
||||
}
|
||||
|
||||
public void processReceivedPackets() {
|
||||
}
|
||||
|
||||
public String getCutAddress() {
|
||||
return "local";
|
||||
}
|
||||
|
||||
public void closeChannel(String message) {
|
||||
}
|
||||
|
||||
public boolean isChannelOpen() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasNoChannel() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void disableAutoRead() {
|
||||
}
|
||||
|
||||
public void setCompressionTreshold(int treshold) {
|
||||
}
|
||||
|
||||
public void checkDisconnected() {
|
||||
}
|
||||
|
||||
public void startEncryption(SecretKey key) {
|
||||
}
|
||||
}
|
321
client/src/main/java/client/network/DummyPlayer.java
Normal file
321
client/src/main/java/client/network/DummyPlayer.java
Normal file
|
@ -0,0 +1,321 @@
|
|||
package client.network;
|
||||
|
||||
import client.Client;
|
||||
import client.util.DummyController;
|
||||
import client.world.WorldClient;
|
||||
import common.dimension.Space;
|
||||
import common.entity.Entity;
|
||||
import common.entity.animal.EntityHorse;
|
||||
import common.entity.npc.EntityCpu;
|
||||
import common.init.EntityRegistry;
|
||||
import common.inventory.IInventory;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.model.ParticleType;
|
||||
import common.network.Packet;
|
||||
import common.packet.SPacketEntity;
|
||||
import common.packet.SPacketEntityTeleport;
|
||||
import common.packet.SPacketEntityHeadLook;
|
||||
import common.packet.SPacketEntityStatus;
|
||||
import common.packet.SPacketEntityAttach;
|
||||
import common.packet.SPacketEntityMetadata;
|
||||
import common.packet.SPacketEntityEffect;
|
||||
import common.packet.SPacketRemoveEntityEffect;
|
||||
import common.packet.SPacketEntityProperties;
|
||||
import common.packet.SPacketExplosion;
|
||||
import common.packet.SPacketEffect;
|
||||
import common.packet.SPacketSoundEffect;
|
||||
import common.packet.SPacketParticles;
|
||||
import common.packet.SPacketChangeGameState;
|
||||
import common.packet.SPacketSpawnGlobalEntity;
|
||||
import common.packet.SPacketOpenWindow;
|
||||
import common.packet.SPacketCloseWindow;
|
||||
import common.packet.SPacketSetSlot;
|
||||
import common.packet.SPacketWindowItems;
|
||||
import common.packet.SPacketWindowProperty;
|
||||
import common.packet.SPacketConfirmTransaction;
|
||||
import common.packet.SPacketUpdateSign;
|
||||
import common.packet.SPacketUpdateTileEntity;
|
||||
import common.packet.SPacketSignEditorOpen;
|
||||
import common.packet.SPacketPlayerListItem;
|
||||
import common.packet.SPacketPlayerAbilities;
|
||||
import common.packet.SPacketTabComplete;
|
||||
import common.packet.SPacketUpdateEntityTags;
|
||||
import common.packet.SPacketAnimation;
|
||||
import common.packet.SPacketBiome;
|
||||
import common.packet.SPacketBlockAction;
|
||||
import common.packet.SPacketBlockBreakAnim;
|
||||
import common.packet.SPacketBlockChange;
|
||||
import common.packet.SPacketCamera;
|
||||
import common.packet.SPacketCharacterList;
|
||||
import common.packet.SPacketChunkData;
|
||||
import common.packet.SPacketCollectItem;
|
||||
import common.packet.SPacketDestroyEntities;
|
||||
import common.packet.SPacketDimensionName;
|
||||
import common.packet.SPacketDisconnect;
|
||||
import common.packet.SPacketDisplayForm;
|
||||
import common.packet.SPacketEntityEquipment;
|
||||
import common.packet.SPacketEntityVelocity;
|
||||
import common.packet.SPacketHeldItemChange;
|
||||
import common.packet.SPacketJoinGame;
|
||||
import common.packet.SPacketKeepAlive;
|
||||
import common.packet.SPacketLoading;
|
||||
import common.packet.SPacketMapChunkBulk;
|
||||
import common.packet.SPacketMessage;
|
||||
import common.packet.SPacketMultiBlockChange;
|
||||
import common.packet.SPacketPlayerPosLook;
|
||||
import common.packet.SPacketRespawn;
|
||||
import common.packet.SPacketServerTick;
|
||||
import common.packet.SPacketSetExperience;
|
||||
import common.packet.SPacketSkin;
|
||||
import common.packet.SPacketSpawnMob;
|
||||
import common.packet.SPacketSpawnObject;
|
||||
import common.packet.SPacketSpawnPlayer;
|
||||
import common.packet.SPacketTimeUpdate;
|
||||
import common.packet.SPacketTrades;
|
||||
import common.packet.SPacketUpdateHealth;
|
||||
import common.packet.SPacketWorld;
|
||||
import common.potion.Potion;
|
||||
import common.potion.PotionEffect;
|
||||
import common.sound.Sound;
|
||||
import common.tileentity.IInteractionObject;
|
||||
import common.util.BlockPos;
|
||||
import common.world.World;
|
||||
|
||||
public class DummyPlayer extends ClientPlayer {
|
||||
public DummyPlayer(Client gm) {
|
||||
super(gm, new DummyConnection());
|
||||
}
|
||||
|
||||
public void join() {
|
||||
this.gm.noResolve = true;
|
||||
this.gm.charEditor = false;
|
||||
this.gm.controller = new DummyController(this);
|
||||
WorldClient world = new WorldClient(this.gm, true, Space.INSTANCE);
|
||||
this.gm.loadWorld(world, EntityRegistry.getEntityID(EntityCpu.class));
|
||||
this.gm.player.setId(0);
|
||||
this.gm.displayGuiScreen(null);
|
||||
this.gm.player.flying = true;
|
||||
this.gm.player.noclip = true;
|
||||
this.gm.player.addEffect(new PotionEffect(Potion.FLYING, Integer.MAX_VALUE, 1));
|
||||
this.gm.player.setHeight(2.0f);
|
||||
world.setGravity(this.gm.gravity = 1.0f);
|
||||
world.setTimeFactor(this.gm.timeFactor = 1);
|
||||
this.gm.dayCycle = true;
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
}
|
||||
|
||||
public void playSound(Sound sound) {
|
||||
}
|
||||
|
||||
public void emitParticleAtEntity(Entity entityIn, ParticleType particleTypes) {
|
||||
}
|
||||
|
||||
public void displayGUIChest(IInventory chestInventory, InventoryPlayer inventory) {
|
||||
}
|
||||
|
||||
public void displayGui(IInteractionObject guiOwner, InventoryPlayer inventory, World worldObj) {
|
||||
}
|
||||
|
||||
public void displayGuiHorse(EntityHorse horse, InventoryPlayer inventory, IInventory horseInventory) {
|
||||
}
|
||||
|
||||
public void displayGuiMerchant(String title, InventoryPlayer inventory, World worldObj) {
|
||||
}
|
||||
|
||||
public void displayGuiSign(BlockPos pos, String[] text) {
|
||||
}
|
||||
|
||||
public void onDisconnect(String reason) {
|
||||
}
|
||||
|
||||
public void addToSendQueue(Packet packet) {
|
||||
}
|
||||
|
||||
public void handleJoinGame(SPacketJoinGame packetIn) {
|
||||
}
|
||||
|
||||
public void handleSpawnObject(SPacketSpawnObject packetIn) {
|
||||
}
|
||||
|
||||
public void handleSpawnGlobalEntity(SPacketSpawnGlobalEntity packetIn) {
|
||||
}
|
||||
|
||||
public void handleEntityVelocity(SPacketEntityVelocity packetIn) {
|
||||
}
|
||||
|
||||
public void handleEntityMetadata(SPacketEntityMetadata packetIn) {
|
||||
}
|
||||
|
||||
public void handleSpawnPlayer(SPacketSpawnPlayer packetIn) {
|
||||
}
|
||||
|
||||
public void handleEntityTeleport(SPacketEntityTeleport packetIn) {
|
||||
}
|
||||
|
||||
public void handleHeldItemChange(SPacketHeldItemChange packetIn) {
|
||||
}
|
||||
|
||||
public void handleEntityMovement(SPacketEntity packetIn) {
|
||||
}
|
||||
|
||||
public void handleEntityHeadLook(SPacketEntityHeadLook packetIn) {
|
||||
}
|
||||
|
||||
public void handleDestroyEntities(SPacketDestroyEntities packetIn) {
|
||||
}
|
||||
|
||||
public void handlePlayerPosLook(SPacketPlayerPosLook packetIn) {
|
||||
}
|
||||
|
||||
public void handleMultiBlockChange(SPacketMultiBlockChange packetIn) {
|
||||
}
|
||||
|
||||
public void handleChunkData(SPacketChunkData packetIn) {
|
||||
}
|
||||
|
||||
public void handleBiomes(SPacketBiome packetIn) {
|
||||
}
|
||||
|
||||
public void handleBlockChange(SPacketBlockChange packetIn) {
|
||||
}
|
||||
|
||||
public void handleDisconnect(SPacketDisconnect packetIn) {
|
||||
}
|
||||
|
||||
public void handleCollectItem(SPacketCollectItem packetIn) {
|
||||
}
|
||||
|
||||
public void handleMessage(SPacketMessage packetIn) {
|
||||
}
|
||||
|
||||
public void handleLoading(SPacketLoading packet) {
|
||||
}
|
||||
|
||||
public void handleAnimation(SPacketAnimation packetIn) {
|
||||
}
|
||||
|
||||
public void handleSpawnMob(SPacketSpawnMob packetIn) {
|
||||
}
|
||||
|
||||
public void handleTimeUpdate(SPacketTimeUpdate packetIn) {
|
||||
}
|
||||
|
||||
public void handleServerTick(SPacketServerTick packet) {
|
||||
}
|
||||
|
||||
public void handleEntityAttach(SPacketEntityAttach packetIn) {
|
||||
}
|
||||
|
||||
public void handleEntityStatus(SPacketEntityStatus packetIn) {
|
||||
}
|
||||
|
||||
public void handleUpdateHealth(SPacketUpdateHealth packetIn) {
|
||||
}
|
||||
|
||||
public void handleSetExperience(SPacketSetExperience packetIn) {
|
||||
}
|
||||
|
||||
public void handleRespawn(SPacketRespawn packetIn) {
|
||||
}
|
||||
|
||||
public void handleExplosion(SPacketExplosion packetIn) {
|
||||
}
|
||||
|
||||
public void handleOpenWindow(SPacketOpenWindow packetIn) {
|
||||
}
|
||||
|
||||
public void handleSetSlot(SPacketSetSlot packetIn) {
|
||||
}
|
||||
|
||||
public void handleConfirmTransaction(SPacketConfirmTransaction packetIn) {
|
||||
}
|
||||
|
||||
public void handleWindowItems(SPacketWindowItems packetIn) {
|
||||
}
|
||||
|
||||
public void handleSignEditorOpen(SPacketSignEditorOpen packetIn) {
|
||||
}
|
||||
|
||||
public void handleForm(SPacketDisplayForm packet) {
|
||||
}
|
||||
|
||||
public void handleUpdateSign(SPacketUpdateSign packetIn) {
|
||||
}
|
||||
|
||||
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn) {
|
||||
}
|
||||
|
||||
public void handleWindowProperty(SPacketWindowProperty packetIn) {
|
||||
}
|
||||
|
||||
public void handleEntityEquipment(SPacketEntityEquipment packetIn) {
|
||||
}
|
||||
|
||||
public void handleCloseWindow(SPacketCloseWindow packetIn) {
|
||||
}
|
||||
|
||||
public void handleBlockAction(SPacketBlockAction packetIn) {
|
||||
}
|
||||
|
||||
public void handleBlockBreakAnim(SPacketBlockBreakAnim packetIn) {
|
||||
}
|
||||
|
||||
public void handleMapChunkBulk(SPacketMapChunkBulk packetIn) {
|
||||
}
|
||||
|
||||
public void handleChangeGameState(SPacketChangeGameState packetIn) {
|
||||
}
|
||||
|
||||
public void handleEffect(SPacketEffect packetIn) {
|
||||
}
|
||||
|
||||
public void handleEntityEffect(SPacketEntityEffect packetIn) {
|
||||
}
|
||||
|
||||
public void handleCamera(SPacketCamera packetIn) {
|
||||
}
|
||||
|
||||
public void handleRemoveEntityEffect(SPacketRemoveEntityEffect packetIn) {
|
||||
}
|
||||
|
||||
public void handlePlayerListItem(SPacketPlayerListItem packetIn) {
|
||||
}
|
||||
|
||||
public void handleCharacterList(SPacketCharacterList packet) {
|
||||
}
|
||||
|
||||
public void handleKeepAlive(SPacketKeepAlive packetIn) {
|
||||
}
|
||||
|
||||
public void handlePlayerAbilities(SPacketPlayerAbilities packetIn) {
|
||||
}
|
||||
|
||||
public void handleTabComplete(SPacketTabComplete packetIn) {
|
||||
}
|
||||
|
||||
public void handleSoundEffect(SPacketSoundEffect packetIn) {
|
||||
}
|
||||
|
||||
public void handleEntityTags(SPacketUpdateEntityTags packetIn) {
|
||||
}
|
||||
|
||||
public void handleParticles(SPacketParticles packetIn) {
|
||||
}
|
||||
|
||||
public void handleEntityProperties(SPacketEntityProperties packetIn) {
|
||||
}
|
||||
|
||||
public void handleSkin(SPacketSkin packetIn) {
|
||||
}
|
||||
|
||||
public void handleTrades(SPacketTrades packetIn) {
|
||||
}
|
||||
|
||||
public void handleWorld(SPacketWorld packetIn) {
|
||||
}
|
||||
|
||||
public void handleDimName(SPacketDimensionName packetIn) {
|
||||
}
|
||||
}
|
|
@ -96,7 +96,7 @@ public class BlockRenderer
|
|||
{
|
||||
Block block = state.getBlock();
|
||||
|
||||
if (!this.gm.debugWorld)
|
||||
if (!this.gm.noResolve)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
77
client/src/main/java/client/util/DummyController.java
Normal file
77
client/src/main/java/client/util/DummyController.java
Normal file
|
@ -0,0 +1,77 @@
|
|||
package client.util;
|
||||
|
||||
import client.network.DummyPlayer;
|
||||
import client.world.WorldClient;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.EntityRegistry;
|
||||
import common.item.ItemStack;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Vec3;
|
||||
import common.world.World;
|
||||
|
||||
public class DummyController extends PlayerController {
|
||||
private final DummyPlayer player;
|
||||
|
||||
public DummyController(DummyPlayer player) {
|
||||
super(null, null);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public boolean destroyBlock(BlockPos pos, Facing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean clickBlock(BlockPos pos, Facing face) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void resetProgress() {
|
||||
}
|
||||
|
||||
public void resetInteraction() {
|
||||
}
|
||||
|
||||
public boolean damageBlock(BlockPos pos, Facing face) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
}
|
||||
|
||||
public boolean clickRight(EntityNPC player, WorldClient world, ItemStack stack, BlockPos pos, Facing side, Vec3 hit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean sendUseItem(EntityNPC player, World world, ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public EntityNPC createPlayerEntity(WorldClient world, int type) {
|
||||
EntityNPC player = (EntityNPC)EntityRegistry.createEntityByID(type, world);
|
||||
player.setClientPlayer(this.player);
|
||||
return player;
|
||||
}
|
||||
|
||||
public void attackEntity(EntityNPC player, Entity target) {
|
||||
}
|
||||
|
||||
public boolean interact(EntityNPC player, Entity target) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack windowClick(int window, int slot, int button, int mode, EntityNPC player) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void sendEnchantPacket(int window, int button) {
|
||||
}
|
||||
|
||||
public void stopUsing(EntityNPC player) {
|
||||
}
|
||||
|
||||
public boolean isHittingBlock() {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -175,11 +175,11 @@ public class PlayerController {
|
|||
public void update() {
|
||||
this.syncItem();
|
||||
|
||||
if(this.handler.getNetworkManager().isChannelOpen()) {
|
||||
this.handler.getNetworkManager().processReceivedPackets();
|
||||
if(this.handler.getConnection().isChannelOpen()) {
|
||||
this.handler.getConnection().processReceivedPackets();
|
||||
}
|
||||
else {
|
||||
this.handler.getNetworkManager().checkDisconnected();
|
||||
this.handler.getConnection().checkDisconnected();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,24 +5,60 @@ import java.util.function.Predicate;
|
|||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.collect.Lists;
|
||||
import common.entity.Entity;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.ExtMath;
|
||||
import common.world.LightType;
|
||||
import common.world.State;
|
||||
|
||||
public class ChunkEmpty extends ChunkClient {
|
||||
private static final List<State> STATES = Lists.<State>newArrayList();
|
||||
private static final int XSTRETCH;
|
||||
private static final int ZSTRETCH;
|
||||
|
||||
private final boolean debug;
|
||||
private final int liquidY;
|
||||
private final State liquid;
|
||||
private final Block liquidBlock;
|
||||
private final State dummy;
|
||||
private final Block dummyBlock;
|
||||
|
||||
public ChunkEmpty(WorldClient world) {
|
||||
static {
|
||||
for(Block block : BlockRegistry.REGISTRY) {
|
||||
STATES.addAll(block.getValidStates());
|
||||
}
|
||||
XSTRETCH = ExtMath.ceilf(ExtMath.sqrtf((float)STATES.size()));
|
||||
ZSTRETCH = ExtMath.ceilf((float)STATES.size() / (float)XSTRETCH);
|
||||
}
|
||||
|
||||
private static State getDebug(int x, int z) {
|
||||
State state = null;
|
||||
if(x > 0 && z > 0 && x % 2 != 0 && z % 2 != 0) {
|
||||
x = x / 2;
|
||||
z = z / 2;
|
||||
if(x <= XSTRETCH && z <= ZSTRETCH) {
|
||||
int idx = ExtMath.absi(x * XSTRETCH + z);
|
||||
if(idx < STATES.size()) {
|
||||
state = STATES.get(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
public ChunkEmpty(WorldClient world, boolean debug) {
|
||||
super(world, 0, 0);
|
||||
this.debug = debug;
|
||||
this.liquidY = world.dimension.getSeaLevel() - 1;
|
||||
this.liquid = world.dimension.getLiquid();
|
||||
this.liquidBlock = this.liquid.getBlock();
|
||||
this.dummyBlock = this.fillerBlock == Blocks.air ? Blocks.air : Blocks.bedrock;
|
||||
this.dummy = this.dummyBlock.getState();
|
||||
}
|
||||
|
||||
public int getHeight(int x, int z) {
|
||||
|
@ -30,7 +66,7 @@ public class ChunkEmpty extends ChunkClient {
|
|||
}
|
||||
|
||||
public Block getBlock(BlockPos pos) {
|
||||
return pos.getY() < this.liquidY ? Blocks.bedrock : (pos.getY() == this.liquidY ? this.liquidBlock : Blocks.air);
|
||||
return pos.getY() < this.liquidY ? this.dummyBlock : (pos.getY() == this.liquidY ? this.liquidBlock : Blocks.air);
|
||||
}
|
||||
|
||||
public int getLight(LightType type, BlockPos pos) {
|
||||
|
@ -79,7 +115,11 @@ public class ChunkEmpty extends ChunkClient {
|
|||
}
|
||||
|
||||
public State getState(BlockPos pos) {
|
||||
return pos.getY() < this.liquidY ? Blocks.bedrock.getState() : (pos.getY() == this.liquidY ? this.liquid : Blocks.air.getState());
|
||||
if(this.debug) {
|
||||
State state = pos.getY() == 1 ? getDebug(pos.getX(), pos.getZ()) : null;
|
||||
return state == null ? Blocks.air.getState() : state;
|
||||
}
|
||||
return pos.getY() < this.liquidY ? this.dummy : (pos.getY() == this.liquidY ? this.liquid : Blocks.air.getState());
|
||||
}
|
||||
|
||||
public State setState(BlockPos pos, State state) {
|
||||
|
|
|
@ -42,6 +42,7 @@ public class WorldClient extends AWorldClient
|
|||
private static final int DISPLAY_RANGE = 16;
|
||||
|
||||
private final Client gm;
|
||||
private final ChunkClient emptyChunk;
|
||||
private final Set<Entity> entityList = Sets.<Entity>newHashSet();
|
||||
private final Set<Entity> spawnQueue = Sets.<Entity>newHashSet();
|
||||
private final Set<ChunkPos> previousActive = Sets.<ChunkPos>newHashSet();
|
||||
|
@ -49,15 +50,15 @@ public class WorldClient extends AWorldClient
|
|||
private final List<ChunkClient> chunkListing = Lists.<ChunkClient>newArrayList();
|
||||
private final Set<Long> emptyChunkListing = Sets.<Long>newHashSet();
|
||||
private final Set<Long> nextEmptyChunkListing = Sets.<Long>newHashSet();
|
||||
private final ChunkClient emptyChunk = new ChunkEmpty(this);
|
||||
// public final Profiler profiler;
|
||||
protected int lastLightning;
|
||||
protected Vec3 lightColor = new Vec3(0xffffff);
|
||||
|
||||
public WorldClient(Client gm, boolean debug, Dimension dim)
|
||||
{
|
||||
super(dim, debug);
|
||||
super(dim);
|
||||
this.gm = gm;
|
||||
this.emptyChunk = new ChunkEmpty(this, debug);
|
||||
this.calculateInitialSkylight();
|
||||
this.calculateInitialWeather();
|
||||
this.setGravity(this.gm.gravity);
|
||||
|
|
|
@ -7,28 +7,16 @@ import common.network.Packet;
|
|||
import common.network.PacketBuffer;
|
||||
|
||||
public class RPacketLoginSuccess implements Packet<IClientLoginHandler> {
|
||||
private boolean debug;
|
||||
|
||||
public RPacketLoginSuccess() {
|
||||
}
|
||||
|
||||
public RPacketLoginSuccess(boolean debug) {
|
||||
this.debug = debug;
|
||||
}
|
||||
|
||||
public final void readPacketData(PacketBuffer buf) throws IOException {
|
||||
this.debug = buf.readBoolean();
|
||||
}
|
||||
|
||||
public final void writePacketData(PacketBuffer buf) throws IOException {
|
||||
buf.writeBoolean(this.debug);
|
||||
}
|
||||
|
||||
public void processPacket(IClientLoginHandler handler) {
|
||||
handler.handleLoginSuccess(this);
|
||||
}
|
||||
|
||||
public boolean isDebug() {
|
||||
return this.debug;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@ import common.init.SoundEvent;
|
|||
import common.tags.TagObject;
|
||||
|
||||
public abstract class AWorldClient extends World {
|
||||
protected AWorldClient(Dimension dim, boolean debug) {
|
||||
super(dim, true, debug);
|
||||
protected AWorldClient(Dimension dim) {
|
||||
super(dim, true);
|
||||
}
|
||||
|
||||
public abstract void playSound(double x, double y, double z, SoundEvent sound, float volume);
|
||||
|
|
|
@ -17,8 +17,8 @@ import common.util.PortalType;
|
|||
import common.village.Village;
|
||||
|
||||
public abstract class AWorldServer extends World {
|
||||
protected AWorldServer(Dimension dim, boolean debug) {
|
||||
super(dim, false, debug);
|
||||
protected AWorldServer(Dimension dim) {
|
||||
super(dim, false);
|
||||
}
|
||||
|
||||
public abstract List<IPlayer> getAllPlayers();
|
||||
|
|
|
@ -300,11 +300,6 @@ public abstract class Chunk {
|
|||
}
|
||||
|
||||
public State getState(BlockPos pos) {
|
||||
if(this.world.debug) {
|
||||
State state = pos.getY() == 1 ? DebugStates.getState(pos.getX(), pos.getZ()) : null;
|
||||
return state == null ? Blocks.air.getState() : state;
|
||||
}
|
||||
|
||||
BlockArray stor = this.getArray(pos.getY() >> 4);
|
||||
return stor != null ? stor.get(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15) : (pos.getY() < 0 ? this.filler : Blocks.air.getState());
|
||||
}
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
package common.world;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.collect.Lists;
|
||||
import common.init.BlockRegistry;
|
||||
import common.util.ExtMath;
|
||||
|
||||
public class DebugStates {
|
||||
private static final List<State> STATES = Lists.<State>newArrayList();
|
||||
private static final int XSTRETCH;
|
||||
private static final int ZSTRETCH;
|
||||
|
||||
static {
|
||||
for(Block block : BlockRegistry.REGISTRY) {
|
||||
STATES.addAll(block.getValidStates());
|
||||
}
|
||||
XSTRETCH = ExtMath.ceilf(ExtMath.sqrtf((float)STATES.size()));
|
||||
ZSTRETCH = ExtMath.ceilf((float)STATES.size() / (float)XSTRETCH);
|
||||
}
|
||||
|
||||
public static State getState(int x, int z) {
|
||||
State state = null;
|
||||
if(x > 0 && z > 0 && x % 2 != 0 && z % 2 != 0) {
|
||||
x = x / 2;
|
||||
z = z / 2;
|
||||
if(x <= XSTRETCH && z <= ZSTRETCH) {
|
||||
int idx = ExtMath.absi(x * XSTRETCH + z);
|
||||
if(idx < STATES.size()) {
|
||||
state = STATES.get(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
}
|
|
@ -58,7 +58,6 @@ public abstract class World implements IWorldAccess {
|
|||
// private static long lastUpdate;
|
||||
|
||||
public final boolean client;
|
||||
public final boolean debug;
|
||||
public double gravity = 1.0;
|
||||
protected long timeFactor = 1L;
|
||||
public final Random rand = new Random();
|
||||
|
@ -116,14 +115,13 @@ public abstract class World implements IWorldAccess {
|
|||
return pos.getX() >= -MAX_SIZE && pos.getZ() >= -MAX_SIZE && pos.getX() < MAX_SIZE && pos.getZ() < MAX_SIZE;
|
||||
}
|
||||
|
||||
protected World(Dimension dim, boolean client, boolean debug) {
|
||||
protected World(Dimension dim, boolean client) {
|
||||
// this.profiler = profiler;
|
||||
// this.info = info;
|
||||
// this.dimInfo = info.getDimension(dim.getDimensionId());
|
||||
this.dimension = dim;
|
||||
// this.storage = storage;
|
||||
this.client = client;
|
||||
this.debug = debug;
|
||||
this.weather = dim.getWeather();
|
||||
}
|
||||
|
||||
|
@ -200,9 +198,6 @@ public abstract class World implements IWorldAccess {
|
|||
if(!isValid(pos)) {
|
||||
return false;
|
||||
}
|
||||
else if(!this.client && this.debug) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
Chunk chunk = this.getChunk(pos);
|
||||
Block block = newState.getBlock();
|
||||
|
@ -225,7 +220,7 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
|
||||
if(!this.client && (flags & 1) != 0) {
|
||||
this.notifyNeighborsRespectDebug(pos, iblockstate.getBlock());
|
||||
this.notifyNeighborsOfStateChange(pos, iblockstate.getBlock());
|
||||
|
||||
if(block.hasComparatorInputOverride()) {
|
||||
this.updateComparatorOutputLevel(pos, block);
|
||||
|
@ -263,12 +258,6 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
}
|
||||
|
||||
public void notifyNeighborsRespectDebug(BlockPos pos, Block blockType) {
|
||||
if(!this.debug) {
|
||||
this.notifyNeighborsOfStateChange(pos, blockType);
|
||||
}
|
||||
}
|
||||
|
||||
public void markBlocksDirtyVertical(int x1, int z1, int x2, int z2) {
|
||||
if(x2 > z2) {
|
||||
int i = z2;
|
||||
|
|
|
@ -121,7 +121,6 @@ public final class Server implements IThreadListener {
|
|||
private final List<Dimension> unload = Lists.<Dimension>newArrayList();
|
||||
private final Map<String, Position> warps = Maps.<String, Position>newTreeMap();
|
||||
private final CommandEnvironment scriptEnv = new CommandEnvironment(this);
|
||||
private final boolean debug;
|
||||
|
||||
private KeyPair keyPair;
|
||||
private WorldServer space;
|
||||
|
@ -158,8 +157,7 @@ public final class Server implements IThreadListener {
|
|||
UniverseRegistry.register();
|
||||
RotationRegistry.register();
|
||||
ReorderRegistry.register();
|
||||
boolean debug = System.getProperty("server.debug", null) != null;
|
||||
final Server server = new Server(debug);
|
||||
final Server server = new Server();
|
||||
Registry.addShutdownHook(new Runnable() {
|
||||
public void run() {
|
||||
server.stopServer();
|
||||
|
@ -240,8 +238,7 @@ public final class Server implements IThreadListener {
|
|||
return World.START_TIME;
|
||||
}
|
||||
|
||||
private Server(boolean debug) {
|
||||
this.debug = debug;
|
||||
private Server() {
|
||||
Config.setCallback(new Runnable() {
|
||||
public void run() {
|
||||
for(WorldServer world : Server.this.getWorlds()) {
|
||||
|
@ -277,7 +274,7 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
public List<String> getPlayerFilenames() {
|
||||
String[] list = this.debug ? null : new File("players").list();
|
||||
String[] list = new File("players").list();
|
||||
if(list == null)
|
||||
return Lists.newArrayList();
|
||||
List<String> names = Lists.newArrayList();
|
||||
|
@ -292,14 +289,12 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
public void saveWorldInfo() {
|
||||
if(!this.debug) {
|
||||
saveServerConfig(this.space.getDayTime(), this);
|
||||
WorldServer.saveWarps(this.warps);
|
||||
}
|
||||
saveServerConfig(this.space.getDayTime(), this);
|
||||
WorldServer.saveWarps(this.warps);
|
||||
}
|
||||
|
||||
public TagObject loadPlayerData(String user) {
|
||||
if(this.debug || !IPlayer.isValidUser(user))
|
||||
if(!IPlayer.isValidUser(user))
|
||||
return null;
|
||||
TagObject tag = null;
|
||||
try {
|
||||
|
@ -316,7 +311,7 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
public void writePlayerData(String user, TagObject tag) {
|
||||
if(this.debug || !IPlayer.isValidUser(user))
|
||||
if(!IPlayer.isValidUser(user))
|
||||
return;
|
||||
try {
|
||||
File tmp = new File(new File("players"), user + ".cdt.tmp");
|
||||
|
@ -346,8 +341,6 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
public void saveAllWorlds(boolean message) {
|
||||
if(this.debug)
|
||||
return;
|
||||
if(message)
|
||||
Log.TICK.info("Speichere Welt");
|
||||
this.saveWorldInfo();
|
||||
|
@ -372,22 +365,20 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
public void run(long time) {
|
||||
if(!this.debug) {
|
||||
Converter.convert();
|
||||
long wtime = this.loadServerConfig();
|
||||
if(this.keyPair == null) {
|
||||
Log.SYSTEM.info("Generiere neues Schlüsselpaar");
|
||||
this.keyPair = EncryptUtil.createKeypair();
|
||||
}
|
||||
User.loadDatabase(this.users);
|
||||
Converter.convert();
|
||||
long wtime = this.loadServerConfig();
|
||||
if(this.keyPair == null) {
|
||||
Log.SYSTEM.info("Generiere neues Schlüsselpaar");
|
||||
this.keyPair = EncryptUtil.createKeypair();
|
||||
}
|
||||
User.loadDatabase(this.users);
|
||||
// if(dtime == -1L) // {
|
||||
// dtime = World.START_TIME;
|
||||
//// Config.set("spawnDim", "1", null);
|
||||
//// }
|
||||
this.worlds.add(this.space = new WorldServer(this, wtime,
|
||||
Space.INSTANCE, false));
|
||||
this.dimensions.put(this.space.dimension.getDimensionId(), this.space);
|
||||
new File("players").mkdirs();
|
||||
this.worlds.add(this.space = new WorldServer(this, wtime, Space.INSTANCE));
|
||||
this.dimensions.put(this.space.dimension.getDimensionId(), this.space);
|
||||
new File("players").mkdirs();
|
||||
// if(Config.spawnY < 0) {
|
||||
// WorldServer world = this.getWorld(Config.spawnDim);
|
||||
// world = world == null ? this.space : world;
|
||||
|
@ -410,28 +401,12 @@ public final class Server implements IThreadListener {
|
|||
// Config.set("spawnYaw", "" + (-180.0f + rand.floatv() * 360.0f), null);
|
||||
// Config.set("spawnPitch", "0.0", null);
|
||||
// }
|
||||
}
|
||||
else {
|
||||
Log.SYSTEM.info("Generiere temporäres Schlüsselpaar");
|
||||
this.keyPair = EncryptUtil.createKeypair();
|
||||
Config.clear();
|
||||
UniverseRegistry.clear();
|
||||
Config.set("daylightCycle", "false", false);
|
||||
Config.set("weatherChanges", "false", false);
|
||||
Config.set("mobSpawning", "false", false);
|
||||
Config.set("spawnRadius", "0", false);
|
||||
this.worlds.add(this.space = new WorldServer(this, World.START_TIME,
|
||||
Space.INSTANCE, true));
|
||||
this.dimensions.put(this.space.dimension.getDimensionId(), this.space);
|
||||
}
|
||||
this.setTpsTarget(20.0f);
|
||||
if(!this.debug) {
|
||||
for(Dimension dim : UniverseRegistry.getDimensions()) {
|
||||
if(WorldServer.needsLoading(dim)) {
|
||||
this.getWorld(dim.getDimensionId()).loadForcedChunks();
|
||||
}
|
||||
WorldServer.loadWarps(dim, this.warps);
|
||||
for(Dimension dim : UniverseRegistry.getDimensions()) {
|
||||
if(WorldServer.needsLoading(dim)) {
|
||||
this.getWorld(dim.getDimensionId()).loadForcedChunks();
|
||||
}
|
||||
WorldServer.loadWarps(dim, this.warps);
|
||||
}
|
||||
if(Config.port >= 0)
|
||||
this.bind(Config.port);
|
||||
|
@ -626,8 +601,7 @@ public final class Server implements IThreadListener {
|
|||
Dimension dim = UniverseRegistry.getDimension(dimension);
|
||||
if(dim == null)
|
||||
return null;
|
||||
world = new WorldServer(this, this.space.getDayTime(),
|
||||
dim, this.debug);
|
||||
world = new WorldServer(this, this.space.getDayTime(), dim);
|
||||
this.worlds.add(world);
|
||||
this.dimensions.put(dimension, world);
|
||||
}
|
||||
|
@ -786,7 +760,7 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
});
|
||||
}
|
||||
connection.sendPacket(new RPacketLoginSuccess(this.debug));
|
||||
connection.sendPacket(new RPacketLoginSuccess());
|
||||
connection.setNetHandler(conn);
|
||||
this.players.add(conn);
|
||||
User user = this.users.remove(loginUser);
|
||||
|
@ -861,8 +835,6 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
private TagObject readPlayer(String user) {
|
||||
if(this.debug)
|
||||
return null;
|
||||
TagObject tag = null;
|
||||
try {
|
||||
File dat = new File(new File("players"), user + ".cdt");
|
||||
|
@ -878,8 +850,6 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
private void writePlayer(Player conn) {
|
||||
if(this.debug)
|
||||
return;
|
||||
try {
|
||||
TagObject tag = new TagObject();
|
||||
EntityNPC entity = conn.getPresentEntity();
|
||||
|
@ -1107,8 +1077,6 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
public void saveAllPlayerData(boolean message) {
|
||||
if(this.debug)
|
||||
return;
|
||||
if(message) {
|
||||
Log.TICK.info("Speichere Spielerdaten");
|
||||
}
|
||||
|
|
|
@ -93,7 +93,6 @@ import server.worldgen.FeatureLakes;
|
|||
import server.worldgen.FeatureLiquids;
|
||||
import server.worldgen.FeatureOres;
|
||||
import server.worldgen.GeneratorCavern;
|
||||
import server.worldgen.GeneratorDebug;
|
||||
import server.worldgen.GeneratorDestroyed;
|
||||
import server.worldgen.GeneratorFlat;
|
||||
import server.worldgen.GeneratorIsland;
|
||||
|
@ -283,78 +282,52 @@ public final class WorldServer extends AWorldServer {
|
|||
return gens;
|
||||
}
|
||||
|
||||
public WorldServer(Server server, long dtime, Dimension dim, boolean debug) {
|
||||
super(dim, debug);
|
||||
public WorldServer(Server server, long dtime, Dimension dim) {
|
||||
super(dim);
|
||||
this.server = server;
|
||||
// this.time = time;
|
||||
this.daytime = dtime;
|
||||
this.updateViewRadius();
|
||||
this.chunkDir = new File(new File("chunk"), dim.getDimensionName());
|
||||
if(!debug) {
|
||||
this.chunkDir.mkdirs();
|
||||
if(!Config.seed.isEmpty())
|
||||
this.rand.setSeed((long)Config.seed.hashCode() ^ ~((long)dim.getDimensionName().hashCode()));
|
||||
this.seed = this.rand.longv();
|
||||
this.dimension.setSeed(this.seed);
|
||||
TagObject tag = null;
|
||||
try {
|
||||
File dat = new File(this.chunkDir, "data.cdt");
|
||||
if(dat.exists() && dat.isFile())
|
||||
tag = TagObject.readGZip(dat);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Weltdaten nicht laden");
|
||||
}
|
||||
if(tag != null) {
|
||||
this.exterminated = tag.getBool("Exterminated");
|
||||
this.time = tag.getLong("Time");
|
||||
if(tag.hasObject("Generator")) {
|
||||
this.dimension.fromTags(tag.getObject("Generator"));
|
||||
if(this.dimension.getType().weather && !this.exterminated)
|
||||
this.weather = this.dimension.getWeather();
|
||||
this.seed = this.dimension.getSeed();
|
||||
}
|
||||
if(this.dimension.getType().weather && !this.exterminated)
|
||||
this.weather = Weather.getByName(tag.getString("Weather"));
|
||||
if(this.weather == null) {
|
||||
this.weather = this.dimension.getWeather();
|
||||
// this.dataModified = true;
|
||||
}
|
||||
// ...
|
||||
}
|
||||
else {
|
||||
Log.TICK.info("Startwert für %s: %d" + (Config.seed.isEmpty() ? "" : " von Basiswert '%s'"), this.dimension.getFormattedName(false), this.seed, Config.seed);
|
||||
}
|
||||
if(this.exterminated)
|
||||
this.weather = Weather.CLEAR;
|
||||
this.chunkDir.mkdirs();
|
||||
if(!Config.seed.isEmpty())
|
||||
this.rand.setSeed((long)Config.seed.hashCode() ^ ~((long)dim.getDimensionName().hashCode()));
|
||||
this.seed = this.rand.longv();
|
||||
this.dimension.setSeed(this.seed);
|
||||
TagObject tag = null;
|
||||
try {
|
||||
File dat = new File(this.chunkDir, "data.cdt");
|
||||
if(dat.exists() && dat.isFile())
|
||||
tag = TagObject.readGZip(dat);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Weltdaten nicht laden");
|
||||
}
|
||||
if(tag != null) {
|
||||
this.exterminated = tag.getBool("Exterminated");
|
||||
this.time = tag.getLong("Time");
|
||||
if(tag.hasObject("Generator")) {
|
||||
this.dimension.fromTags(tag.getObject("Generator"));
|
||||
if(this.dimension.getType().weather && !this.exterminated)
|
||||
this.weather = this.dimension.getWeather();
|
||||
this.seed = this.dimension.getSeed();
|
||||
}
|
||||
if(this.dimension.getType().weather && !this.exterminated)
|
||||
this.weather = Weather.getByName(tag.getString("Weather"));
|
||||
if(this.weather == null) {
|
||||
this.weather = this.dimension.getWeather();
|
||||
// this.dataModified = true;
|
||||
}
|
||||
// ...
|
||||
}
|
||||
else {
|
||||
Log.TICK.info("Startwert für %s: %d" + (Config.seed.isEmpty() ? "" : " von Basiswert '%s'"), this.dimension.getFormattedName(false), this.seed, Config.seed);
|
||||
}
|
||||
if(this.exterminated)
|
||||
this.weather = Weather.CLEAR;
|
||||
this.grng = new Random(this.seed);
|
||||
// GeneratorSettings settings = !debug && !this.exterminated ? dim.getSettings() : null;
|
||||
if(debug) {
|
||||
this.liquid = Blocks.air.getState();
|
||||
this.biomeGen = new BiomeGenSingle(Biome.NONE);
|
||||
this.generator = new GeneratorDebug();
|
||||
this.replacer = null;
|
||||
this.populate = false;
|
||||
this.caveGen = null;
|
||||
this.bigCaveGen = null;
|
||||
this.ravineGen = null;
|
||||
this.base = false;
|
||||
this.ceil = false;
|
||||
this.mobs = false;
|
||||
this.snow = false;
|
||||
this.strongholdGen = null;
|
||||
this.villageGen = null;
|
||||
this.mineshaftGen = null;
|
||||
this.scatteredGen = null;
|
||||
this.bridgeGen = null;
|
||||
this.seaLevel = 0;
|
||||
this.ores = null;
|
||||
this.lakes = null;
|
||||
this.liquids = null;
|
||||
this.dungeons = null;
|
||||
}
|
||||
else if(this.exterminated) {
|
||||
if(this.exterminated) {
|
||||
this.setExterminatedGen();
|
||||
}
|
||||
// else if(settings != null) {
|
||||
|
@ -440,36 +413,34 @@ public final class WorldServer extends AWorldServer {
|
|||
this.calculateInitialSkylight();
|
||||
this.calculateInitialWeather();
|
||||
this.updatePhysics();
|
||||
if(!debug) {
|
||||
TagObject tag = null;
|
||||
tag = null;
|
||||
try {
|
||||
File dat = new File(this.chunkDir, "loaders.cdt");
|
||||
if(dat.exists() && dat.isFile())
|
||||
tag = TagObject.readGZip(dat);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Ladeliste nicht laden");
|
||||
}
|
||||
if(tag != null && tag.hasList("Loaders")) {
|
||||
List<TagObject> list = tag.getList("Loaders");
|
||||
for(int z = 0; z < list.size(); z++) {
|
||||
TagObject pos = list.get(z);
|
||||
this.addLoader(new BlockPos(pos.getInt("X"), pos.getInt("Y"), pos.getInt("Z")));
|
||||
}
|
||||
this.loadersModified = false;
|
||||
}
|
||||
if(this.villageGen != null) {
|
||||
tag = null;
|
||||
try {
|
||||
File dat = new File(this.chunkDir, "loaders.cdt");
|
||||
File dat = new File(this.chunkDir, "villages.cdt");
|
||||
if(dat.exists() && dat.isFile())
|
||||
tag = TagObject.readGZip(dat);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Ladeliste nicht laden");
|
||||
}
|
||||
if(tag != null && tag.hasList("Loaders")) {
|
||||
List<TagObject> list = tag.getList("Loaders");
|
||||
for(int z = 0; z < list.size(); z++) {
|
||||
TagObject pos = list.get(z);
|
||||
this.addLoader(new BlockPos(pos.getInt("X"), pos.getInt("Y"), pos.getInt("Z")));
|
||||
}
|
||||
this.loadersModified = false;
|
||||
}
|
||||
if(this.villageGen != null) {
|
||||
tag = null;
|
||||
try {
|
||||
File dat = new File(this.chunkDir, "villages.cdt");
|
||||
if(dat.exists() && dat.isFile())
|
||||
tag = TagObject.readGZip(dat);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Dorfliste nicht laden");
|
||||
}
|
||||
this.villageStorage = new VillageCollection(tag);
|
||||
Log.IO.error(e, "Konnte Dorfliste nicht laden");
|
||||
}
|
||||
this.villageStorage = new VillageCollection(tag);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -486,23 +457,21 @@ public final class WorldServer extends AWorldServer {
|
|||
this.updateWeather(false);
|
||||
this.biomeGen.cleanupCache();
|
||||
// this.profiler.start("mobSpawner");
|
||||
if(this.mobs && Config.mobs && Config.tickSpawn && !this.debug) {
|
||||
if(this.mobs && Config.mobs && Config.tickSpawn) {
|
||||
Spawner.spawn(this);
|
||||
}
|
||||
// this.profiler.next("chunkSource");
|
||||
if(!this.debug) {
|
||||
for(int i = 0; i < 100; ++i) {
|
||||
if(!this.dropped.isEmpty()) {
|
||||
Long v = (Long)this.dropped.iterator().next();
|
||||
ChunkServer chunk = this.chunks.getValueByKey(v.longValue());
|
||||
if(chunk != null) {
|
||||
chunk.onChunkUnload();
|
||||
this.saveChunkData(chunk);
|
||||
this.chunks.remove(v.longValue());
|
||||
this.loaded.remove(chunk);
|
||||
}
|
||||
this.dropped.remove(v);
|
||||
for(int i = 0; i < 100; ++i) {
|
||||
if(!this.dropped.isEmpty()) {
|
||||
Long v = (Long)this.dropped.iterator().next();
|
||||
ChunkServer chunk = this.chunks.getValueByKey(v.longValue());
|
||||
if(chunk != null) {
|
||||
chunk.onChunkUnload();
|
||||
this.saveChunkData(chunk);
|
||||
this.chunks.remove(v.longValue());
|
||||
this.loaded.remove(chunk);
|
||||
}
|
||||
this.dropped.remove(v);
|
||||
}
|
||||
}
|
||||
int light = this.calculateSkylightSubtracted(true);
|
||||
|
@ -611,113 +580,105 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
|
||||
public void setItemData(String dataID, WorldSavedData worldSavedDataIn) {
|
||||
if(!this.debug)
|
||||
this.setData(dataID, worldSavedDataIn);
|
||||
this.setData(dataID, worldSavedDataIn);
|
||||
}
|
||||
|
||||
public WorldSavedData loadItemData(String dataID) {
|
||||
return this.debug ? null : this.loadData(dataID);
|
||||
return this.loadData(dataID);
|
||||
}
|
||||
|
||||
protected void updateBlocks() {
|
||||
this.setActivePlayerChunksAndCheckLight(Config.distance);
|
||||
|
||||
if(this.debug) {
|
||||
for(ChunkPos chunkcoordintpair1 : this.active) {
|
||||
this.getChunk(chunkcoordintpair1.x, chunkcoordintpair1.z).update(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
|
||||
for(ChunkPos chunkcoordintpair : this.active) {
|
||||
int k = chunkcoordintpair.x * 16;
|
||||
int l = chunkcoordintpair.z * 16;
|
||||
for(ChunkPos chunkcoordintpair : this.active) {
|
||||
int k = chunkcoordintpair.x * 16;
|
||||
int l = chunkcoordintpair.z * 16;
|
||||
// this.profiler.start("getChunk");
|
||||
ChunkServer chunk = this.getChunk(chunkcoordintpair.x, chunkcoordintpair.z);
|
||||
ChunkServer chunk = this.getChunk(chunkcoordintpair.x, chunkcoordintpair.z);
|
||||
// this.profiler.next("moodSound");
|
||||
// this.playMoodSound(k, l, chunk);
|
||||
// this.profiler.next("checkLight");
|
||||
chunk.enqueueRelight();
|
||||
chunk.enqueueRelight();
|
||||
// this.profiler.next("tickChunk");
|
||||
chunk.update(false);
|
||||
chunk.update(false);
|
||||
// this.profiler.next("thunder");
|
||||
int l2 = Config.boltChance;
|
||||
int l2 = Config.boltChance;
|
||||
|
||||
if(l2 > 0 && this.rand.zrange(l2) == 0 && this.isThundering()) {
|
||||
this.updateLCG = this.updateLCG * 3 + 1013904223;
|
||||
int i1 = this.updateLCG >> 2;
|
||||
BlockPos blockpos = this.adjustPosToNearbyEntity(new BlockPos(k + (i1 & 15), 0, l + (i1 >> 8 & 15)));
|
||||
if(l2 > 0 && this.rand.zrange(l2) == 0 && this.isThundering()) {
|
||||
this.updateLCG = this.updateLCG * 3 + 1013904223;
|
||||
int i1 = this.updateLCG >> 2;
|
||||
BlockPos blockpos = this.adjustPosToNearbyEntity(new BlockPos(k + (i1 & 15), 0, l + (i1 >> 8 & 15)));
|
||||
|
||||
if(this.canStrikeAt(blockpos)) {
|
||||
this.strikeLightning((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), 0x737380, 120, true, null);
|
||||
}
|
||||
if(this.canStrikeAt(blockpos)) {
|
||||
this.strikeLightning((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), 0x737380, 120, true, null);
|
||||
}
|
||||
}
|
||||
|
||||
// this.profiler.next("iceandsnow");
|
||||
l2 = Config.weatherTick;
|
||||
l2 = Config.weatherTick;
|
||||
|
||||
for(int z = 0; z < l2; z++) {
|
||||
if(this.rand.zrange(16) == 0) {
|
||||
this.updateLCG = this.updateLCG * 3 + 1013904223;
|
||||
int k2 = this.updateLCG >> 2;
|
||||
BlockPos blockpos2 = this.getPrecipitationHeight(new BlockPos(k + (k2 & 15), 0, l + (k2 >> 8 & 15)));
|
||||
BlockPos blockpos1 = blockpos2.down();
|
||||
for(int z = 0; z < l2; z++) {
|
||||
if(this.rand.zrange(16) == 0) {
|
||||
this.updateLCG = this.updateLCG * 3 + 1013904223;
|
||||
int k2 = this.updateLCG >> 2;
|
||||
BlockPos blockpos2 = this.getPrecipitationHeight(new BlockPos(k + (k2 & 15), 0, l + (k2 >> 8 & 15)));
|
||||
BlockPos blockpos1 = blockpos2.down();
|
||||
|
||||
if(this.canBlockFreeze(blockpos1, true)) {
|
||||
this.setState(blockpos1, Blocks.ice.getState());
|
||||
}
|
||||
if(this.canBlockFreeze(blockpos1, true)) {
|
||||
this.setState(blockpos1, Blocks.ice.getState());
|
||||
}
|
||||
|
||||
if(this.snow && this.isRaining() && this.canSnowAt(blockpos2, true, Config.snowStack)) {
|
||||
State layer = Config.snowStack ? this.getState(blockpos2) : null;
|
||||
this.setState(blockpos2, Config.snowStack && layer.getBlock() == Blocks.snow_layer
|
||||
? (Blocks.snow_layer.getState().withProperty(BlockSnow.LAYERS,
|
||||
Math.min(layer.getValue(BlockSnow.LAYERS) + 1, 2))) : Blocks.snow_layer.getState());
|
||||
}
|
||||
if(this.snow && this.isRaining() && this.canSnowAt(blockpos2, true, Config.snowStack)) {
|
||||
State layer = Config.snowStack ? this.getState(blockpos2) : null;
|
||||
this.setState(blockpos2, Config.snowStack && layer.getBlock() == Blocks.snow_layer
|
||||
? (Blocks.snow_layer.getState().withProperty(BlockSnow.LAYERS,
|
||||
Math.min(layer.getValue(BlockSnow.LAYERS) + 1, 2))) : Blocks.snow_layer.getState());
|
||||
}
|
||||
|
||||
if(this.isRaining()) { // && this.getBiomeGenForCoords(blockpos1).canRain()) {
|
||||
this.getState(blockpos1).getBlock().fillWithRain(this, blockpos1);
|
||||
}
|
||||
if(this.isRaining()) { // && this.getBiomeGenForCoords(blockpos1).canRain()) {
|
||||
this.getState(blockpos1).getBlock().fillWithRain(this, blockpos1);
|
||||
}
|
||||
|
||||
if(Config.igniteChance > 0 && Config.fire && !this.isRaining() &&
|
||||
this.rand.chance(this.hasDownfall() ? Math.max(1, Config.igniteChance / 3) : Config.igniteChance)
|
||||
&& this.canPlaceFireAt(blockpos2)) {
|
||||
this.setState(blockpos2, Blocks.fire.getState());
|
||||
}
|
||||
if(Config.igniteChance > 0 && Config.fire && !this.isRaining() &&
|
||||
this.rand.chance(this.hasDownfall() ? Math.max(1, Config.igniteChance / 3) : Config.igniteChance)
|
||||
&& this.canPlaceFireAt(blockpos2)) {
|
||||
this.setState(blockpos2, Blocks.fire.getState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this.profiler.next("tickBlocks");
|
||||
l2 = Config.randomTick;
|
||||
l2 = Config.randomTick;
|
||||
|
||||
if(l2 > 0) {
|
||||
this.toTick.addAll(chunk.getStorage());
|
||||
for(BlockArray extendedblockstorage : this.toTick) {
|
||||
if(extendedblockstorage != null && extendedblockstorage.isTicked()) {
|
||||
for(int j1 = 0; j1 < l2; ++j1) {
|
||||
this.updateLCG = this.updateLCG * 3 + 1013904223;
|
||||
int k1 = this.updateLCG >> 2;
|
||||
int l1 = k1 & 15;
|
||||
int i2 = k1 >> 8 & 15;
|
||||
int j2 = k1 >> 16 & 15;
|
||||
++j;
|
||||
State iblockstate = extendedblockstorage.get(l1, j2, i2);
|
||||
Block block = iblockstate.getBlock();
|
||||
if(l2 > 0) {
|
||||
this.toTick.addAll(chunk.getStorage());
|
||||
for(BlockArray extendedblockstorage : this.toTick) {
|
||||
if(extendedblockstorage != null && extendedblockstorage.isTicked()) {
|
||||
for(int j1 = 0; j1 < l2; ++j1) {
|
||||
this.updateLCG = this.updateLCG * 3 + 1013904223;
|
||||
int k1 = this.updateLCG >> 2;
|
||||
int l1 = k1 & 15;
|
||||
int i2 = k1 >> 8 & 15;
|
||||
int j2 = k1 >> 16 & 15;
|
||||
++j;
|
||||
State iblockstate = extendedblockstorage.get(l1, j2, i2);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if(block.getTickRandomly()) {
|
||||
++i;
|
||||
block.randomTick(this, new BlockPos(l1 + k, j2 + extendedblockstorage.getY(), i2 + l), iblockstate,
|
||||
this.rand);
|
||||
}
|
||||
if(block.getTickRandomly()) {
|
||||
++i;
|
||||
block.randomTick(this, new BlockPos(l1 + k, j2 + extendedblockstorage.getY(), i2 + l), iblockstate,
|
||||
this.rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.toTick.clear();
|
||||
}
|
||||
this.toTick.clear();
|
||||
}
|
||||
|
||||
// this.profiler.end();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -813,60 +774,55 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
|
||||
public boolean tickUpdates(boolean p_72955_1_) {
|
||||
if(this.debug) {
|
||||
return false;
|
||||
int i = this.ticksNext.size();
|
||||
|
||||
if(i != this.ticks.size()) {
|
||||
throw new IllegalStateException("TickNextTick list out of synch");
|
||||
}
|
||||
else {
|
||||
int i = this.ticksNext.size();
|
||||
|
||||
if(i != this.ticks.size()) {
|
||||
throw new IllegalStateException("TickNextTick list out of synch");
|
||||
if(i > 1000) {
|
||||
i = 1000;
|
||||
}
|
||||
else {
|
||||
if(i > 1000) {
|
||||
i = 1000;
|
||||
}
|
||||
|
||||
// this.profiler.start("cleaning");
|
||||
|
||||
for(int j = 0; j < i; ++j) {
|
||||
NextTickListEntry nextticklistentry = (NextTickListEntry)this.ticksNext.first();
|
||||
for(int j = 0; j < i; ++j) {
|
||||
NextTickListEntry nextticklistentry = (NextTickListEntry)this.ticksNext.first();
|
||||
|
||||
if(!p_72955_1_ && nextticklistentry.scheduledTime > this.time) {
|
||||
break;
|
||||
}
|
||||
|
||||
this.ticksNext.remove(nextticklistentry);
|
||||
this.ticks.remove(nextticklistentry);
|
||||
this.ticksNow.add(nextticklistentry);
|
||||
if(!p_72955_1_ && nextticklistentry.scheduledTime > this.time) {
|
||||
break;
|
||||
}
|
||||
|
||||
this.ticksNext.remove(nextticklistentry);
|
||||
this.ticks.remove(nextticklistentry);
|
||||
this.ticksNow.add(nextticklistentry);
|
||||
}
|
||||
|
||||
// this.profiler.end();
|
||||
// this.profiler.start("ticking");
|
||||
Iterator<NextTickListEntry> iterator = this.ticksNow.iterator();
|
||||
Iterator<NextTickListEntry> iterator = this.ticksNow.iterator();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
NextTickListEntry nextticklistentry1 = (NextTickListEntry)iterator.next();
|
||||
iterator.remove();
|
||||
int k = 0;
|
||||
while(iterator.hasNext()) {
|
||||
NextTickListEntry nextticklistentry1 = (NextTickListEntry)iterator.next();
|
||||
iterator.remove();
|
||||
int k = 0;
|
||||
|
||||
if(this.isAreaLoaded(nextticklistentry1.position.add(-k, -k, -k), nextticklistentry1.position.add(k, k, k))) {
|
||||
State iblockstate = this.getState(nextticklistentry1.position);
|
||||
if(this.isAreaLoaded(nextticklistentry1.position.add(-k, -k, -k), nextticklistentry1.position.add(k, k, k))) {
|
||||
State iblockstate = this.getState(nextticklistentry1.position);
|
||||
|
||||
if(iblockstate.getBlock() != Blocks.air
|
||||
&& Block.isEqualTo(iblockstate.getBlock(), nextticklistentry1.getBlock())) {
|
||||
iblockstate.getBlock().updateTick(this, nextticklistentry1.position, iblockstate, this.rand);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.scheduleUpdate(nextticklistentry1.position, nextticklistentry1.getBlock(), 0);
|
||||
if(iblockstate.getBlock() != Blocks.air
|
||||
&& Block.isEqualTo(iblockstate.getBlock(), nextticklistentry1.getBlock())) {
|
||||
iblockstate.getBlock().updateTick(this, nextticklistentry1.position, iblockstate, this.rand);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.scheduleUpdate(nextticklistentry1.position, nextticklistentry1.getBlock(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
// this.profiler.end();
|
||||
this.ticksNow.clear();
|
||||
return !this.ticksNext.isEmpty();
|
||||
}
|
||||
this.ticksNow.clear();
|
||||
return !this.ticksNext.isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1008,84 +964,82 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
|
||||
public void saveAllChunks() {
|
||||
if(/* (force || !this.disableSaving) && */ !this.debug) {
|
||||
// if(this.primary) {
|
||||
//
|
||||
// }
|
||||
if(this.loadersModified) {
|
||||
this.loadersModified = false;
|
||||
TagObject loaders = new TagObject();
|
||||
List<TagObject> list = Lists.newArrayList();
|
||||
for(BlockPos pos : this.loaderList) {
|
||||
TagObject loader = new TagObject();
|
||||
loader.setInt("X", pos.getX());
|
||||
loader.setInt("Y", pos.getY());
|
||||
loader.setInt("Z", pos.getZ());
|
||||
list.add(loader);
|
||||
if(this.loadersModified) {
|
||||
this.loadersModified = false;
|
||||
TagObject loaders = new TagObject();
|
||||
List<TagObject> list = Lists.newArrayList();
|
||||
for(BlockPos pos : this.loaderList) {
|
||||
TagObject loader = new TagObject();
|
||||
loader.setInt("X", pos.getX());
|
||||
loader.setInt("Y", pos.getY());
|
||||
loader.setInt("Z", pos.getZ());
|
||||
list.add(loader);
|
||||
}
|
||||
loaders.setList("Loaders", list);
|
||||
File file = new File(this.chunkDir, "loaders.cdt");
|
||||
if(list.isEmpty()) {
|
||||
file.delete();
|
||||
}
|
||||
else {
|
||||
try {
|
||||
TagObject.writeGZip(loaders, file);
|
||||
}
|
||||
loaders.setList("Loaders", list);
|
||||
File file = new File(this.chunkDir, "loaders.cdt");
|
||||
if(list.isEmpty()) {
|
||||
file.delete();
|
||||
}
|
||||
else {
|
||||
try {
|
||||
TagObject.writeGZip(loaders, file);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Ladeliste nicht speichern");
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Ladeliste nicht speichern");
|
||||
}
|
||||
}
|
||||
}
|
||||
// if(this.warpsModified) {
|
||||
// this.warpsModified = false;
|
||||
// }
|
||||
// if(this.dataModified) {
|
||||
// this.dataModified = false;
|
||||
TagObject data = new TagObject();
|
||||
TagObject data = new TagObject();
|
||||
// data.setLong("Seed", this.seed);
|
||||
data.setObject("Generator", this.dimension.toTags(true));
|
||||
data.setLong("Time", this.time);
|
||||
data.setBool("Exterminated", this.exterminated);
|
||||
data.setString("Weather", this.weather.getName());
|
||||
// ...
|
||||
File file = new File(this.chunkDir, "data.cdt");
|
||||
data.setObject("Generator", this.dimension.toTags(true));
|
||||
data.setLong("Time", this.time);
|
||||
data.setBool("Exterminated", this.exterminated);
|
||||
data.setString("Weather", this.weather.getName());
|
||||
// ...
|
||||
File file = new File(this.chunkDir, "data.cdt");
|
||||
try {
|
||||
TagObject.writeGZip(data, file);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Weltdaten nicht speichern");
|
||||
}
|
||||
// }
|
||||
for(int i = 0; i < this.dataList.size(); ++i) {
|
||||
WorldSavedData wdata = this.dataList.get(i);
|
||||
if(wdata.dirty) {
|
||||
this.saveData(wdata);
|
||||
wdata.dirty = false;
|
||||
}
|
||||
}
|
||||
if(this.villageStorage != null && this.villageStorage.isDirty()) {
|
||||
TagObject tag = this.villageStorage.toTags();
|
||||
File dat = new File(this.chunkDir, "villages.cdt");
|
||||
try {
|
||||
TagObject.writeGZip(data, file);
|
||||
TagObject.writeGZip(tag, dat);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Weltdaten nicht speichern");
|
||||
Log.IO.error(e, "Konnte Dorfliste nicht speichern");
|
||||
}
|
||||
// }
|
||||
for(int i = 0; i < this.dataList.size(); ++i) {
|
||||
WorldSavedData wdata = this.dataList.get(i);
|
||||
if(wdata.dirty) {
|
||||
this.saveData(wdata);
|
||||
wdata.dirty = false;
|
||||
}
|
||||
}
|
||||
List<ChunkServer> list = Lists.newArrayList(this.loaded);
|
||||
for(int n = 0; n < list.size(); ++n) {
|
||||
ChunkServer chunk = list.get(n);
|
||||
if(chunk.isDirty(this.time)) {
|
||||
this.saveChunkData(chunk);
|
||||
chunk.setModified(false);
|
||||
}
|
||||
if(this.villageStorage != null && this.villageStorage.isDirty()) {
|
||||
TagObject tag = this.villageStorage.toTags();
|
||||
File dat = new File(this.chunkDir, "villages.cdt");
|
||||
try {
|
||||
TagObject.writeGZip(tag, dat);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Dorfliste nicht speichern");
|
||||
}
|
||||
}
|
||||
List<ChunkServer> list = Lists.newArrayList(this.loaded);
|
||||
for(int n = 0; n < list.size(); ++n) {
|
||||
ChunkServer chunk = list.get(n);
|
||||
if(chunk.isDirty(this.time)) {
|
||||
this.saveChunkData(chunk);
|
||||
chunk.setModified(false);
|
||||
}
|
||||
}
|
||||
for(ChunkServer chunk : Lists.newArrayList(this.loaded)) {
|
||||
if(chunk != null && !this.hasPlayerInstance(chunk.xPos, chunk.zPos)) {
|
||||
this.dropChunk(chunk.xPos, chunk.zPos);
|
||||
}
|
||||
}
|
||||
for(ChunkServer chunk : Lists.newArrayList(this.loaded)) {
|
||||
if(chunk != null && !this.hasPlayerInstance(chunk.xPos, chunk.zPos)) {
|
||||
this.dropChunk(chunk.xPos, chunk.zPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1368,8 +1322,7 @@ public final class WorldServer extends AWorldServer {
|
|||
ChunkServer chunk = this.chunks.getValueByKey(id);
|
||||
|
||||
if(chunk == null) {
|
||||
if(!this.debug)
|
||||
chunk = this.loadChunkFromFile(x, z);
|
||||
chunk = this.loadChunkFromFile(x, z);
|
||||
|
||||
if(chunk == null) {
|
||||
chunk = this.generate(x, z);
|
||||
|
@ -1645,8 +1598,6 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
|
||||
public boolean exterminate() {
|
||||
if(this.debug)
|
||||
return true;
|
||||
if(this.exterminated)
|
||||
return false;
|
||||
this.setWeather(Weather.CLEAR);
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
package server.worldgen;
|
||||
|
||||
import common.world.DebugStates;
|
||||
import common.world.State;
|
||||
import server.world.WorldServer;
|
||||
|
||||
public class GeneratorDebug implements ChunkGenerator
|
||||
{
|
||||
public int getMaximumHeight() {
|
||||
return 72;
|
||||
}
|
||||
|
||||
public void generateChunk(WorldServer world, int x, int z, ChunkPrimer primer)
|
||||
{
|
||||
for(int bx = 0; bx < 16; ++bx) {
|
||||
for(int bz = 0; bz < 16; ++bz) {
|
||||
int sx = x * 16 + bx;
|
||||
int sz = z * 16 + bz;
|
||||
// primer.set(bx, 60, bz, Blocks.glass.getDefaultState());
|
||||
State state = DebugStates.getState(sx, sz);
|
||||
if(state != null) {
|
||||
primer.set(bx, 1, bz, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue