split client and server 6
This commit is contained in:
parent
a6b0f110b1
commit
3e70accb76
26 changed files with 301 additions and 187 deletions
|
@ -3,6 +3,7 @@ package game;
|
|||
import game.entity.Entity;
|
||||
import game.entity.npc.EntityNPC;
|
||||
import game.entity.types.IEntityFX;
|
||||
import game.model.ParticleType;
|
||||
import game.nbt.NBTTagCompound;
|
||||
import game.sound.Sound;
|
||||
import game.world.BlockPos;
|
||||
|
@ -21,4 +22,13 @@ public interface IClient {
|
|||
void addBlockDestroyEffects(BlockPos pos, State state);
|
||||
void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress);
|
||||
void markBlocksForUpdate(int x1, int y1, int z1, int x2, int y2, int z2);
|
||||
void updatePlayerMoveState();
|
||||
void emitParticleAtEntity(Entity entityIn, ParticleType particleTypes);
|
||||
boolean isJumping();
|
||||
boolean isSprinting();
|
||||
boolean isSneaking();
|
||||
float getMoveForward();
|
||||
float getMoveStrafe();
|
||||
void setMoveForward(float value);
|
||||
void setMoveStrafe(float value);
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@ package game.block;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import client.renderer.ticked.TextureFlamesFX1;
|
||||
import client.renderer.ticked.TextureFlamesFX2;
|
||||
import game.collect.Maps;
|
||||
import game.init.Blocks;
|
||||
import game.init.Config;
|
||||
|
@ -1166,7 +1164,7 @@ public class BlockFire extends Block
|
|||
}
|
||||
|
||||
public void getAnimatedTextures(Map<String, Object> map) {
|
||||
map.put("blocks/fire_layer_0", TextureFlamesFX1.class);
|
||||
map.put("blocks/fire_layer_1", TextureFlamesFX2.class);
|
||||
map.put("blocks/fire_layer_0", "fire1");
|
||||
map.put("blocks/fire_layer_1", "fire2");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package game.color;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import client.renderer.texture.TextureUtil;
|
||||
import game.biome.Biome;
|
||||
import game.util.FileUtils;
|
||||
import game.world.BlockPos;
|
||||
import game.world.IWorldAccess;
|
||||
|
||||
|
@ -30,12 +26,18 @@ public enum Colorizer {
|
|||
return biome.waterColor;
|
||||
}
|
||||
};
|
||||
private static final String GRASS_TEX = "textures/world/grass.png";
|
||||
private static final String FOLIAGE_TEX = "textures/world/foliage.png";
|
||||
private static final int[] GRASS = new int[65536];
|
||||
private static final int[] FOLIAGE = new int[65536];
|
||||
|
||||
private final int color;
|
||||
|
||||
public static int[] getGrassMap() {
|
||||
return GRASS;
|
||||
}
|
||||
|
||||
public static int[] getFoliageMap() {
|
||||
return FOLIAGE;
|
||||
}
|
||||
|
||||
public static int getGrassColor(double temp, double rain) {
|
||||
rain = rain * temp;
|
||||
|
@ -52,22 +54,6 @@ public enum Colorizer {
|
|||
return FOLIAGE[j << 8 | i];
|
||||
}
|
||||
|
||||
public static void reload() {
|
||||
BufferedImage img;
|
||||
try {
|
||||
img = TextureUtil.readImage(FileUtils.getResource(GRASS_TEX));
|
||||
img.getRGB(0, 0, 256, 256, GRASS, 0, 256);
|
||||
}
|
||||
catch(Exception e) {
|
||||
}
|
||||
try {
|
||||
img = TextureUtil.readImage(FileUtils.getResource(FOLIAGE_TEX));
|
||||
img.getRGB(0, 0, 256, 256, FOLIAGE, 0, 256);
|
||||
}
|
||||
catch(Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
private static int getColor(IWorldAccess access, BlockPos pos, ColorResolver resolver) {
|
||||
int r = 0;
|
||||
int g = 0;
|
||||
|
|
|
@ -114,9 +114,9 @@ public abstract class EntityHoveringNPC extends EntityNPC
|
|||
public void onLivingUpdate()
|
||||
{
|
||||
if(this.sendQueue != null) {
|
||||
if(this.gm.jump && this.gm.sprint && this.gm.moveForward == 0.0f && this.gm.moveStrafe == 0.0f)
|
||||
if(this.gm.isJumping() && this.gm.isSprinting() && this.gm.getMoveForward() == 0.0f && this.gm.getMoveStrafe() == 0.0f)
|
||||
this.setHovering(true);
|
||||
if(this.isFlying() || (!this.gm.jump && this.gm.sneak && this.onGround))
|
||||
if(this.isFlying() || (!this.gm.isJumping() && this.gm.isSneaking() && this.onGround))
|
||||
this.setHovering(false);
|
||||
}
|
||||
if (!this.onGround && this.motionY < 0.0D && (!this.isPlayer() || (!this.isFlying() && this.isHovering() && !this.jumping)))
|
||||
|
|
|
@ -4,20 +4,7 @@ import java.lang.reflect.InvocationTargetException;
|
|||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import client.Game;
|
||||
import client.gui.container.GuiBrewing;
|
||||
import client.gui.container.GuiChest;
|
||||
import client.gui.container.GuiCrafting;
|
||||
import client.gui.container.GuiDispenser;
|
||||
import client.gui.container.GuiEnchant;
|
||||
import client.gui.container.GuiFurnace;
|
||||
import client.gui.container.GuiHopper;
|
||||
import client.gui.container.GuiHorse;
|
||||
import client.gui.container.GuiMerchant;
|
||||
import client.gui.container.GuiRepair;
|
||||
import client.gui.ingame.GuiSign;
|
||||
import client.renderer.layers.LayerExtra;
|
||||
import client.renderer.texture.EntityTexManager;
|
||||
import game.IClient;
|
||||
import game.ai.AIRangedAttack;
|
||||
import game.ai.EntityAIAttackOnCollide;
|
||||
import game.ai.EntityAIAvoidEntity;
|
||||
|
@ -200,7 +187,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
|
||||
public IPlayer connection;
|
||||
public IClientPlayer sendQueue;
|
||||
protected Game gm;
|
||||
protected IClient gm;
|
||||
|
||||
public InventoryPlayer inventory;
|
||||
protected InventoryWarpChest warpChest;
|
||||
|
@ -405,13 +392,13 @@ public abstract class EntityNPC extends EntityLiving
|
|||
this.stepHeight = 0.0F;
|
||||
}
|
||||
|
||||
public final void setClientPlayer(Game gm, IClientPlayer connection) {
|
||||
public final void setClientPlayer(IClient gm, IClientPlayer connection) {
|
||||
this.initPlayer();
|
||||
this.gm = gm;
|
||||
this.sendQueue = connection;
|
||||
}
|
||||
|
||||
public final void setOtherPlayer(Game gm) {
|
||||
public final void setOtherPlayer(IClient gm) {
|
||||
this.initPlayer();
|
||||
this.gm = gm;
|
||||
this.stepHeight = 0.0F;
|
||||
|
@ -1071,11 +1058,6 @@ public abstract class EntityNPC extends EntityLiving
|
|||
// {
|
||||
// return this.getChar().startsWith("~");
|
||||
// }
|
||||
|
||||
public String getLocationCape()
|
||||
{
|
||||
return !this.getCape().isEmpty() ? EntityTexManager.getCape(this.getCape()) : null;
|
||||
}
|
||||
|
||||
// public boolean canRenderExtras()
|
||||
// {
|
||||
|
@ -1801,7 +1783,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
|
||||
if (this.sendQueue != null && entityIn instanceof EntityCart)
|
||||
{
|
||||
this.gm.getSoundManager().playSound(new MovingSoundMinecartRiding(this, (EntityCart)entityIn));
|
||||
this.gm.playSound(new MovingSoundMinecartRiding(this, (EntityCart)entityIn));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1819,7 +1801,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
if (this.isRiding())
|
||||
{
|
||||
this.sendQueue.addToSendQueue(new CPacketPlayer.C05PacketPlayerLook(this.rotYaw, this.rotPitch, this.onGround));
|
||||
this.sendQueue.addToSendQueue(new CPacketInput(this.moveStrafe, this.moveForward, this.gm.jump, this.gm.sneak));
|
||||
this.sendQueue.addToSendQueue(new CPacketInput(this.moveStrafe, this.moveForward, this.gm.isJumping(), this.gm.isSneaking()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2072,7 +2054,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
// this.setScreenClosed();
|
||||
// this.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_CONTAINER)); // , this.openContainer.windowId));
|
||||
// this.closeScreenAndDropStack();
|
||||
this.gm.displayGuiScreen(null);
|
||||
this.sendQueue.closeGui();
|
||||
}
|
||||
else
|
||||
this.openContainer = this.inventoryContainer;
|
||||
|
@ -2186,7 +2168,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
if(this.connection != null)
|
||||
this.connection.openEditSign(signTile);
|
||||
else if(this.sendQueue != null)
|
||||
this.gm.displayGuiScreen(new GuiSign(signTile.getPos(), signTile.signText));
|
||||
this.sendQueue.displayGuiSign(signTile.getPos(), signTile.signText);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2214,36 +2196,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
if(this.connection != null)
|
||||
this.connection.displayGUIChest(chestInventory);
|
||||
else if(this.sendQueue != null) {
|
||||
String s = chestInventory instanceof IInteractionObject ? ((IInteractionObject)chestInventory).getGuiID() : "container";
|
||||
|
||||
if ("chest".equals(s))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiChest(this.inventory, chestInventory));
|
||||
}
|
||||
else if ("hopper".equals(s))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiHopper(this.inventory, chestInventory));
|
||||
}
|
||||
else if ("furnace".equals(s))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiFurnace(this.inventory, chestInventory));
|
||||
}
|
||||
else if ("brewing_stand".equals(s))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiBrewing(this.inventory, chestInventory));
|
||||
}
|
||||
// else if ("beacon".equals(s))
|
||||
// {
|
||||
// this.gm.displayGuiScreen(new GuiBeacon(this.inventory, chestInventory));
|
||||
// }
|
||||
else if (!"dispenser".equals(s) && !"dropper".equals(s))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiChest(this.inventory, chestInventory));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiDispenser(this.inventory, chestInventory));
|
||||
}
|
||||
this.sendQueue.displayGUIChest(chestInventory, this.inventory);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2252,7 +2205,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
if(this.connection != null)
|
||||
this.connection.displayGUIHorse(horse, horseInventory);
|
||||
else if(this.sendQueue != null)
|
||||
this.gm.displayGuiScreen(new GuiHorse(this.inventory, horseInventory, horse));
|
||||
this.sendQueue.displayGuiHorse(horse, this.inventory, horseInventory);
|
||||
}
|
||||
|
||||
public void displayGui(IInteractionObject guiOwner)
|
||||
|
@ -2260,20 +2213,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
if(this.connection != null)
|
||||
this.connection.displayGui(guiOwner);
|
||||
else if(this.sendQueue != null) {
|
||||
String s = guiOwner.getGuiID();
|
||||
|
||||
if ("crafting_table".equals(s))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiCrafting(this.inventory, this.worldObj));
|
||||
}
|
||||
else if ("enchanting_table".equals(s))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiEnchant(this.inventory, this.worldObj, guiOwner));
|
||||
}
|
||||
else if ("anvil".equals(s))
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiRepair(this.inventory, this.worldObj));
|
||||
}
|
||||
this.sendQueue.displayGui(guiOwner, this.inventory, this.worldObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2285,7 +2225,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
if(this.connection != null)
|
||||
this.connection.onCriticalHit(entityHit);
|
||||
else if(this.sendQueue != null)
|
||||
this.gm.effectRenderer.emitParticleAtEntity(entityHit, ParticleType.CRIT);
|
||||
this.gm.emitParticleAtEntity(entityHit, ParticleType.CRIT);
|
||||
}
|
||||
|
||||
public void onEnchantmentCritical(Entity entityHit)
|
||||
|
@ -2293,7 +2233,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
if(this.connection != null)
|
||||
this.connection.onEnchantmentCritical(entityHit);
|
||||
else if(this.sendQueue != null)
|
||||
this.gm.effectRenderer.emitParticleAtEntity(entityHit, ParticleType.CRIT_MAGIC);
|
||||
this.gm.emitParticleAtEntity(entityHit, ParticleType.CRIT_MAGIC);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2301,7 +2241,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
*/
|
||||
public boolean isSneaking()
|
||||
{
|
||||
return this.sendQueue != null ? this.gm.sneak : super.isSneaking();
|
||||
return this.sendQueue != null ? this.gm.isSneaking() : super.isSneaking();
|
||||
}
|
||||
|
||||
public void updateEntityActionState()
|
||||
|
@ -2316,9 +2256,9 @@ public abstract class EntityNPC extends EntityLiving
|
|||
|
||||
if (this.sendQueue != null && this.isCurrentViewEntity())
|
||||
{
|
||||
this.moveStrafe = this.gm.moveStrafe;
|
||||
this.moveForward = this.gm.moveForward;
|
||||
this.jumping = this.gm.jump;
|
||||
this.moveStrafe = this.gm.getMoveStrafe();
|
||||
this.moveForward = this.gm.getMoveForward();
|
||||
this.jumping = this.gm.isJumping();
|
||||
this.prevRenderArmYaw = this.renderArmYaw;
|
||||
this.prevRenderArmPitch = this.renderArmPitch;
|
||||
this.renderArmPitch = (float)((double)this.renderArmPitch + (double)(this.rotPitch - this.renderArmPitch) * 0.5D);
|
||||
|
@ -2398,16 +2338,16 @@ public abstract class EntityNPC extends EntityLiving
|
|||
// --this.portalTimer;
|
||||
// }
|
||||
|
||||
boolean flag = this.gm.jump;
|
||||
boolean flag1 = this.gm.sneak;
|
||||
boolean flag = this.gm.isJumping();
|
||||
boolean flag1 = this.gm.isSneaking();
|
||||
float f = 0.8F;
|
||||
boolean flag2 = this.gm.moveForward >= f;
|
||||
boolean flag2 = this.gm.getMoveForward() >= f;
|
||||
this.gm.updatePlayerMoveState();
|
||||
|
||||
if (this.isUsingItem() && !this.isRiding())
|
||||
{
|
||||
this.gm.moveStrafe *= 0.2F;
|
||||
this.gm.moveForward *= 0.2F;
|
||||
this.gm.setMoveStrafe(this.gm.getMoveStrafe() * 0.2F);
|
||||
this.gm.setMoveForward(this.gm.getMoveForward() * 0.2F);
|
||||
this.sprintToggleTimer = 0;
|
||||
}
|
||||
|
||||
|
@ -2417,9 +2357,9 @@ public abstract class EntityNPC extends EntityLiving
|
|||
this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.getEntityBoundingBox().minY + 0.5D, this.posZ + (double)this.width * 0.35D);
|
||||
boolean canSprint = true; // (float)this.getFoodStats().getFoodLevel() > 6.0F || this.allowFlying;
|
||||
|
||||
if (this.onGround && !flag1 && !flag2 && this.gm.moveForward >= f && !this.isSprinting() && canSprint && !this.isUsingItem() && !this.hasEffect(Potion.BLINDNESS))
|
||||
if (this.onGround && !flag1 && !flag2 && this.gm.getMoveForward() >= f && !this.isSprinting() && canSprint && !this.isUsingItem() && !this.hasEffect(Potion.BLINDNESS))
|
||||
{
|
||||
if (this.sprintToggleTimer <= 0 && !this.gm.sprint)
|
||||
if (this.sprintToggleTimer <= 0 && !this.gm.isSprinting())
|
||||
{
|
||||
this.sprintToggleTimer = 7;
|
||||
}
|
||||
|
@ -2429,12 +2369,12 @@ public abstract class EntityNPC extends EntityLiving
|
|||
}
|
||||
}
|
||||
|
||||
if (!this.isSprinting() && this.gm.moveForward >= f && canSprint && !this.isUsingItem() && !this.hasEffect(Potion.BLINDNESS) && this.gm.sprint)
|
||||
if (!this.isSprinting() && this.gm.getMoveForward() >= f && canSprint && !this.isUsingItem() && !this.hasEffect(Potion.BLINDNESS) && this.gm.isSprinting())
|
||||
{
|
||||
this.setSprinting(true);
|
||||
}
|
||||
|
||||
if (this.isSprinting() && (this.gm.moveForward < f || this.collidedHorizontally || !canSprint))
|
||||
if (this.isSprinting() && (this.gm.getMoveForward() < f || this.collidedHorizontally || !canSprint))
|
||||
{
|
||||
this.setSprinting(false);
|
||||
}
|
||||
|
@ -2449,7 +2389,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
this.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.START_FLYING));
|
||||
}
|
||||
}
|
||||
else if (!flag && this.gm.jump)
|
||||
else if (!flag && this.gm.isJumping())
|
||||
{
|
||||
if (this.flyToggleTimer == 0)
|
||||
{
|
||||
|
@ -2471,13 +2411,13 @@ public abstract class EntityNPC extends EntityLiving
|
|||
|
||||
if (this.isFlying() && this.isCurrentViewEntity())
|
||||
{
|
||||
if (this.gm.sneak)
|
||||
if (this.gm.isSneaking())
|
||||
{
|
||||
this.motionY -= (double)(
|
||||
this.landMovement * 0.5f * (this.canFlyFullSpeed() ? 3.0F : 1.0F));
|
||||
}
|
||||
|
||||
if (this.gm.jump)
|
||||
if (this.gm.isJumping())
|
||||
{
|
||||
this.motionY += (double)(
|
||||
this.landMovement * 0.5f * (this.canFlyFullSpeed() ? 3.0F : 1.0F));
|
||||
|
@ -2496,12 +2436,12 @@ public abstract class EntityNPC extends EntityLiving
|
|||
}
|
||||
}
|
||||
|
||||
if (flag && !this.gm.jump)
|
||||
if (flag && !this.gm.isJumping())
|
||||
{
|
||||
this.horseJumpPowerCounter = -10;
|
||||
this.sendHorseJump();
|
||||
}
|
||||
else if (!flag && this.gm.jump)
|
||||
else if (!flag && this.gm.isJumping())
|
||||
{
|
||||
this.horseJumpPowerCounter = 0;
|
||||
this.horseJumpPower = 0.0F;
|
||||
|
@ -2854,7 +2794,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
|
||||
public void displayTradeGui(String title)
|
||||
{
|
||||
this.gm.displayGuiScreen(new GuiMerchant(this.inventory, title, this.worldObj));
|
||||
this.sendQueue.displayGuiMerchant(title, this.inventory, this.worldObj);
|
||||
}
|
||||
|
||||
protected boolean isCurrentViewEntity()
|
||||
|
@ -4709,17 +4649,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
public int getColor() {
|
||||
return this.isPlayer() ? 0xff00ff : 0x5000ad;
|
||||
}
|
||||
|
||||
public LayerExtra getExtrasLayer()
|
||||
{
|
||||
return EntityTexManager.getLayer(this.isPlayer() ? this.getId() : -1, this.getChar(), this.species.renderer);
|
||||
}
|
||||
|
||||
public String getLocationSkin()
|
||||
{
|
||||
return EntityTexManager.getSkin(this.isPlayer() ? this.getId() : -1, this.getChar(), this.species.renderer);
|
||||
}
|
||||
|
||||
|
||||
public void sendDeathMessage() {
|
||||
this.sendDeathMessage(this.isPlayer(), true);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package game.entity.types;
|
||||
|
||||
import client.renderer.particle.EntityFX;
|
||||
|
||||
public interface IEntityFX {
|
||||
|
||||
EntityFX multiplyVelocity(float multiplier);
|
||||
IEntityFX multiplyVelocity(float multiplier);
|
||||
|
||||
void setRBGColorF(float particleRedIn, float particleGreenIn, float particleBlueIn);
|
||||
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package game.init;
|
||||
|
||||
import client.renderer.ticked.TextureLavaFX;
|
||||
import client.renderer.ticked.TextureLavaFlowFX;
|
||||
import client.renderer.ticked.TextureWaterFX;
|
||||
import client.renderer.ticked.TextureWaterFlowFX;
|
||||
import game.block.*;
|
||||
import game.color.DyeColor;
|
||||
import game.init.FluidRegistry.LiquidType;
|
||||
|
@ -199,9 +195,9 @@ public abstract class BlockRegistry {
|
|||
.setDisplay("Schwarzbruchstein").setTab(CheatTab.tabNature));
|
||||
|
||||
|
||||
registerFluid(32, 33, "water", "Wasser", true, LiquidType.WATER, false, 0, 5, 0.0f, TextureWaterFX.class, TextureWaterFlowFX.class);
|
||||
registerFluid(32, 33, "water", "Wasser", true, LiquidType.WATER, false, 0, 5, 0.0f, "water", "waterflow");
|
||||
registerFluid(34, 35, "lava", "Lava", false, LiquidType.LAVA, true, 15, -30, 0.0f, 2, 3);
|
||||
registerFluid(36, 37, "magma", "Magma", false, LiquidType.HOT, true, 15, 40, 0.0f, TextureLavaFX.class, TextureLavaFlowFX.class);
|
||||
registerFluid(36, 37, "magma", "Magma", false, LiquidType.HOT, true, 15, 40, 0.0f, "lava", "lavaflow");
|
||||
registerFluid(38, 39, "mercury", "Quecksilber", false, LiquidType.COLD, true, 0, 40, 0.0f, 8, 4);
|
||||
registerFluid(40, 41, "hydrogen", "Wasserstoff", false, LiquidType.COLD, true, 0, 50, 0.0f, 8, 4);
|
||||
registerFluid(42, 43, "acid", "Säure", false, LiquidType.HOT, false, 0, 5, 0.0f, 1, 1);
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package game.network;
|
||||
|
||||
import game.entity.animal.EntityHorse;
|
||||
import game.inventory.IInventory;
|
||||
import game.inventory.InventoryPlayer;
|
||||
import game.packet.S14PacketEntity;
|
||||
import game.packet.S18PacketEntityTeleport;
|
||||
import game.packet.S19PacketEntityHeadLook;
|
||||
|
@ -61,6 +64,9 @@ import game.packet.SPacketTimeUpdate;
|
|||
import game.packet.SPacketTrades;
|
||||
import game.packet.SPacketUpdateHealth;
|
||||
import game.packet.SPacketWorld;
|
||||
import game.tileentity.IInteractionObject;
|
||||
import game.world.BlockPos;
|
||||
import game.world.World;
|
||||
|
||||
public interface IClientPlayer {
|
||||
void addToSendQueue(Packet packet);
|
||||
|
@ -312,4 +318,10 @@ public interface IClientPlayer {
|
|||
|
||||
void handleDimName(SPacketDimensionName packetIn);
|
||||
|
||||
void displayGUIChest(IInventory chestInventory, InventoryPlayer inventory);
|
||||
void displayGui(IInteractionObject guiOwner, InventoryPlayer inventory, World worldObj);
|
||||
void displayGuiHorse(EntityHorse horse, InventoryPlayer inventory, IInventory horseInventory);
|
||||
void displayGuiMerchant(String title, InventoryPlayer inventory, World worldObj);
|
||||
void displayGuiSign(BlockPos pos, String[] signText);
|
||||
void closeGui();
|
||||
}
|
|
@ -44,13 +44,14 @@ public interface IPlayer {
|
|||
}
|
||||
}
|
||||
|
||||
public static int MAX_USER_LENGTH = 16;
|
||||
public static int MAX_NICK_LENGTH = 32;
|
||||
public static int MAX_PASS_LENGTH = 64;
|
||||
public static int MAX_CMD_LENGTH = 1024;
|
||||
public static int MAX_INFO_LENGTH = 4096;
|
||||
public static CharValidator VALID_USER = new IPlayer.UserValidator();
|
||||
public static CharValidator VALID_NICK = new IPlayer.NickValidator();
|
||||
public static final int MAX_USER_LENGTH = 16;
|
||||
public static final int MAX_NICK_LENGTH = 32;
|
||||
public static final int MAX_PASS_LENGTH = 64;
|
||||
public static final int MAX_CMD_LENGTH = 1024;
|
||||
public static final int MAX_INFO_LENGTH = 4096;
|
||||
public static final int MAX_SKIN_SIZE = 65536;
|
||||
public static final CharValidator VALID_USER = new IPlayer.UserValidator();
|
||||
public static final CharValidator VALID_NICK = new IPlayer.NickValidator();
|
||||
|
||||
public static boolean isValidNick(String user) {
|
||||
return VALID_NICK.valid(user);
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package game.packet;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
|
||||
import client.renderer.texture.EntityTexManager;
|
||||
import game.init.SpeciesRegistry.ModelType;
|
||||
import game.network.Packet;
|
||||
import game.network.PacketBuffer;
|
||||
import game.network.IPlayer;
|
||||
|
@ -16,17 +13,9 @@ public class CPacketSkin implements Packet<IPlayer> {
|
|||
public CPacketSkin() {
|
||||
}
|
||||
|
||||
public CPacketSkin(BufferedImage image, String character, ModelType model) {
|
||||
if(image == null) {
|
||||
this.texture = null;
|
||||
this.character = character;
|
||||
}
|
||||
else {
|
||||
int[] img = new int[model.texWidth * model.texHeight];
|
||||
image.getRGB(0, 0, image.getWidth(), image.getHeight(), img, 0, image.getWidth());
|
||||
this.texture = EntityTexManager.imageToComp(img, model);
|
||||
this.character = null;
|
||||
}
|
||||
public CPacketSkin(byte[] texture, String character) {
|
||||
this.texture = texture;
|
||||
this.character = character;
|
||||
}
|
||||
|
||||
public byte[] getCompressed() {
|
||||
|
@ -45,8 +34,8 @@ public class CPacketSkin implements Packet<IPlayer> {
|
|||
else {
|
||||
this.texture = buf.readByteArray();
|
||||
this.character = null;
|
||||
if(this.texture.length == 0 || this.texture.length > EntityTexManager.MAX_SKIN_SIZE)
|
||||
this.texture = new byte[EntityTexManager.MAX_SKIN_SIZE];
|
||||
if(this.texture.length == 0 || this.texture.length > IPlayer.MAX_SKIN_SIZE)
|
||||
this.texture = new byte[IPlayer.MAX_SKIN_SIZE];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ package game.packet;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import client.renderer.texture.EntityTexManager;
|
||||
import game.entity.Entity;
|
||||
import game.network.IClientPlayer;
|
||||
import game.network.IPlayer;
|
||||
import game.network.Packet;
|
||||
import game.network.PacketBuffer;
|
||||
import game.world.World;
|
||||
|
@ -46,8 +46,8 @@ public class SPacketSkin implements Packet<IClientPlayer>
|
|||
if(this.texture.length == 0) {
|
||||
this.texture = null;
|
||||
}
|
||||
else if(this.texture.length > EntityTexManager.MAX_SKIN_SIZE) {
|
||||
this.texture = new byte[EntityTexManager.MAX_SKIN_SIZE];
|
||||
else if(this.texture.length > IPlayer.MAX_SKIN_SIZE) {
|
||||
this.texture = new byte[IPlayer.MAX_SKIN_SIZE];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@ package game.packet;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import client.renderer.texture.EntityTexManager;
|
||||
import game.entity.DataWatcher;
|
||||
import game.entity.npc.EntityNPC;
|
||||
import game.init.EntityRegistry;
|
||||
import game.init.ItemRegistry;
|
||||
import game.item.ItemStack;
|
||||
import game.network.IClientPlayer;
|
||||
import game.network.IPlayer;
|
||||
import game.network.Packet;
|
||||
import game.network.PacketBuffer;
|
||||
import game.util.ExtMath;
|
||||
|
@ -65,8 +65,8 @@ public class SPacketSpawnPlayer implements Packet<IClientPlayer>
|
|||
if(this.texture.length == 0) {
|
||||
this.texture = null;
|
||||
}
|
||||
else if(this.texture.length > EntityTexManager.MAX_SKIN_SIZE) {
|
||||
this.texture = new byte[EntityTexManager.MAX_SKIN_SIZE];
|
||||
else if(this.texture.length > IPlayer.MAX_SKIN_SIZE) {
|
||||
this.texture = new byte[IPlayer.MAX_SKIN_SIZE];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue