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,7 +286,9 @@ 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;
|
||||
private boolean tertiary;
|
||||
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue