remove server side debug

This commit is contained in:
Sen 2025-05-31 16:46:48 +02:00
parent f4c024cde7
commit 374e0c4617
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
22 changed files with 1084 additions and 801 deletions

View file

@ -22,7 +22,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Queue; import java.util.Queue;
import java.util.Set;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -111,6 +110,7 @@ import common.entity.Entity;
import common.entity.animal.EntityHorse; import common.entity.animal.EntityHorse;
import common.entity.npc.Energy; import common.entity.npc.Energy;
import common.entity.npc.EntityNPC; import common.entity.npc.EntityNPC;
import common.entity.npc.PlayerCharacter;
import common.entity.types.EntityLiving; import common.entity.types.EntityLiving;
import common.future.Futures; import common.future.Futures;
import common.future.ListenableFuture; import common.future.ListenableFuture;
@ -286,6 +286,8 @@ public class Client implements IThreadListener {
private final List<Message> feed = Lists.newArrayList(); private final List<Message> feed = Lists.newArrayList();
private final List<Message> hotbar = Lists.newArrayList(); private final List<Message> hotbar = Lists.newArrayList();
private final File config = new File(System.getProperty("config.file", "client.cfg")); 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 primary;
private boolean secondary; private boolean secondary;
@ -295,7 +297,7 @@ public class Client implements IThreadListener {
public boolean jump; public boolean jump;
public boolean sneak; public boolean sneak;
public boolean debugCamEnable; public boolean debugCamEnable;
public boolean debugWorld; public boolean noResolve;
public boolean zooming; public boolean zooming;
public boolean sprint; public boolean sprint;
public boolean renderOutlines; public boolean renderOutlines;
@ -316,6 +318,7 @@ public class Client implements IThreadListener {
public int thirdPersonView; public int thirdPersonView;
public int timeFactor = 1; public int timeFactor = 1;
public int chunksUpdated; public int chunksUpdated;
public int selectedCharacter = -1;
private long lastTicked = 0L; private long lastTicked = 0L;
private long debugUpdateTime = System.currentTimeMillis(); private long debugUpdateTime = System.currentTimeMillis();
@ -578,7 +581,7 @@ public class Client implements IThreadListener {
ClientPlayer netHandler = this.getNetHandler(); ClientPlayer netHandler = this.getNetHandler();
if(netHandler != null) if(netHandler != null)
netHandler.cleanup(); netHandler.cleanup();
this.debugWorld = false; this.noResolve = false;
this.charEditor = false; this.charEditor = false;
this.viewEntity = null; this.viewEntity = null;
this.connection = null; this.connection = null;
@ -586,6 +589,9 @@ public class Client implements IThreadListener {
this.player = null; this.player = null;
this.serverInfo = null; this.serverInfo = null;
this.lastTickTime = -1; this.lastTickTime = -1;
this.selectedCharacter = -1;
this.playerList.clear();
this.characterList.clear();
this.soundManager.stopSounds(); this.soundManager.stopSounds();
} }
@ -1885,7 +1891,7 @@ public class Client implements IThreadListener {
BlockPos pos = this.pointed.block; BlockPos pos = this.pointed.block;
State block = this.world.getState(pos); State block = this.world.getState(pos);
if(!this.debugWorld) { if(!this.noResolve) {
block = block.getBlock().getActualState(block, this.world, pos); block = block.getBlock().getActualState(block, this.world, pos);
} }
@ -2472,7 +2478,7 @@ public class Client implements IThreadListener {
public void unload(boolean loading) { public void unload(boolean loading) {
if(this.world != null && this.getNetHandler() != null) if(this.world != null && this.getNetHandler() != null)
this.getNetHandler().getNetworkManager().closeChannel("Quitting"); this.getNetHandler().getConnection().closeChannel("Quitting");
this.unloadWorld(); this.unloadWorld();
this.displayGuiScreen(GuiMenu.INSTANCE); 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() { this.registerDebug(Keysym.AE, "Programm sofort beenden und server beenden", new DebugRunner() {
public void execute(Keysym key) { public void execute(Keysym key) {
if(Client.this.getNetHandler() != null) { 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 { public void operationComplete(Future<? super Void> u) throws Exception {
try { try {
Thread.sleep(1000L); Thread.sleep(1000L);
@ -3192,13 +3198,12 @@ public class Client implements IThreadListener {
public void drawInfo() { public void drawInfo() {
ClientPlayer netHandler = this.getNetHandler(); ClientPlayer netHandler = this.getNetHandler();
if(netHandler != null) { if(netHandler != null) {
Set<Entry<String, Integer>> list = netHandler.getPlayerList(); int size = this.playerList.size();
int size = list.size();
int w = size > 80 ? 4 : (size > 40 ? 3 : (size > 10 ? 2 : 1)); int w = size > 80 ? 4 : (size > 40 ? 3 : (size > 10 ? 2 : 1));
w = Math.min(w, Math.max(1, this.fb_x / 300)); w = Math.min(w, Math.max(1, this.fb_x / 300));
int bx = 0; int bx = 0;
int by = 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 x = this.fb_x / 2 - (w * 300) / 2 + bx * 300;
int y = 10 + by * Font.YGLYPH; int y = 10 + by * Font.YGLYPH;
Drawing.drawGradient(x, y, 300, Font.YGLYPH, 0x7f404040, 0x7f000000); Drawing.drawGradient(x, y, 300, Font.YGLYPH, 0x7f404040, 0x7f000000);

View file

@ -10,7 +10,6 @@ import client.gui.element.PressType;
import client.gui.element.FieldAction; import client.gui.element.FieldAction;
import client.gui.element.Field; import client.gui.element.Field;
import client.gui.element.FieldCallback; import client.gui.element.FieldCallback;
import client.network.ClientPlayer;
import client.vars.BoolVar; import client.vars.BoolVar;
import client.vars.CVar; import client.vars.CVar;
import client.gui.element.TransparentArea; import client.gui.element.TransparentArea;
@ -218,7 +217,7 @@ public class GuiConsole extends Gui implements FieldCallback {
s = argv[argv.length - 1]; s = argv[argv.length - 1];
Iterable<String> res = pre.startsWith("#") ? Iterable<String> res = pre.startsWith("#") ?
(argv.length == 1 ? this.gm.getVars() : (argv.length == 2 ? getVarCompletion(argv[0].substring(1)) : Lists.newArrayList())) : (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("#")) if(argv.length == 1 && pre.startsWith("#"))
s = s.substring(1); s = s.substring(1);
for(String s1 : res) { for(String s1 : res) {

View file

@ -9,6 +9,7 @@ import client.gui.element.Label;
import client.gui.element.NavButton; import client.gui.element.NavButton;
import client.gui.element.PressType; import client.gui.element.PressType;
import client.gui.options.GuiOptions; import client.gui.options.GuiOptions;
import client.network.DummyPlayer;
import client.renderer.Drawing; import client.renderer.Drawing;
import client.window.Keysym; import client.window.Keysym;
import common.color.TextColor; import common.color.TextColor;
@ -53,6 +54,10 @@ public class GuiMenu extends Gui {
this.resetAnimation(); this.resetAnimation();
this.add(new ActButton(0, -28, 400, 24, new ButtonCallback() { this.add(new ActButton(0, -28, 400, 24, new ButtonCallback() {
public void use(ActButton elem, PressType action) { public void use(ActButton elem, PressType action) {
if(action == PressType.SECONDARY) {
new DummyPlayer(GuiMenu.this.gm).join();
return;
}
if(GuiMenu.this.hacked == 9) { if(GuiMenu.this.hacked == 9) {
GuiMenu.this.hacked++; GuiMenu.this.hacked++;
GuiMenu.this.splashLabel.setText(TextColor.VIOLET + "Hax!"); GuiMenu.this.splashLabel.setText(TextColor.VIOLET + "Hax!");

View file

@ -13,6 +13,7 @@ import client.renderer.Drawing;
import common.color.TextColor; import common.color.TextColor;
import common.entity.npc.PlayerCharacter; import common.entity.npc.PlayerCharacter;
import common.packet.CPacketAction; import common.packet.CPacketAction;
import common.util.ExtMath;
public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry> implements ButtonCallback 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); super.init(width, height);
this.setDimensions(600, height, 32, height - 32); this.setDimensions(600, height, 32, height - 32);
this.elements.clear(); this.elements.clear();
if(this.gm.getNetHandler() != null) { int selected = this.gm.selectedCharacter;
int initialSelection = this.gm.getNetHandler().getSelectedCharacter(); for(PlayerCharacter character : this.gm.characterList) {
for(PlayerCharacter character : this.gm.getNetHandler().getCharacterList()) { 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(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.elements.add(new CharacterEntry(null, false));
this.setSelected(initialSelection); this.setSelected(ExtMath.clampi(selected, -1, this.elements.size() - 1));
}
this.descField = this.add(new TransparentArea(width - 390, 62, 380, height - 124, "", false)); 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.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, "")); this.actionButtom = this.add(new ActButton(width / 2 - 100, height - 28, 200, 24, this, ""));

View file

@ -198,7 +198,6 @@ public class ClientLoginHandler implements IClientLoginHandler {
return; return;
} }
this.state = LoginState.DONE; this.state = LoginState.DONE;
this.gm.debugWorld = packet.isDebug();
this.connection.setConnectionState(PacketRegistry.PLAY); this.connection.setConnectionState(PacketRegistry.PLAY);
this.connection.setNetHandler(new ClientPlayer(this.gm, this.connection)); this.connection.setNetHandler(new ClientPlayer(this.gm, this.connection));
} }

File diff suppressed because it is too large Load diff

View 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) {
}
}

View 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) {
}
}

View file

@ -96,7 +96,7 @@ public class BlockRenderer
{ {
Block block = state.getBlock(); Block block = state.getBlock();
if (!this.gm.debugWorld) if (!this.gm.noResolve)
{ {
try try
{ {

View 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;
}
}

View file

@ -175,11 +175,11 @@ public class PlayerController {
public void update() { public void update() {
this.syncItem(); this.syncItem();
if(this.handler.getNetworkManager().isChannelOpen()) { if(this.handler.getConnection().isChannelOpen()) {
this.handler.getNetworkManager().processReceivedPackets(); this.handler.getConnection().processReceivedPackets();
} }
else { else {
this.handler.getNetworkManager().checkDisconnected(); this.handler.getConnection().checkDisconnected();
} }
} }

View file

@ -5,24 +5,60 @@ import java.util.function.Predicate;
import common.biome.Biome; import common.biome.Biome;
import common.block.Block; import common.block.Block;
import common.collect.Lists;
import common.entity.Entity; import common.entity.Entity;
import common.init.BlockRegistry;
import common.init.Blocks; import common.init.Blocks;
import common.tileentity.TileEntity; import common.tileentity.TileEntity;
import common.util.BlockPos; import common.util.BlockPos;
import common.util.BoundingBox; import common.util.BoundingBox;
import common.util.ExtMath;
import common.world.LightType; import common.world.LightType;
import common.world.State; import common.world.State;
public class ChunkEmpty extends ChunkClient { 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 int liquidY;
private final State liquid; private final State liquid;
private final Block liquidBlock; 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); super(world, 0, 0);
this.debug = debug;
this.liquidY = world.dimension.getSeaLevel() - 1; this.liquidY = world.dimension.getSeaLevel() - 1;
this.liquid = world.dimension.getLiquid(); this.liquid = world.dimension.getLiquid();
this.liquidBlock = this.liquid.getBlock(); 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) { public int getHeight(int x, int z) {
@ -30,7 +66,7 @@ public class ChunkEmpty extends ChunkClient {
} }
public Block getBlock(BlockPos pos) { 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) { public int getLight(LightType type, BlockPos pos) {
@ -79,7 +115,11 @@ public class ChunkEmpty extends ChunkClient {
} }
public State getState(BlockPos pos) { 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) { public State setState(BlockPos pos, State state) {

View file

@ -42,6 +42,7 @@ public class WorldClient extends AWorldClient
private static final int DISPLAY_RANGE = 16; private static final int DISPLAY_RANGE = 16;
private final Client gm; private final Client gm;
private final ChunkClient emptyChunk;
private final Set<Entity> entityList = Sets.<Entity>newHashSet(); private final Set<Entity> entityList = Sets.<Entity>newHashSet();
private final Set<Entity> spawnQueue = Sets.<Entity>newHashSet(); private final Set<Entity> spawnQueue = Sets.<Entity>newHashSet();
private final Set<ChunkPos> previousActive = Sets.<ChunkPos>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 List<ChunkClient> chunkListing = Lists.<ChunkClient>newArrayList();
private final Set<Long> emptyChunkListing = Sets.<Long>newHashSet(); private final Set<Long> emptyChunkListing = Sets.<Long>newHashSet();
private final Set<Long> nextEmptyChunkListing = Sets.<Long>newHashSet(); private final Set<Long> nextEmptyChunkListing = Sets.<Long>newHashSet();
private final ChunkClient emptyChunk = new ChunkEmpty(this);
// public final Profiler profiler; // public final Profiler profiler;
protected int lastLightning; protected int lastLightning;
protected Vec3 lightColor = new Vec3(0xffffff); protected Vec3 lightColor = new Vec3(0xffffff);
public WorldClient(Client gm, boolean debug, Dimension dim) public WorldClient(Client gm, boolean debug, Dimension dim)
{ {
super(dim, debug); super(dim);
this.gm = gm; this.gm = gm;
this.emptyChunk = new ChunkEmpty(this, debug);
this.calculateInitialSkylight(); this.calculateInitialSkylight();
this.calculateInitialWeather(); this.calculateInitialWeather();
this.setGravity(this.gm.gravity); this.setGravity(this.gm.gravity);

View file

@ -7,28 +7,16 @@ import common.network.Packet;
import common.network.PacketBuffer; import common.network.PacketBuffer;
public class RPacketLoginSuccess implements Packet<IClientLoginHandler> { public class RPacketLoginSuccess implements Packet<IClientLoginHandler> {
private boolean debug;
public RPacketLoginSuccess() { public RPacketLoginSuccess() {
} }
public RPacketLoginSuccess(boolean debug) {
this.debug = debug;
}
public final void readPacketData(PacketBuffer buf) throws IOException { public final void readPacketData(PacketBuffer buf) throws IOException {
this.debug = buf.readBoolean();
} }
public final void writePacketData(PacketBuffer buf) throws IOException { public final void writePacketData(PacketBuffer buf) throws IOException {
buf.writeBoolean(this.debug);
} }
public void processPacket(IClientLoginHandler handler) { public void processPacket(IClientLoginHandler handler) {
handler.handleLoginSuccess(this); handler.handleLoginSuccess(this);
} }
public boolean isDebug() {
return this.debug;
}
} }

View file

@ -5,8 +5,8 @@ import common.init.SoundEvent;
import common.tags.TagObject; import common.tags.TagObject;
public abstract class AWorldClient extends World { public abstract class AWorldClient extends World {
protected AWorldClient(Dimension dim, boolean debug) { protected AWorldClient(Dimension dim) {
super(dim, true, debug); super(dim, true);
} }
public abstract void playSound(double x, double y, double z, SoundEvent sound, float volume); public abstract void playSound(double x, double y, double z, SoundEvent sound, float volume);

View file

@ -17,8 +17,8 @@ import common.util.PortalType;
import common.village.Village; import common.village.Village;
public abstract class AWorldServer extends World { public abstract class AWorldServer extends World {
protected AWorldServer(Dimension dim, boolean debug) { protected AWorldServer(Dimension dim) {
super(dim, false, debug); super(dim, false);
} }
public abstract List<IPlayer> getAllPlayers(); public abstract List<IPlayer> getAllPlayers();

View file

@ -300,11 +300,6 @@ public abstract class Chunk {
} }
public State getState(BlockPos pos) { 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); 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()); return stor != null ? stor.get(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15) : (pos.getY() < 0 ? this.filler : Blocks.air.getState());
} }

View file

@ -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;
}
}

View file

@ -58,7 +58,6 @@ public abstract class World implements IWorldAccess {
// private static long lastUpdate; // private static long lastUpdate;
public final boolean client; public final boolean client;
public final boolean debug;
public double gravity = 1.0; public double gravity = 1.0;
protected long timeFactor = 1L; protected long timeFactor = 1L;
public final Random rand = new Random(); 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; 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.profiler = profiler;
// this.info = info; // this.info = info;
// this.dimInfo = info.getDimension(dim.getDimensionId()); // this.dimInfo = info.getDimension(dim.getDimensionId());
this.dimension = dim; this.dimension = dim;
// this.storage = storage; // this.storage = storage;
this.client = client; this.client = client;
this.debug = debug;
this.weather = dim.getWeather(); this.weather = dim.getWeather();
} }
@ -200,9 +198,6 @@ public abstract class World implements IWorldAccess {
if(!isValid(pos)) { if(!isValid(pos)) {
return false; return false;
} }
else if(!this.client && this.debug) {
return false;
}
else { else {
Chunk chunk = this.getChunk(pos); Chunk chunk = this.getChunk(pos);
Block block = newState.getBlock(); Block block = newState.getBlock();
@ -225,7 +220,7 @@ public abstract class World implements IWorldAccess {
} }
if(!this.client && (flags & 1) != 0) { if(!this.client && (flags & 1) != 0) {
this.notifyNeighborsRespectDebug(pos, iblockstate.getBlock()); this.notifyNeighborsOfStateChange(pos, iblockstate.getBlock());
if(block.hasComparatorInputOverride()) { if(block.hasComparatorInputOverride()) {
this.updateComparatorOutputLevel(pos, block); 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) { public void markBlocksDirtyVertical(int x1, int z1, int x2, int z2) {
if(x2 > z2) { if(x2 > z2) {
int i = z2; int i = z2;

View file

@ -121,7 +121,6 @@ public final class Server implements IThreadListener {
private final List<Dimension> unload = Lists.<Dimension>newArrayList(); private final List<Dimension> unload = Lists.<Dimension>newArrayList();
private final Map<String, Position> warps = Maps.<String, Position>newTreeMap(); private final Map<String, Position> warps = Maps.<String, Position>newTreeMap();
private final CommandEnvironment scriptEnv = new CommandEnvironment(this); private final CommandEnvironment scriptEnv = new CommandEnvironment(this);
private final boolean debug;
private KeyPair keyPair; private KeyPair keyPair;
private WorldServer space; private WorldServer space;
@ -158,8 +157,7 @@ public final class Server implements IThreadListener {
UniverseRegistry.register(); UniverseRegistry.register();
RotationRegistry.register(); RotationRegistry.register();
ReorderRegistry.register(); ReorderRegistry.register();
boolean debug = System.getProperty("server.debug", null) != null; final Server server = new Server();
final Server server = new Server(debug);
Registry.addShutdownHook(new Runnable() { Registry.addShutdownHook(new Runnable() {
public void run() { public void run() {
server.stopServer(); server.stopServer();
@ -240,8 +238,7 @@ public final class Server implements IThreadListener {
return World.START_TIME; return World.START_TIME;
} }
private Server(boolean debug) { private Server() {
this.debug = debug;
Config.setCallback(new Runnable() { Config.setCallback(new Runnable() {
public void run() { public void run() {
for(WorldServer world : Server.this.getWorlds()) { for(WorldServer world : Server.this.getWorlds()) {
@ -277,7 +274,7 @@ public final class Server implements IThreadListener {
} }
public List<String> getPlayerFilenames() { public List<String> getPlayerFilenames() {
String[] list = this.debug ? null : new File("players").list(); String[] list = new File("players").list();
if(list == null) if(list == null)
return Lists.newArrayList(); return Lists.newArrayList();
List<String> names = Lists.newArrayList(); List<String> names = Lists.newArrayList();
@ -292,14 +289,12 @@ public final class Server implements IThreadListener {
} }
public void saveWorldInfo() { public void saveWorldInfo() {
if(!this.debug) {
saveServerConfig(this.space.getDayTime(), this); saveServerConfig(this.space.getDayTime(), this);
WorldServer.saveWarps(this.warps); WorldServer.saveWarps(this.warps);
} }
}
public TagObject loadPlayerData(String user) { public TagObject loadPlayerData(String user) {
if(this.debug || !IPlayer.isValidUser(user)) if(!IPlayer.isValidUser(user))
return null; return null;
TagObject tag = null; TagObject tag = null;
try { try {
@ -316,7 +311,7 @@ public final class Server implements IThreadListener {
} }
public void writePlayerData(String user, TagObject tag) { public void writePlayerData(String user, TagObject tag) {
if(this.debug || !IPlayer.isValidUser(user)) if(!IPlayer.isValidUser(user))
return; return;
try { try {
File tmp = new File(new File("players"), user + ".cdt.tmp"); 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) { public void saveAllWorlds(boolean message) {
if(this.debug)
return;
if(message) if(message)
Log.TICK.info("Speichere Welt"); Log.TICK.info("Speichere Welt");
this.saveWorldInfo(); this.saveWorldInfo();
@ -372,7 +365,6 @@ public final class Server implements IThreadListener {
} }
public void run(long time) { public void run(long time) {
if(!this.debug) {
Converter.convert(); Converter.convert();
long wtime = this.loadServerConfig(); long wtime = this.loadServerConfig();
if(this.keyPair == null) { if(this.keyPair == null) {
@ -384,8 +376,7 @@ public final class Server implements IThreadListener {
// dtime = World.START_TIME; // dtime = World.START_TIME;
//// Config.set("spawnDim", "1", null); //// Config.set("spawnDim", "1", null);
//// } //// }
this.worlds.add(this.space = new WorldServer(this, wtime, this.worlds.add(this.space = new WorldServer(this, wtime, Space.INSTANCE));
Space.INSTANCE, false));
this.dimensions.put(this.space.dimension.getDimensionId(), this.space); this.dimensions.put(this.space.dimension.getDimensionId(), this.space);
new File("players").mkdirs(); new File("players").mkdirs();
// if(Config.spawnY < 0) { // if(Config.spawnY < 0) {
@ -410,29 +401,13 @@ public final class Server implements IThreadListener {
// Config.set("spawnYaw", "" + (-180.0f + rand.floatv() * 360.0f), null); // Config.set("spawnYaw", "" + (-180.0f + rand.floatv() * 360.0f), null);
// Config.set("spawnPitch", "0.0", 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); this.setTpsTarget(20.0f);
if(!this.debug) {
for(Dimension dim : UniverseRegistry.getDimensions()) { for(Dimension dim : UniverseRegistry.getDimensions()) {
if(WorldServer.needsLoading(dim)) { if(WorldServer.needsLoading(dim)) {
this.getWorld(dim.getDimensionId()).loadForcedChunks(); this.getWorld(dim.getDimensionId()).loadForcedChunks();
} }
WorldServer.loadWarps(dim, this.warps); WorldServer.loadWarps(dim, this.warps);
} }
}
if(Config.port >= 0) if(Config.port >= 0)
this.bind(Config.port); this.bind(Config.port);
else else
@ -626,8 +601,7 @@ public final class Server implements IThreadListener {
Dimension dim = UniverseRegistry.getDimension(dimension); Dimension dim = UniverseRegistry.getDimension(dimension);
if(dim == null) if(dim == null)
return null; return null;
world = new WorldServer(this, this.space.getDayTime(), world = new WorldServer(this, this.space.getDayTime(), dim);
dim, this.debug);
this.worlds.add(world); this.worlds.add(world);
this.dimensions.put(dimension, 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); connection.setNetHandler(conn);
this.players.add(conn); this.players.add(conn);
User user = this.users.remove(loginUser); User user = this.users.remove(loginUser);
@ -861,8 +835,6 @@ public final class Server implements IThreadListener {
} }
private TagObject readPlayer(String user) { private TagObject readPlayer(String user) {
if(this.debug)
return null;
TagObject tag = null; TagObject tag = null;
try { try {
File dat = new File(new File("players"), user + ".cdt"); File dat = new File(new File("players"), user + ".cdt");
@ -878,8 +850,6 @@ public final class Server implements IThreadListener {
} }
private void writePlayer(Player conn) { private void writePlayer(Player conn) {
if(this.debug)
return;
try { try {
TagObject tag = new TagObject(); TagObject tag = new TagObject();
EntityNPC entity = conn.getPresentEntity(); EntityNPC entity = conn.getPresentEntity();
@ -1107,8 +1077,6 @@ public final class Server implements IThreadListener {
} }
public void saveAllPlayerData(boolean message) { public void saveAllPlayerData(boolean message) {
if(this.debug)
return;
if(message) { if(message) {
Log.TICK.info("Speichere Spielerdaten"); Log.TICK.info("Speichere Spielerdaten");
} }

View file

@ -93,7 +93,6 @@ import server.worldgen.FeatureLakes;
import server.worldgen.FeatureLiquids; import server.worldgen.FeatureLiquids;
import server.worldgen.FeatureOres; import server.worldgen.FeatureOres;
import server.worldgen.GeneratorCavern; import server.worldgen.GeneratorCavern;
import server.worldgen.GeneratorDebug;
import server.worldgen.GeneratorDestroyed; import server.worldgen.GeneratorDestroyed;
import server.worldgen.GeneratorFlat; import server.worldgen.GeneratorFlat;
import server.worldgen.GeneratorIsland; import server.worldgen.GeneratorIsland;
@ -283,14 +282,13 @@ public final class WorldServer extends AWorldServer {
return gens; return gens;
} }
public WorldServer(Server server, long dtime, Dimension dim, boolean debug) { public WorldServer(Server server, long dtime, Dimension dim) {
super(dim, debug); super(dim);
this.server = server; this.server = server;
// this.time = time; // this.time = time;
this.daytime = dtime; this.daytime = dtime;
this.updateViewRadius(); this.updateViewRadius();
this.chunkDir = new File(new File("chunk"), dim.getDimensionName()); this.chunkDir = new File(new File("chunk"), dim.getDimensionName());
if(!debug) {
this.chunkDir.mkdirs(); this.chunkDir.mkdirs();
if(!Config.seed.isEmpty()) if(!Config.seed.isEmpty())
this.rand.setSeed((long)Config.seed.hashCode() ^ ~((long)dim.getDimensionName().hashCode())); this.rand.setSeed((long)Config.seed.hashCode() ^ ~((long)dim.getDimensionName().hashCode()));
@ -327,34 +325,9 @@ public final class WorldServer extends AWorldServer {
} }
if(this.exterminated) if(this.exterminated)
this.weather = Weather.CLEAR; this.weather = Weather.CLEAR;
}
this.grng = new Random(this.seed); this.grng = new Random(this.seed);
// GeneratorSettings settings = !debug && !this.exterminated ? dim.getSettings() : null; // GeneratorSettings settings = !debug && !this.exterminated ? dim.getSettings() : null;
if(debug) { if(this.exterminated) {
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) {
this.setExterminatedGen(); this.setExterminatedGen();
} }
// else if(settings != null) { // else if(settings != null) {
@ -440,8 +413,7 @@ public final class WorldServer extends AWorldServer {
this.calculateInitialSkylight(); this.calculateInitialSkylight();
this.calculateInitialWeather(); this.calculateInitialWeather();
this.updatePhysics(); this.updatePhysics();
if(!debug) { tag = null;
TagObject tag = null;
try { try {
File dat = new File(this.chunkDir, "loaders.cdt"); File dat = new File(this.chunkDir, "loaders.cdt");
if(dat.exists() && dat.isFile()) if(dat.exists() && dat.isFile())
@ -471,7 +443,6 @@ public final class WorldServer extends AWorldServer {
this.villageStorage = new VillageCollection(tag); this.villageStorage = new VillageCollection(tag);
} }
} }
}
public Server getServer() { public Server getServer() {
return this.server; return this.server;
@ -486,11 +457,10 @@ public final class WorldServer extends AWorldServer {
this.updateWeather(false); this.updateWeather(false);
this.biomeGen.cleanupCache(); this.biomeGen.cleanupCache();
// this.profiler.start("mobSpawner"); // this.profiler.start("mobSpawner");
if(this.mobs && Config.mobs && Config.tickSpawn && !this.debug) { if(this.mobs && Config.mobs && Config.tickSpawn) {
Spawner.spawn(this); Spawner.spawn(this);
} }
// this.profiler.next("chunkSource"); // this.profiler.next("chunkSource");
if(!this.debug) {
for(int i = 0; i < 100; ++i) { for(int i = 0; i < 100; ++i) {
if(!this.dropped.isEmpty()) { if(!this.dropped.isEmpty()) {
Long v = (Long)this.dropped.iterator().next(); Long v = (Long)this.dropped.iterator().next();
@ -504,7 +474,6 @@ public final class WorldServer extends AWorldServer {
this.dropped.remove(v); this.dropped.remove(v);
} }
} }
}
int light = this.calculateSkylightSubtracted(true); int light = this.calculateSkylightSubtracted(true);
if(light != this.getSkylightSubtracted()) if(light != this.getSkylightSubtracted())
this.setSkylightSubtracted(light); this.setSkylightSubtracted(light);
@ -611,23 +580,16 @@ public final class WorldServer extends AWorldServer {
} }
public void setItemData(String dataID, WorldSavedData worldSavedDataIn) { public void setItemData(String dataID, WorldSavedData worldSavedDataIn) {
if(!this.debug)
this.setData(dataID, worldSavedDataIn); this.setData(dataID, worldSavedDataIn);
} }
public WorldSavedData loadItemData(String dataID) { public WorldSavedData loadItemData(String dataID) {
return this.debug ? null : this.loadData(dataID); return this.loadData(dataID);
} }
protected void updateBlocks() { protected void updateBlocks() {
this.setActivePlayerChunksAndCheckLight(Config.distance); 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 i = 0;
int j = 0; int j = 0;
@ -719,7 +681,6 @@ public final class WorldServer extends AWorldServer {
// this.profiler.end(); // this.profiler.end();
} }
} }
}
private BlockPos adjustPosToNearbyEntity(BlockPos pos) { private BlockPos adjustPosToNearbyEntity(BlockPos pos) {
BlockPos blockpos = this.getPrecipitationHeight(pos); BlockPos blockpos = this.getPrecipitationHeight(pos);
@ -813,10 +774,6 @@ public final class WorldServer extends AWorldServer {
} }
public boolean tickUpdates(boolean p_72955_1_) { public boolean tickUpdates(boolean p_72955_1_) {
if(this.debug) {
return false;
}
else {
int i = this.ticksNext.size(); int i = this.ticksNext.size();
if(i != this.ticks.size()) { if(i != this.ticks.size()) {
@ -868,7 +825,6 @@ public final class WorldServer extends AWorldServer {
return !this.ticksNext.isEmpty(); return !this.ticksNext.isEmpty();
} }
} }
}
public List<NextTickListEntry> getPendingBlockUpdates(ChunkServer chunk) { public List<NextTickListEntry> getPendingBlockUpdates(ChunkServer chunk) {
int x1 = (chunk.xPos << 4) - 2; int x1 = (chunk.xPos << 4) - 2;
@ -1008,7 +964,6 @@ public final class WorldServer extends AWorldServer {
} }
public void saveAllChunks() { public void saveAllChunks() {
if(/* (force || !this.disableSaving) && */ !this.debug) {
// if(this.primary) { // if(this.primary) {
// //
// } // }
@ -1088,7 +1043,6 @@ public final class WorldServer extends AWorldServer {
} }
} }
} }
}
protected void onEntityAdded(Entity entityIn) { protected void onEntityAdded(Entity entityIn) {
this.trackEntity(entityIn); this.trackEntity(entityIn);
@ -1368,7 +1322,6 @@ public final class WorldServer extends AWorldServer {
ChunkServer chunk = this.chunks.getValueByKey(id); ChunkServer chunk = this.chunks.getValueByKey(id);
if(chunk == null) { if(chunk == null) {
if(!this.debug)
chunk = this.loadChunkFromFile(x, z); chunk = this.loadChunkFromFile(x, z);
if(chunk == null) { if(chunk == null) {
@ -1645,8 +1598,6 @@ public final class WorldServer extends AWorldServer {
} }
public boolean exterminate() { public boolean exterminate() {
if(this.debug)
return true;
if(this.exterminated) if(this.exterminated)
return false; return false;
this.setWeather(Weather.CLEAR); this.setWeather(Weather.CLEAR);

View file

@ -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);
}
}
}
}
}