Compare commits
6 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c0135b4acb | ||
![]() |
77b05e1b09 | ||
![]() |
e78878c8cc | ||
![]() |
8834e2bdcd | ||
![]() |
6aae6f32e4 | ||
![]() |
aa772848ed |
3230 changed files with 30265 additions and 70098 deletions
12
.gitattributes
vendored
12
.gitattributes
vendored
|
@ -1,12 +0,0 @@
|
|||
#
|
||||
# https://help.github.com/articles/dealing-with-line-endings/
|
||||
#
|
||||
# Linux start script should use lf
|
||||
/gradlew text eol=lf
|
||||
|
||||
# These are Windows script files and should use crlf
|
||||
*.bat text eol=crlf
|
||||
|
||||
# Binary files should be left untouched
|
||||
*.jar binary
|
||||
|
16
.gitignore
vendored
16
.gitignore
vendored
|
@ -1,8 +1,8 @@
|
|||
/dev
|
||||
.metadata
|
||||
.classpath
|
||||
.project
|
||||
.settings
|
||||
.gradle
|
||||
bin
|
||||
build
|
||||
/common/dev
|
||||
/common/bin
|
||||
/client/bin
|
||||
/client/run
|
||||
/server/bin
|
||||
/server/run
|
||||
/export
|
||||
/.metadata
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
# TCR - That Cube Rocks
|
||||
# TCR
|
||||
|
||||
Ein Block-basiertes Open-World-Spiel mit vielen Dimensionen und RPG-Elementen.
|
||||
|
||||
**Projekt ist in der frühen Entwicklungsphase / Alpha**
|
||||
|
||||
Dieses Projekt ist Public Domain, siehe UNLICENSE.
|
||||
Der Client verwendet LWJGL für GLFW und OpenGL, für dessen Lizenz siehe [Die LWJGL Website](https://www.lwjgl.org/license).
|
||||
Ein Minecraft®™ 1.8.9 "Fork"
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
|
||||
plugins {
|
||||
application
|
||||
id("com.gradleup.shadow") version "8.3.6"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":common"))
|
||||
|
||||
implementation(platform("org.lwjgl:lwjgl-bom:3.3.6"))
|
||||
|
||||
implementation("org.lwjgl", "lwjgl")
|
||||
implementation("org.lwjgl", "lwjgl-glfw")
|
||||
implementation("org.lwjgl", "lwjgl-opengl")
|
||||
|
||||
runtimeOnly("org.lwjgl", "lwjgl", classifier = "natives-linux")
|
||||
runtimeOnly("org.lwjgl", "lwjgl", classifier = "natives-freebsd")
|
||||
runtimeOnly("org.lwjgl", "lwjgl", classifier = "natives-windows")
|
||||
runtimeOnly("org.lwjgl", "lwjgl-glfw", classifier = "natives-linux")
|
||||
runtimeOnly("org.lwjgl", "lwjgl-glfw", classifier = "natives-freebsd")
|
||||
runtimeOnly("org.lwjgl", "lwjgl-glfw", classifier = "natives-windows")
|
||||
runtimeOnly("org.lwjgl", "lwjgl-opengl", classifier = "natives-linux")
|
||||
runtimeOnly("org.lwjgl", "lwjgl-opengl", classifier = "natives-freebsd")
|
||||
runtimeOnly("org.lwjgl", "lwjgl-opengl", classifier = "natives-windows")
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass = "client.Client"
|
||||
tasks.run.get().workingDir = rootProject.file("dev/client")
|
||||
tasks.run.get().workingDir.mkdirs()
|
||||
tasks.run.get().systemProperties.put("runtime.devmode", "")
|
||||
}
|
||||
|
||||
tasks.shadowJar {
|
||||
destinationDirectory = rootProject.file("dev")
|
||||
archiveFileName = "tcr_client.jar"
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
package client.util;
|
||||
package client;
|
||||
|
||||
import common.util.Util;
|
||||
|
603
client/src/client/PlayerController.java
Executable file
603
client/src/client/PlayerController.java
Executable file
|
@ -0,0 +1,603 @@
|
|||
package client;
|
||||
|
||||
import client.network.ClientPlayer;
|
||||
import client.world.WorldClient;
|
||||
import common.block.Block;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.EntityRegistry;
|
||||
import common.item.ItemBlock;
|
||||
import common.item.ItemControl;
|
||||
import common.item.ItemStack;
|
||||
import common.material.Material;
|
||||
import common.packet.CPacketAction;
|
||||
import common.packet.CPacketBreak;
|
||||
import common.packet.CPacketClick;
|
||||
import common.packet.CPacketPlace;
|
||||
import common.sound.PositionedSound;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Vec3;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class PlayerController
|
||||
{
|
||||
private final Client gm;
|
||||
private final ClientPlayer netClientHandler;
|
||||
private BlockPos currentBlock = new BlockPos(-1, -1, -1);
|
||||
private ItemStack currentItemHittingBlock;
|
||||
private float curBlockDamageMP;
|
||||
private float stepSoundTickCounter;
|
||||
private int blockHitDelay;
|
||||
private boolean isHittingBlock;
|
||||
private boolean noclip;
|
||||
private int currentPlayerItem;
|
||||
private boolean interacting;
|
||||
|
||||
public PlayerController(Client gmIn, ClientPlayer netHandler)
|
||||
{
|
||||
this.gm = gmIn;
|
||||
this.netClientHandler = netHandler;
|
||||
}
|
||||
|
||||
// public static void clickBlockCreative(Game gmIn, PlayerController playerController, BlockPos pos, Facing facing)
|
||||
// {
|
||||
// if (!gmIn.theWorld.extinguishFire(gmIn.thePlayer, pos, facing))
|
||||
// {
|
||||
// playerController.onPlayerDestroyBlock(pos, facing);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public void setPlayerCapabilities()
|
||||
// {
|
||||
// this.gm.thePlayer.flying &= this.gm.thePlayer.hasEffect(Potion.flying) || this.gm.thePlayer.noclip;
|
||||
// }
|
||||
|
||||
// public boolean isNoclip()
|
||||
// {
|
||||
// return this.gm.thePlayer.capabilities.noClip;
|
||||
// }
|
||||
|
||||
// public void setNoclip(boolean noclip)
|
||||
// {
|
||||
// this.noclip = noclip;
|
||||
// }
|
||||
|
||||
// public void setCheat(boolean cheat)
|
||||
// {
|
||||
// this.cheat = cheat;
|
||||
// this.setPlayerCapabilities();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// public boolean shouldDrawHUD()
|
||||
// {
|
||||
// return !this.creative;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Called when a player completes the destruction of a block
|
||||
*/
|
||||
public boolean onPlayerDestroyBlock(BlockPos pos, Facing side)
|
||||
{
|
||||
// if (this.gamemode.isAdventure())
|
||||
// {
|
||||
// if (this.gamemode == Gamemode.SPECTATOR)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// if (!this.gm.thePlayer.isAllowEdit())
|
||||
// {
|
||||
// Block block = this.gm.theWorld.getBlockState(pos).getBlock();
|
||||
// ItemStack itemstack = this.gm.thePlayer.getCurrentEquippedItem();
|
||||
//
|
||||
// if (itemstack == null)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (!itemstack.canDestroy(block))
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (this.gm.thePlayer.getHeldItem() != null && !this.gm.thePlayer.getHeldItem().getItem().canBreakBlocks())
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
World world = this.gm.world;
|
||||
State iblockstate = world.getState(pos);
|
||||
Block block1 = iblockstate.getBlock();
|
||||
|
||||
if (block1.getMaterial() == Material.air)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
world.playAuxSFX(2001, pos, BlockRegistry.getStateId(iblockstate));
|
||||
boolean flag = world.setBlockToAir(pos);
|
||||
|
||||
if (flag)
|
||||
{
|
||||
block1.onBlockDestroyedByPlayer(world, pos, iblockstate);
|
||||
}
|
||||
|
||||
this.currentBlock = new BlockPos(this.currentBlock.getX(), -1, this.currentBlock.getZ());
|
||||
|
||||
// if (!this.creative)
|
||||
// {
|
||||
ItemStack itemstack1 = this.gm.player.getCurrentEquippedItem();
|
||||
|
||||
if (itemstack1 != null)
|
||||
{
|
||||
itemstack1.onBlockDestroyed(world, block1, pos, this.gm.player);
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
this.gm.player.destroyCurrentEquippedItem();
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
return flag;
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player is hitting a block with an item.
|
||||
*/
|
||||
public boolean clickBlock(BlockPos loc, Facing face)
|
||||
{
|
||||
// if (this.gamemode.isAdventure())
|
||||
// {
|
||||
// if (this.gamemode == Gamemode.SPECTATOR)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// if (!this.gm.thePlayer.isAllowEdit())
|
||||
// {
|
||||
// Block block = this.gm.theWorld.getBlockState(loc).getBlock();
|
||||
// ItemStack itemstack = this.gm.thePlayer.getCurrentEquippedItem();
|
||||
//
|
||||
// if (itemstack == null)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (!itemstack.canDestroy(block))
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
if (!World.isValidXZ(loc))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemStack stack = this.gm.player.getHeldItem();
|
||||
if(stack != null && stack.getItem().onAction(stack, this.gm.player, this.gm.world, ItemControl.PRIMARY, loc)) {
|
||||
this.interacting = true;
|
||||
this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.START_DESTROY_BLOCK, loc, face));
|
||||
return true;
|
||||
}
|
||||
// if (this.creative)
|
||||
// {
|
||||
// this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.START_DESTROY_BLOCK, loc, face));
|
||||
// clickBlockCreative(this.gm, this, loc, face);
|
||||
// this.blockHitDelay = 5;
|
||||
// }
|
||||
// else
|
||||
if (!this.isHittingBlock || !this.isHittingPosition(loc))
|
||||
{
|
||||
if (this.isHittingBlock)
|
||||
{
|
||||
this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.ABORT_DESTROY_BLOCK, this.currentBlock, face));
|
||||
}
|
||||
|
||||
this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.START_DESTROY_BLOCK, loc, face));
|
||||
Block block1 = this.gm.world.getState(loc).getBlock();
|
||||
boolean flag = block1.getMaterial() != Material.air;
|
||||
|
||||
if (flag && this.curBlockDamageMP == 0.0F)
|
||||
{
|
||||
block1.onBlockClicked(this.gm.world, loc, this.gm.player);
|
||||
}
|
||||
|
||||
if (flag && block1.getPlayerRelativeBlockHardness(this.gm.player, this.gm.player.worldObj, loc) >= 1.0F)
|
||||
{
|
||||
this.onPlayerDestroyBlock(loc, face);
|
||||
// if(this.cheat && block1.getPlayerRelativeBlockHardness(this.gm.thePlayer, this.gm.thePlayer.worldObj, loc) < 1.0F)
|
||||
this.blockHitDelay = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.isHittingBlock = true;
|
||||
this.currentBlock = loc;
|
||||
this.currentItemHittingBlock = this.gm.player.getHeldItem();
|
||||
this.curBlockDamageMP = 0.0F;
|
||||
this.stepSoundTickCounter = 0.0F;
|
||||
this.gm.world.sendBlockBreakProgress(this.gm.player.getId(), this.currentBlock, (int)(this.curBlockDamageMP * 10.0F) - 1);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets current block damage and isHittingBlock
|
||||
*/
|
||||
public void resetBlockRemoving()
|
||||
{
|
||||
if (this.isHittingBlock)
|
||||
{
|
||||
this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.ABORT_DESTROY_BLOCK, this.currentBlock, Facing.DOWN));
|
||||
this.isHittingBlock = false;
|
||||
this.curBlockDamageMP = 0.0F;
|
||||
this.gm.world.sendBlockBreakProgress(this.gm.player.getId(), this.currentBlock, -1);
|
||||
}
|
||||
}
|
||||
|
||||
public void resetInteraction()
|
||||
{
|
||||
this.interacting = false;
|
||||
}
|
||||
|
||||
public boolean onPlayerDamageBlock(BlockPos posBlock, Facing directionFacing)
|
||||
{
|
||||
if(this.interacting)
|
||||
return false;
|
||||
this.syncCurrentPlayItem();
|
||||
|
||||
if (this.blockHitDelay > 0)
|
||||
{
|
||||
--this.blockHitDelay;
|
||||
return true;
|
||||
}
|
||||
// else if (this.creative && World.isValidXZ(posBlock))
|
||||
// {
|
||||
// this.blockHitDelay = 5;
|
||||
// this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.START_DESTROY_BLOCK, posBlock, directionFacing));
|
||||
// clickBlockCreative(this.gm, this, posBlock, directionFacing);
|
||||
// return true;
|
||||
// }
|
||||
else if (this.isHittingPosition(posBlock))
|
||||
{
|
||||
Block block = this.gm.world.getState(posBlock).getBlock();
|
||||
|
||||
if (block.getMaterial() == Material.air)
|
||||
{
|
||||
this.isHittingBlock = false;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.curBlockDamageMP += block.getPlayerRelativeBlockHardness(this.gm.player, this.gm.player.worldObj, posBlock);
|
||||
|
||||
if (this.stepSoundTickCounter % 4.0F == 0.0F && block.sound.getStepSound() != null)
|
||||
{
|
||||
this.gm.getSoundManager().playSound(new PositionedSound(block.sound.getStepSound(), 0.25F, /* block.sound.getFrequency() * 0.5F, */ (float)posBlock.getX() + 0.5F, (float)posBlock.getY() + 0.5F, (float)posBlock.getZ() + 0.5F));
|
||||
}
|
||||
|
||||
++this.stepSoundTickCounter;
|
||||
|
||||
if (this.curBlockDamageMP >= 1.0F)
|
||||
{
|
||||
this.isHittingBlock = false;
|
||||
this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.STOP_DESTROY_BLOCK, posBlock, directionFacing));
|
||||
this.onPlayerDestroyBlock(posBlock, directionFacing);
|
||||
this.curBlockDamageMP = 0.0F;
|
||||
this.stepSoundTickCounter = 0.0F;
|
||||
this.blockHitDelay = 5;
|
||||
}
|
||||
|
||||
this.gm.world.sendBlockBreakProgress(this.gm.player.getId(), this.currentBlock, (int)(this.curBlockDamageMP * 10.0F) - 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.clickBlock(posBlock, directionFacing);
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * player reach distance = 4F
|
||||
// */
|
||||
// public float getBlockReachDistance()
|
||||
// {
|
||||
// return ;
|
||||
// }
|
||||
|
||||
public void updateController()
|
||||
{
|
||||
this.syncCurrentPlayItem();
|
||||
|
||||
if (this.netClientHandler.getNetworkManager().isChannelOpen())
|
||||
{
|
||||
this.netClientHandler.getNetworkManager().processReceivedPackets();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.netClientHandler.getNetworkManager().checkDisconnected();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isHittingPosition(BlockPos pos)
|
||||
{
|
||||
ItemStack itemstack = this.gm.player.getHeldItem();
|
||||
boolean flag = this.currentItemHittingBlock == null && itemstack == null;
|
||||
|
||||
if (this.currentItemHittingBlock != null && itemstack != null)
|
||||
{
|
||||
flag = itemstack.getItem() == this.currentItemHittingBlock.getItem() && ItemStack.areItemStackTagsEqual(itemstack, this.currentItemHittingBlock) && (itemstack.isItemStackDamageable() || itemstack.getMetadata() == this.currentItemHittingBlock.getMetadata());
|
||||
}
|
||||
|
||||
return pos.equals(this.currentBlock) && flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Syncs the current player item with the server
|
||||
*/
|
||||
private void syncCurrentPlayItem()
|
||||
{
|
||||
int i = this.gm.player.inventory.currentItem;
|
||||
|
||||
if (i != this.currentPlayerItem)
|
||||
{
|
||||
this.currentPlayerItem = i;
|
||||
this.netClientHandler.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_ITEMSLOT, this.currentPlayerItem));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onPlayerRightClick(EntityNPC player, WorldClient worldIn, ItemStack heldStack, BlockPos hitPos, Facing side, Vec3 hitVec)
|
||||
{
|
||||
this.syncCurrentPlayItem();
|
||||
float f = (float)(hitVec.xCoord - (double)hitPos.getX());
|
||||
float f1 = (float)(hitVec.yCoord - (double)hitPos.getY());
|
||||
float f2 = (float)(hitVec.zCoord - (double)hitPos.getZ());
|
||||
boolean flag = false;
|
||||
|
||||
if (!World.isValidXZ(hitPos))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(heldStack == null || !heldStack.getItem().onAction(heldStack, player, worldIn, ItemControl.SECONDARY, hitPos)) {
|
||||
// if (this.gamemode != Gamemode.SPECTATOR)
|
||||
// {
|
||||
State iblockstate = worldIn.getState(hitPos);
|
||||
|
||||
if ((!player.isSneaking() || player.getHeldItem() == null) // && (player.getHeldItem() == null || !player.getHeldItem().getItem().ignoresBlocks())
|
||||
&& iblockstate.getBlock().onBlockActivated(worldIn, hitPos, iblockstate, player, side, f, f1, f2))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!flag && heldStack != null && heldStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
ItemBlock itemblock = (ItemBlock)heldStack.getItem();
|
||||
|
||||
if (!itemblock.canPlaceBlockOnSide(worldIn, hitPos, side, player, heldStack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
else {
|
||||
heldStack.getItem().onItemUse(heldStack, player, worldIn, hitPos, side, f, f1, f2);
|
||||
flag = true;
|
||||
}
|
||||
|
||||
this.netClientHandler.addToSendQueue(new CPacketPlace(hitPos, side.getIndex(), player.inventory.getCurrentItem(), f, f1, f2));
|
||||
|
||||
if (!flag) // && this.gamemode != Gamemode.SPECTATOR)
|
||||
{
|
||||
if (heldStack == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// else if (this.creative)
|
||||
// {
|
||||
// int i = heldStack.getMetadata();
|
||||
// int j = heldStack.stackSize;
|
||||
// boolean flag1 = heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2);
|
||||
// heldStack.setItemDamage(i);
|
||||
// heldStack.stackSize = j;
|
||||
// return flag1;
|
||||
// }
|
||||
else
|
||||
{
|
||||
return heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the server of things like consuming food, etc...
|
||||
*/
|
||||
public boolean sendUseItem(EntityNPC playerIn, World worldIn, ItemStack itemStackIn)
|
||||
{
|
||||
// if (this.gamemode == Gamemode.SPECTATOR)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
this.syncCurrentPlayItem();
|
||||
this.netClientHandler.addToSendQueue(new CPacketPlace(playerIn.inventory.getCurrentItem()));
|
||||
int i = itemStackIn.stackSize;
|
||||
ItemStack itemstack = itemStackIn.useItemRightClick(worldIn, playerIn);
|
||||
|
||||
if (itemstack != itemStackIn || itemstack != null && itemstack.stackSize != i)
|
||||
{
|
||||
playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack;
|
||||
|
||||
if (itemstack.stackSize == 0)
|
||||
{
|
||||
playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
public EntityNPC createPlayerEntity(WorldClient worldIn, int type)
|
||||
{
|
||||
EntityNPC player = (EntityNPC)EntityRegistry.createEntityByID(type, worldIn);
|
||||
player.setClientPlayer(this.netClientHandler);
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attacks an entity
|
||||
*/
|
||||
public void attackEntity(EntityNPC playerIn, Entity targetEntity)
|
||||
{
|
||||
this.syncCurrentPlayItem();
|
||||
this.netClientHandler.addToSendQueue(new CPacketAction(CPacketAction.Action.ATTACK, targetEntity.getId()));
|
||||
|
||||
// if (this.gamemode != Gamemode.SPECTATOR)
|
||||
// {
|
||||
playerIn.attackTargetEntityWithCurrentItem(targetEntity);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Send packet to server - player is interacting with another entity (left click)
|
||||
*/
|
||||
public boolean interactWithEntitySendPacket(EntityNPC playerIn, Entity targetEntity)
|
||||
{
|
||||
this.syncCurrentPlayItem();
|
||||
this.netClientHandler.addToSendQueue(new CPacketAction(CPacketAction.Action.INTERACT, targetEntity.getId()));
|
||||
return /* this.gamemode != Gamemode.SPECTATOR && */ playerIn.interactWith(targetEntity);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Return true when the player rightclick on an entity
|
||||
// *
|
||||
// * @param player The player's instance
|
||||
// * @param entityIn The entity clicked
|
||||
// * @param movingObject The object clicked
|
||||
// */
|
||||
// public boolean isPlayerRightClickingOnEntity(EntityNPC player, Entity entityIn, MovingObjectPosition movingObject)
|
||||
// {
|
||||
// this.syncCurrentPlayItem();
|
||||
// Vec3 vec3 = new Vec3(movingObject.hitVec.xCoord - entityIn.posX, movingObject.hitVec.yCoord - entityIn.posY, movingObject.hitVec.zCoord - entityIn.posZ);
|
||||
// this.netClientHandler.addToSendQueue(new C02PacketUseEntity(entityIn, vec3));
|
||||
// return this.gamemode != Gamemode.SPECTATOR && entityIn.interactAt(player, vec3);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Handles slot clicks sends a packet to the server.
|
||||
*/
|
||||
public ItemStack windowClick(int windowId, int slotId, int mouseButtonClicked, int mode, EntityNPC playerIn)
|
||||
{
|
||||
short short1 = playerIn.openContainer.getNextTransactionID(playerIn.inventory);
|
||||
ItemStack itemstack = playerIn.openContainer.slotClick(slotId, mouseButtonClicked, mode, playerIn);
|
||||
this.netClientHandler.addToSendQueue(new CPacketClick(windowId, slotId, mouseButtonClicked, mode, itemstack, short1));
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
/**
|
||||
* GuiEnchantment uses this during multiplayer to tell PlayerControllerMP to send a packet indicating the
|
||||
* enchantment action the player has taken.
|
||||
*
|
||||
* @param windowID The ID of the current window
|
||||
* @param button The button id (enchantment selected)
|
||||
*/
|
||||
public void sendEnchantPacket(int windowID, int button)
|
||||
{
|
||||
this.netClientHandler.addToSendQueue(new CPacketAction(CPacketAction.Action.ENCHANT_ITEM, windowID | (button << 8)));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Used in PlayerControllerMP to update the server with an ItemStack in a slot.
|
||||
// */
|
||||
// public void sendCheatPacket(ItemStack itemStackIn, boolean full)
|
||||
// {
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Sends a Packet107 to the server to drop the item on the ground
|
||||
// */
|
||||
// public void sendPacketDropItem(ItemStack itemStackIn)
|
||||
// {
|
||||
// if (this.creative && itemStackIn != null)
|
||||
// {
|
||||
// this.netClientHandler.addToSendQueue(new CPacketCreative(-1, itemStackIn));
|
||||
// }
|
||||
// }
|
||||
|
||||
public void onStoppedUsingItem(EntityNPC playerIn)
|
||||
{
|
||||
this.syncCurrentPlayItem();
|
||||
this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, Facing.DOWN));
|
||||
playerIn.stopUsingItem();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * Checks if the player is not creative, used for checking if it should break a block instantly
|
||||
// */
|
||||
// public boolean isNotCreative()
|
||||
// {
|
||||
// return !this.creative;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * returns true if player is in creative mode
|
||||
// */
|
||||
// public boolean isCreative()
|
||||
// {
|
||||
// return this.creative;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Checks if the player is riding a horse, used to chose the GUI to open
|
||||
// */
|
||||
// public boolean isRidingHorse()
|
||||
// {
|
||||
// return ;
|
||||
// }
|
||||
|
||||
// public Gamemode getGamemode()
|
||||
// {
|
||||
// return this.gamemode;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Return isHittingBlock
|
||||
*/
|
||||
public boolean getIsHittingBlock()
|
||||
{
|
||||
return this.isHittingBlock;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package client.util;
|
||||
package client;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
|
@ -171,20 +171,20 @@ public abstract class SkinConverter {
|
|||
img = ImageIO.read(source);
|
||||
}
|
||||
catch(IOException e) {
|
||||
Log.IO.error(e, "Konnte kein Bild von " + source + " laden");
|
||||
Log.JNI.error(e, "Konnte kein Bild von " + source + " laden");
|
||||
return false;
|
||||
}
|
||||
if(img == null) {
|
||||
Log.IO.warn("Konnte kein Bild von " + source + " laden");
|
||||
Log.JNI.warn("Konnte kein Bild von " + source + " laden");
|
||||
return false;
|
||||
}
|
||||
Log.IO.info("Bild von " + source + " geladen");
|
||||
Log.JNI.info("Bild von " + source + " geladen");
|
||||
if(img.getWidth() == 64 && img.getHeight() == 32) {
|
||||
img = convertSkin(img);
|
||||
Log.IO.info("Skin " + source + " konvertiert");
|
||||
Log.JNI.info("Skin " + source + " konvertiert");
|
||||
}
|
||||
else if(img.getWidth() != 64 || img.getHeight() != 64) {
|
||||
Log.IO.warn("Falsche Bildgröße von " + source + ": " + img.getWidth() + "x" + img.getHeight());
|
||||
Log.JNI.warn("Falsche Bildgröße von " + source + ": " + img.getWidth() + "x" + img.getHeight());
|
||||
return false;
|
||||
}
|
||||
String name = source.getName();
|
||||
|
@ -195,7 +195,7 @@ public abstract class SkinConverter {
|
|||
name = "skin";
|
||||
if(slim) {
|
||||
img = convertSlim(img);
|
||||
Log.IO.info("Skin " + source + " von 'Slim' konvertiert");
|
||||
Log.JNI.info("Skin " + source + " von 'Slim' konvertiert");
|
||||
if(!name.startsWith("slim_"))
|
||||
name = "slim_" + name;
|
||||
}
|
||||
|
@ -217,10 +217,10 @@ public abstract class SkinConverter {
|
|||
ImageIO.write(img, "png", file);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error(e, "Konnte Bild nicht speichern");
|
||||
Log.JNI.error(e, "Konnte Bild nicht speichern");
|
||||
return false;
|
||||
}
|
||||
Log.IO.info("Skin " + source + " gespeichert als " + file.getName());
|
||||
Log.JNI.info("Skin " + source + " gespeichert als " + file.getName());
|
||||
return true;
|
||||
}
|
||||
|
30
client/src/client/Timing.java
Normal file
30
client/src/client/Timing.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
package client;
|
||||
|
||||
public class Timing {
|
||||
public static long tmr_timer;
|
||||
public static long tmr_start;
|
||||
public static long tmr_current;
|
||||
public static long tmr_last;
|
||||
|
||||
public static long tmr_delta;
|
||||
public static long tmr_update;
|
||||
public static long tmr_frames;
|
||||
public static long tmr_iters;
|
||||
|
||||
public static long tick_torun;
|
||||
public static long tick_done;
|
||||
public static long tick_total;
|
||||
public static long tick_time;
|
||||
public static long tick_stime;
|
||||
public static long tick_ftime;
|
||||
|
||||
public static long tick_ttime;
|
||||
public static long tick_update;
|
||||
|
||||
public static double tick_fraction;
|
||||
public static float framerate;
|
||||
public static float tickrate;
|
||||
public static float fdelta;
|
||||
public static int tickTarget;
|
||||
public static int tickFrame;
|
||||
}
|
|
@ -11,6 +11,7 @@ import javax.sound.sampled.DataLine.Info;
|
|||
import common.collect.Lists;
|
||||
import common.log.Log;
|
||||
|
||||
import javax.sound.sampled.LineUnavailableException;
|
||||
import javax.sound.sampled.SourceDataLine;
|
||||
|
||||
public class AudioInterface implements Runnable {
|
||||
|
@ -137,12 +138,12 @@ public class AudioInterface implements Runnable {
|
|||
|
||||
public void run() {
|
||||
AudioFormat format = new AudioFormat(Encoding.PCM_SIGNED, 48000, 16, 2, 2 * 2, 48000, false);
|
||||
Info info = new Info(SourceDataLine.class, format, this.devbufsize == 0 ? AudioSystem.NOT_SPECIFIED : this.devbufsize);
|
||||
Info info = new Info(SourceDataLine.class, format, this.devbufsize);
|
||||
try {
|
||||
this.line = (SourceDataLine)AudioSystem.getLine(info);
|
||||
this.line.open(format, this.devbufsize == 0 ? AudioSystem.NOT_SPECIFIED : this.devbufsize);
|
||||
this.line.open(format, this.devbufsize);
|
||||
}
|
||||
catch(Exception e) {
|
||||
catch(LineUnavailableException e) {
|
||||
this.line = null;
|
||||
Log.SOUND.error(e, "Konnte Audiogerät nicht öffnen");
|
||||
}
|
|
@ -11,7 +11,6 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
|
||||
import client.Client;
|
||||
import client.util.FileUtils;
|
||||
import common.collect.BiMap;
|
||||
import common.collect.HashBiMap;
|
||||
import common.collect.Lists;
|
||||
|
@ -23,6 +22,7 @@ import common.rng.Random;
|
|||
import common.sound.MovingSound;
|
||||
import common.sound.Sound;
|
||||
import common.util.ExtMath;
|
||||
import common.util.FileUtils;
|
||||
|
||||
public class SoundManager {
|
||||
private class Source {
|
||||
|
@ -238,8 +238,8 @@ public class SoundManager {
|
|||
this.sources.put(s, new Source(getBuffer(sound.getSoundLocation()), Volume.getByType(sound.getChannelType()), sound.canRepeat(), s, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType(), attn, volume));
|
||||
this.playingSoundsStopTime.put(s, this.playTime + 20);
|
||||
this.playingSounds.put(s, sound);
|
||||
if (sound instanceof MovingSound moving)
|
||||
this.tickableSounds.add(moving);
|
||||
if (sound instanceof MovingSound)
|
||||
this.tickableSounds.add((MovingSound)sound);
|
||||
}
|
||||
}
|
||||
|
|
@ -8,14 +8,13 @@ import org.lwjgl.opengl.GL11;
|
|||
|
||||
import client.renderer.GlState;
|
||||
import client.renderer.texture.TextureUtil;
|
||||
import client.util.FileUtils;
|
||||
import common.log.Log;
|
||||
import common.util.FileUtils;
|
||||
|
||||
public class Font {
|
||||
public static final FontChar[] SIZES = new FontChar[256];
|
||||
|
||||
public static int XGLYPH = 12;
|
||||
public static int YGLYPH = 14;
|
||||
public static final int XGLYPH = 12;
|
||||
public static final int YGLYPH = 18;
|
||||
|
||||
private static int texture;
|
||||
|
||||
|
@ -73,12 +72,10 @@ public class Font {
|
|||
}
|
||||
}
|
||||
|
||||
public static void load(boolean tiny) {
|
||||
XGLYPH = tiny ? 6 : 12;
|
||||
YGLYPH = tiny ? 7 : 14;
|
||||
public static void load() {
|
||||
BufferedImage img = null;
|
||||
try {
|
||||
img = TextureUtil.readImage(FileUtils.getResource("textures/font" + (tiny ? "_tiny" : "") + ".png"));
|
||||
img = TextureUtil.readImage(FileUtils.getResource("textures/font.png"));
|
||||
}
|
||||
catch(FileNotFoundException e) {
|
||||
Log.IO.error("Konnte Font-Textur nicht laden: Datei nicht vorhanden");
|
|
@ -16,7 +16,7 @@ import client.window.Keysym;
|
|||
import common.collect.Lists;
|
||||
|
||||
public abstract class Gui {
|
||||
public static final String BACKGROUND = "textures/background.png";
|
||||
public static final String DIRT_BACKGROUND = "textures/background.png";
|
||||
public static final int HOVER_COLOR = 0x288080ff;
|
||||
public static final int PRESS_COLOR = 0x30afafff;
|
||||
|
||||
|
@ -176,8 +176,8 @@ public abstract class Gui {
|
|||
this.min_y = Math.min(this.min_y, elem.getY());
|
||||
this.max_x = Math.max(this.max_x, elem.getX() + elem.getWidth());
|
||||
this.max_y = Math.max(this.max_y, elem.getY() + elem.getHeight());
|
||||
if(elem instanceof Dropdown drop)
|
||||
this.add(drop.getHandle());
|
||||
if(elem instanceof Dropdown)
|
||||
this.add(((Dropdown)elem).getHandle());
|
||||
return elem;
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ public abstract class Gui {
|
|||
Drawing.drawGradient(0, 0, this.gm.fb_x, this.gm.fb_y, 0xc0101010, 0xd0101010);
|
||||
}
|
||||
else {
|
||||
Drawing.drawScaled(this.gm, BACKGROUND);
|
||||
Drawing.drawScaled(this.gm, DIRT_BACKGROUND);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,20 +3,19 @@ package client.gui;
|
|||
import client.gui.element.ActButton;
|
||||
import client.gui.element.ButtonCallback;
|
||||
import client.gui.element.Label;
|
||||
import client.gui.element.MultiLabel;
|
||||
import client.gui.element.PressType;
|
||||
import client.gui.element.TransparentArea;
|
||||
|
||||
public class GuiConfirm extends Gui implements ButtonCallback {
|
||||
public static interface Callback {
|
||||
void confirm(boolean confirmed);
|
||||
}
|
||||
|
||||
private final Callback callback;
|
||||
private final String messageLine1;
|
||||
private final String messageLine2;
|
||||
private final String confirmButtonText;
|
||||
private final String cancelButtonText;
|
||||
|
||||
protected Callback callback;
|
||||
protected String messageLine1;
|
||||
private String messageLine2;
|
||||
protected String confirmButtonText;
|
||||
protected String cancelButtonText;
|
||||
private ActButton confirmBtn;
|
||||
private ActButton cancelBtn;
|
||||
|
||||
|
@ -29,10 +28,10 @@ public class GuiConfirm extends Gui implements ButtonCallback {
|
|||
}
|
||||
|
||||
public void init(int width, int height) {
|
||||
this.add(new Label(0, 0, 700, 0, this.messageLine1));
|
||||
this.add(new MultiLabel(0, 40, 700, 300, this.messageLine2, true));
|
||||
this.confirmBtn = this.add(new ActButton(100, 400, 245, 0, this, this.confirmButtonText));
|
||||
this.cancelBtn = this.add(new ActButton(355, 400, 245, 0, this, this.cancelButtonText));
|
||||
this.add(new Label(0, 0, 500, 24, this.messageLine1, true));
|
||||
this.add(new TransparentArea(0, 80, 500, 300, this.messageLine2, this.gm.world != null && !this.gm.charEditor));
|
||||
this.confirmBtn = this.add(new ActButton(48, 500, 200, 24, this, this.confirmButtonText));
|
||||
this.cancelBtn = this.add(new ActButton(252, 500, 200, 24, this, this.cancelButtonText));
|
||||
this.shift();
|
||||
}
|
||||
|
268
client/src/client/gui/GuiConnect.java
Normal file
268
client/src/client/gui/GuiConnect.java
Normal file
|
@ -0,0 +1,268 @@
|
|||
package client.gui;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
|
||||
import client.gui.element.ActButton;
|
||||
import client.gui.element.ButtonCallback;
|
||||
import client.gui.element.GuiList;
|
||||
import client.gui.element.ListEntry;
|
||||
import client.gui.element.NavButton;
|
||||
import client.gui.element.PressType;
|
||||
import client.renderer.Drawing;
|
||||
import common.color.TextColor;
|
||||
import common.init.Config;
|
||||
import common.log.Log;
|
||||
import common.network.IPlayer;
|
||||
import common.util.FileUtils;
|
||||
import common.util.Tuple;
|
||||
import common.util.Util;
|
||||
|
||||
public class GuiConnect extends GuiList<GuiConnect.ServerInfo> implements ButtonCallback {
|
||||
public class ServerInfo implements Comparable<ServerInfo>, ListEntry {
|
||||
private String name;
|
||||
private String address;
|
||||
private int port;
|
||||
private String user;
|
||||
private String password;
|
||||
private String access;
|
||||
private long lastConnected;
|
||||
|
||||
public ServerInfo(String name, String address, int port, String user, String password, String access, long lastConnected) {
|
||||
this.name = name;
|
||||
this.address = address;
|
||||
this.port = port;
|
||||
this.user = user;
|
||||
this.password = password;
|
||||
this.access = access;
|
||||
this.lastConnected = lastConnected;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return this.address;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return this.port;
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return this.user;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return this.password;
|
||||
}
|
||||
|
||||
public String getAccess() {
|
||||
return this.access;
|
||||
}
|
||||
|
||||
public long getLastConnected() {
|
||||
return this.lastConnected;
|
||||
}
|
||||
|
||||
public void setData(String name, String address, int port, String user, String password, String access) {
|
||||
this.name = name;
|
||||
this.address = address;
|
||||
this.port = port;
|
||||
this.user = user;
|
||||
this.password = password;
|
||||
this.access = access;
|
||||
}
|
||||
|
||||
public void setLastConnected() {
|
||||
this.lastConnected = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public int compareTo(ServerInfo comp) {
|
||||
return this.lastConnected < comp.lastConnected ? 1 : (this.lastConnected > comp.lastConnected ? -1 : this.name.compareTo(comp.name));
|
||||
}
|
||||
|
||||
public void select(boolean isDoubleClick, int mouseX, int mouseY) {
|
||||
GuiConnect.this.selectButton.enabled = true;
|
||||
GuiConnect.this.deleteButton.enabled = true;
|
||||
GuiConnect.this.editButton.enabled = true;
|
||||
GuiConnect.this.copyButton.enabled = true;
|
||||
|
||||
if(isDoubleClick) {
|
||||
GuiConnect.this.use(GuiConnect.this.selectButton, PressType.PRIMARY);
|
||||
}
|
||||
}
|
||||
|
||||
public void draw(int x, int y, int mouseXIn, int mouseYIn, boolean hover) {
|
||||
Drawing.drawText(this.name + TextColor.GRAY + " - " + TextColor.RESET + this.user, x + 2, y, 0xffffffff);
|
||||
Drawing.drawText(this.address + TextColor.GRAY + " Port " + TextColor.RESET + this.port, x + 2, y + 18, 0xff808080);
|
||||
Drawing.drawText("Zuletzt verbunden: " + (this.lastConnected == -1L ? "nie" : DATE_FORMAT.format(new Date(this.lastConnected))), x + 2, y + 18 + 16, 0xff808080);
|
||||
}
|
||||
}
|
||||
|
||||
public static final GuiConnect INSTANCE = new GuiConnect();
|
||||
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
|
||||
private static final File SERVERS_FILE = new File("servers.cfg");
|
||||
|
||||
private ActButton deleteButton;
|
||||
private ActButton selectButton;
|
||||
private ActButton copyButton;
|
||||
private ActButton editButton;
|
||||
private ActButton createButton;
|
||||
|
||||
private GuiConnect() {
|
||||
}
|
||||
|
||||
public void init(int width, int height) {
|
||||
super.init(width, height);
|
||||
this.setDimensions(width, height, 32, height - 32);
|
||||
this.elements.clear();
|
||||
if(SERVERS_FILE.exists()) {
|
||||
try {
|
||||
String[] lines = FileUtils.read(SERVERS_FILE).split("\n");
|
||||
String name = "";
|
||||
String address = "";
|
||||
int port = -1;
|
||||
String user = "";
|
||||
String password = "";
|
||||
String access = "";
|
||||
long time = -1L;
|
||||
for(int z = 0; z <= lines.length; z++) {
|
||||
String line = z == lines.length ? null : lines[z];
|
||||
if(line == null || (line.startsWith("[") && line.endsWith("]"))) {
|
||||
if(!name.isEmpty() && !address.isEmpty() && !user.isEmpty() && user.length() < IPlayer.MAX_USER_LENGTH && IPlayer.isValidUser(user) && password.length() < IPlayer.MAX_PASS_LENGTH && access.length() < IPlayer.MAX_PASS_LENGTH && address.length() < 128 && name.length() < 128 && port >= 0 && port < 65536)
|
||||
this.elements.add(new ServerInfo(name, address, port, user, password, access, time));
|
||||
if(line != null) {
|
||||
address = "";
|
||||
port = -1;
|
||||
user = "";
|
||||
password = "";
|
||||
access = "";
|
||||
time = -1L;
|
||||
name = line.substring(1, line.length() - 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Tuple<String, String> value = Util.getKeyValue(line);
|
||||
if(value.first.equals("address"))
|
||||
address = value.second;
|
||||
else if(value.first.equals("port"))
|
||||
try {
|
||||
port = Integer.parseInt(value.second);
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
}
|
||||
else if(value.first.equals("user"))
|
||||
user = value.second;
|
||||
else if(value.first.equals("password"))
|
||||
password = value.second;
|
||||
else if(value.first.equals("access"))
|
||||
access = value.second;
|
||||
else if(value.first.equals("connected"))
|
||||
try {
|
||||
time = Long.parseLong(value.second);
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.sort(this.elements);
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error("Konnte Serverliste nicht laden", e);
|
||||
this.elements.clear();
|
||||
}
|
||||
}
|
||||
|
||||
this.add(this.selectButton = new ActButton(width / 2 - 383, height - 28, 150, 24, this, "Verbinden"));
|
||||
this.add(this.createButton = new ActButton(width - 204, 4, 200, 24, this, "Server hinzufügen ..."));
|
||||
this.add(this.deleteButton = new ActButton(width / 2 - 75, height - 28, 150, 24, this, "Löschen"));
|
||||
this.add(this.editButton = new ActButton(width / 2 + 79, height - 28, 150, 24, this, "Bearbeiten"));
|
||||
this.add(this.copyButton = new ActButton(width / 2 - 229, height - 28, 150, 24, this, "Kopieren"));
|
||||
this.add(new NavButton(width / 2 + 233, height - 28, 150, 24, GuiMenu.INSTANCE, "Abbrechen"));
|
||||
|
||||
this.selectButton.enabled = false;
|
||||
this.deleteButton.enabled = false;
|
||||
this.editButton.enabled = false;
|
||||
this.copyButton.enabled = false;
|
||||
}
|
||||
|
||||
public void onGuiClosed() {
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void applyServer(ServerInfo server) {
|
||||
if(this.selectedElement < 0)
|
||||
this.elements.add(server);
|
||||
this.save();
|
||||
this.gm.displayGuiScreen(this);
|
||||
}
|
||||
|
||||
private void save() {
|
||||
try {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(ServerInfo server : this.elements) {
|
||||
if(sb.length() > 0)
|
||||
sb.append("\n");
|
||||
sb.append("[" + server.getName() + "]\n");
|
||||
sb.append("address " + server.getAddress() + "\n");
|
||||
sb.append("port " + server.getPort() + "\n");
|
||||
sb.append("user " + server.getUser() + "\n");
|
||||
sb.append("password " + server.getPassword() + "\n");
|
||||
sb.append("access " + server.getAccess() + "\n");
|
||||
sb.append("connected " + server.getLastConnected());
|
||||
}
|
||||
FileUtils.write(SERVERS_FILE, sb.toString());
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.IO.error("Konnte Serverliste nicht speichern", e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return "Server auswählen";
|
||||
}
|
||||
|
||||
public int getListWidth() {
|
||||
return 660;
|
||||
}
|
||||
|
||||
public int getSlotHeight() {
|
||||
return 56;
|
||||
}
|
||||
|
||||
public void use(ActButton button, PressType mode) {
|
||||
if(button == this.deleteButton) {
|
||||
if(this.selectedElement >= 0) {
|
||||
this.elements.remove(this.selectedElement);
|
||||
this.gm.displayGuiScreen(this);
|
||||
}
|
||||
}
|
||||
else if(button == this.selectButton) {
|
||||
ServerInfo server = this.getSelected();
|
||||
if(server != null) {
|
||||
server.setLastConnected();
|
||||
this.gm.connect(server.address, server.port, server.user, server.password, server.access);
|
||||
}
|
||||
}
|
||||
else if(button == this.createButton) {
|
||||
this.setSelected(-1);
|
||||
this.gm.displayGuiScreen(new GuiServer(new ServerInfo("", "", Config.PORT, "", "", "", -1L)));
|
||||
}
|
||||
else if(button == this.editButton) {
|
||||
ServerInfo server = this.getSelected();
|
||||
if(server != null)
|
||||
this.gm.displayGuiScreen(new GuiServer(server));
|
||||
}
|
||||
else if(button == this.copyButton) {
|
||||
ServerInfo server = this.getSelected();
|
||||
if(server != null) {
|
||||
this.setSelected(-1);
|
||||
this.gm.displayGuiScreen(new GuiServer(new ServerInfo(server.name, server.address, server.port, server.user, server.password, server.access, -1L)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,12 +5,12 @@ import java.util.List;
|
|||
import client.Client;
|
||||
import client.gui.element.ActButton;
|
||||
import client.gui.element.ButtonCallback;
|
||||
import client.gui.element.Element;
|
||||
import client.gui.element.Fill;
|
||||
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;
|
||||
|
@ -48,20 +48,20 @@ public class GuiConsole extends Gui implements FieldCallback {
|
|||
|
||||
public void init(int width, int height) {
|
||||
if(this.full) {
|
||||
this.addSelector("con_autoclose", 0, 0, 160, 0);
|
||||
this.addSelector("con_timestamps", 160, 0, 160, 0);
|
||||
this.addSelector("con_loglevel", 320, 0, 160, 0);
|
||||
this.add(new ActButton(480, 0, 160, 0, new ButtonCallback() {
|
||||
this.addSelector("con_autoclose", 0, 0, 160, 24);
|
||||
this.addSelector("con_timestamps", 160, 0, 160, 24);
|
||||
this.addSelector("con_loglevel", 320, 0, 160, 24);
|
||||
this.add(new ActButton(480, 0, 160, 24, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
GuiConsole.this.reset();
|
||||
GuiConsole.this.setLog(GuiConsole.this.gm.getBuffer());
|
||||
}
|
||||
}, "Löschen"));
|
||||
}
|
||||
this.logBox = this.add(new TransparentArea(0, this.full ? Element.BASE_HEIGHT : 0, width, height - Element.BASE_HEIGHT * (this.full ? 2 : 1), this.gm.getBuffer(), this.gm.world != null && !this.gm.charEditor));
|
||||
this.logBox = this.add(new TransparentArea(0, this.full ? 24 : 0, width, height - (this.full ? 48 : 24), this.gm.getBuffer(), this.gm.world != null && !this.gm.charEditor));
|
||||
if(this.full)
|
||||
this.add(new Fill(640, 0, width - 640, 0));
|
||||
this.inputField = this.add(new Field(0, height - Element.BASE_HEIGHT, width, 0, IPlayer.MAX_CMD_LENGTH, this, ""));
|
||||
this.add(new Fill(640, 0, width - 640, 24));
|
||||
this.inputField = this.add(new Field(0, height - 24, width, 24, IPlayer.MAX_CMD_LENGTH, this, ""));
|
||||
this.inputField.setSelected();
|
||||
this.sentHistoryCursor = this.sentMessages.size();
|
||||
}
|
||||
|
@ -218,7 +218,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() : this.gm.playerList.keySet());
|
||||
(this.gm.player == null ? Lists.newArrayList() : ((ClientPlayer)this.gm.player.client).getPlayerNames());
|
||||
if(argv.length == 1 && pre.startsWith("#"))
|
||||
s = s.substring(1);
|
||||
for(String s1 : res) {
|
|
@ -1,35 +1,32 @@
|
|||
package client.gui;
|
||||
|
||||
import client.Client;
|
||||
import client.gui.element.MultiLabel;
|
||||
import client.gui.element.NavButton;
|
||||
import common.Version;
|
||||
import client.gui.element.TransparentArea;
|
||||
import common.color.TextColor;
|
||||
import common.init.Config;
|
||||
import common.log.Log;
|
||||
import common.util.Util;
|
||||
|
||||
public class GuiInfo extends Gui {
|
||||
private static final String VER =
|
||||
TextColor.GREEN + "" + Util.repeatString(TextColor.BUG, Version.RELEASE.getId()) + TextColor.DVIOLET + "|-| " + TextColor.VIOLET + Client.VERSION + TextColor.DVIOLET + " |-|" +
|
||||
TextColor.GREEN + Util.repeatString(TextColor.BUG, Version.RELEASE.getId());
|
||||
TextColor.GREEN + "" + TextColor.BUG + "" + TextColor.BUG + "" + TextColor.BUG + " " + TextColor.VIOLET + "" + Config.CLIENT_VERSION + "" +
|
||||
TextColor.GREEN + " " + TextColor.BUG + "" + TextColor.BUG + "" + TextColor.BUG;
|
||||
|
||||
private static final String INFO = "Ein Spiel zur Simulation, zum Testen, für Rollenspiele, Mehrspieler und vieles mehr." + "\n" +
|
||||
"Optimiert für Geschwindigkeit, Stabilität und" + TextColor.UNKNOWN + "" + TextColor.UNKNOWN + " [Speicherzugriffsfehler]";
|
||||
private static final String HACKED = "Ein weiterer Release von WAAAAAAAAAAAAGHDRIVE!!!1!!!ONEoneOnetyone!1!!!" + "\n" +
|
||||
private static final String HACKED = "Ein weiterer Release von WAAAAAAAAAAAAAAAAAAAAAAAAAAAAGHDRIVE!!!1!!!ONEoneOnetyone!1!!!" + "\n" +
|
||||
"Update 0.2 - Läuft jetzt auch mit nur 512KB Fast-RAM!";
|
||||
|
||||
private static final String[] LIBRARIES = {
|
||||
"LWJGL 3.3.6",
|
||||
"LWJGL-GLFW 3.3.6",
|
||||
"LWJGL-OpenGL 3.3.6"
|
||||
"LWJGL 3.3.6+1 (GLFW + OpenGL)",
|
||||
"Netty 4.1.119-Final"
|
||||
};
|
||||
private static final String[] CODE = {
|
||||
"Albert Pham - WorldEdit (Snippets)",
|
||||
"Joonas Vali - NameGenerator",
|
||||
"LWJGL 2.9.4-nightly-20150209 - Project, Vector*, Matrix*",
|
||||
"Guava 17.0 - collect, future, Predicates",
|
||||
"Netty 4.0.23-Final - net.*",
|
||||
"JOrbis 20101023 (JCraft) - jogg, jorbis, CodecJOrbis"
|
||||
"JOrbis 20101023 (JCraft) - jogg, jorbis, CodecJOrbis",
|
||||
"MC 1.8.9"
|
||||
};
|
||||
|
||||
public static final GuiInfo INSTANCE = new GuiInfo("Über dieses Programm", getFormat(false));
|
||||
|
@ -39,12 +36,12 @@ public class GuiInfo extends Gui {
|
|||
private final String info;
|
||||
|
||||
private static String getFormat(boolean hax) {
|
||||
return getInfo(hax) + "\n\n" + getCredits(hax) + "\n\n" + getLibraries(hax) + "\n\n" + getCode(hax) + "\n\n" + getColors();
|
||||
return getInfo(hax) + "\n\n" + getCredits(hax) + "\n\n" + getLibraries(hax) + "\n\n" + getCode(hax) + "\n\n" + getOldCredits(hax) + "\n\n" + getColors();
|
||||
}
|
||||
|
||||
private static String getHeader(boolean hax, String normal, String hacked) {
|
||||
return (hax ? TextColor.RED : TextColor.YELLOW) + (hax ? hacked : normal) + "\n" +
|
||||
(hax ? TextColor.CYAN : TextColor.WHITE) + "==========================+==========================";
|
||||
(hax ? TextColor.CYAN : TextColor.WHITE) + "==========================================+==========================================";
|
||||
}
|
||||
|
||||
private static void addLines(StringBuilder sb, boolean hax, String alternate, String category, String... authors) {
|
||||
|
@ -64,7 +61,7 @@ public class GuiInfo extends Gui {
|
|||
private static String getLibraries(boolean hax) {
|
||||
StringBuilder sb = new StringBuilder(getHeader(hax, "Verwendete Programmbibliotheken", "U$3d 3xpl0its"));
|
||||
for(String lib : LIBRARIES) {
|
||||
sb.append("\n" + TextColor.NEON + lib);
|
||||
sb.append("\n" + TextColor.LGRAY + "-> " + TextColor.NEON + lib);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -72,7 +69,7 @@ public class GuiInfo extends Gui {
|
|||
private static String getCode(boolean hax) {
|
||||
StringBuilder sb = new StringBuilder(getHeader(hax, "Zusätzlicher Quellcode", "M0ar 3xpl01ts"));
|
||||
for(String lib : CODE) {
|
||||
sb.append("\n" + TextColor.NEON + lib);
|
||||
sb.append("\n" + TextColor.LGRAY + "-> " + TextColor.NEON + lib);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -81,16 +78,37 @@ public class GuiInfo extends Gui {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
int num = 0;
|
||||
for(TextColor color : TextColor.values()) {
|
||||
if(num == 14)
|
||||
sb.append('\n');
|
||||
if(num > 0)
|
||||
sb.append(' ');
|
||||
if((color.code >= Log.CHR_COLORS1 && color.code <= Log.CHR_COLORE1) || (color.code >= Log.CHR_COLORS2 && color.code <= Log.CHR_COLORE2)) {
|
||||
sb.append(color + "#" + (char)(num < 10 ? ('0' + num) : ('A' + (num - 10))) + ' ');
|
||||
sb.append(color + "#" + (char)(num < 10 ? ('0' + num) : ('A' + (num - 10))));
|
||||
num++;
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static String getOldCredits(boolean hax) {
|
||||
StringBuilder sb = new StringBuilder(getHeader(hax, "Ursprüngliche Mitwirkende", "Das Team -- Nicht TCQ"));
|
||||
|
||||
addLines(sb, hax, "Absolut größter Lamer des Universums", "Spielidee und ursprüngliche Umsetzung",
|
||||
"Markus Persson");
|
||||
addLines(sb, hax, "Crack und weitere Programmierung", "Spiel-Design, Programmierung und Grafiken",
|
||||
"Jens Bergensten", "Nathan Adams", "Ryan Holtz", "Michael Stoyke");
|
||||
addLines(sb, hax, "Entschlüsselung von Ressourcen", "Programmierung",
|
||||
"Erik Broes", "Paul Spooner", "Ryan Hitchman", "Elliot Segal");
|
||||
addLines(sb, hax, "Cracktro, Grafiken und Intromusik", "Töne und Geräusche",
|
||||
"Daniel Rosenfeld", "freesound.org");
|
||||
addLines(sb, hax, "Packing und Verbreitung", "Management, Administration und Spaß",
|
||||
"Carl Manneh", "Daniel Kaplan", "Lydia Winters");
|
||||
addLines(sb, hax, "Server und Hosting", "Zahlen und Statistiken",
|
||||
"Patrick Geuder");
|
||||
addLines(sb, hax, "Weiterer Dank und Grüße", "Entwickler von Mo' Creatures (Pferde usw.)",
|
||||
"John Olarte", "Kent Christian Jensen", "Dan Roque");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static String getCredits(boolean hax) {
|
||||
StringBuilder sb = new StringBuilder(getHeader(hax, "Mitwirkende dieses Programms", "Das Team -- TCQ"));
|
||||
|
||||
|
@ -107,8 +125,8 @@ public class GuiInfo extends Gui {
|
|||
}
|
||||
|
||||
public void init(int width, int height) {
|
||||
this.add(new MultiLabel(10, 10, width - 20, height - 44, this.info, false));
|
||||
this.add(new NavButton((width - 280) / 2, height - 20, 280, 0, GuiMenu.INSTANCE, "Zurück"));
|
||||
this.add(new TransparentArea(10, 10, width - 20, height - 44, this.info, this.gm.world != null && !this.gm.charEditor));
|
||||
this.add(new NavButton(0, height - 24, width, 24, GuiMenu.INSTANCE, "Zurück"));
|
||||
}
|
||||
|
||||
public String getTitle() {
|
|
@ -46,11 +46,11 @@ public class GuiLoading extends Gui {
|
|||
}
|
||||
|
||||
public void init(int width, int height) {
|
||||
this.taskLabel = this.add(new Label(0, 40, 500, 0, ""));
|
||||
this.progressBar1 = this.add(new Bar(0, 80, 500, 0));
|
||||
this.progressBar2 = this.add(new Bar(0, 120, 500, 0));
|
||||
this.taskLabel = this.add(new Label(0, 40, 500, 20, ""));
|
||||
this.progressBar1 = this.add(new Bar(0, 80, 500, 24));
|
||||
this.progressBar2 = this.add(new Bar(0, 120, 500, 24));
|
||||
this.shift();
|
||||
this.headerLabel = this.add(new Label(0, 40, width, 0, this.message));
|
||||
this.headerLabel = this.add(new Label(0, 40, width, 20, this.message));
|
||||
this.progressBar1.visible = false;
|
||||
this.progressBar2.visible = false;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package client.gui;
|
||||
|
||||
import client.Client;
|
||||
import client.Timing;
|
||||
import client.gui.character.GuiChar;
|
||||
import client.gui.character.GuiCharacters;
|
||||
import client.gui.element.ActButton;
|
||||
|
@ -12,6 +12,7 @@ import client.gui.options.GuiOptions;
|
|||
import client.renderer.Drawing;
|
||||
import client.window.Keysym;
|
||||
import common.color.TextColor;
|
||||
import common.init.Config;
|
||||
import common.rng.Random;
|
||||
import common.util.ExtMath;
|
||||
|
||||
|
@ -25,7 +26,7 @@ public class GuiMenu extends Gui {
|
|||
if(this.gm.world != null)
|
||||
super.drawMainBackground();
|
||||
else
|
||||
this.gm.renderGlobal.renderStarField(this.gm.fb_x, this.gm.fb_y, 0x000000, 0xffffff, (float)this.ticks + this.gm.getTickFraction(), this.rand);
|
||||
this.gm.renderGlobal.renderStarField(this.gm.fb_x, this.gm.fb_y, 0x000000, 0xffffff, (float)this.ticks + (float)Timing.tick_fraction, this.rand);
|
||||
}
|
||||
|
||||
private final Random rand = new Random();
|
||||
|
@ -51,12 +52,8 @@ public class GuiMenu extends Gui {
|
|||
this.ticks = 0;
|
||||
this.hacked = 0;
|
||||
this.resetAnimation();
|
||||
this.add(new ActButton(0, 0, 180, 0, new ButtonCallback() {
|
||||
this.add(new ActButton(0, -28, 400, 24, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
if(action == PressType.SECONDARY) {
|
||||
GuiMenu.this.gm.joinDebugWorld();
|
||||
return;
|
||||
}
|
||||
if(GuiMenu.this.hacked == 9) {
|
||||
GuiMenu.this.hacked++;
|
||||
GuiMenu.this.splashLabel.setText(TextColor.VIOLET + "Hax!");
|
||||
|
@ -66,20 +63,20 @@ public class GuiMenu extends Gui {
|
|||
}
|
||||
}
|
||||
}, "Server beitreten"));
|
||||
this.add(new ActButton(0, 20, 180, 0, new ButtonCallback() {
|
||||
this.add(new NavButton(0, 0, 400, 24, GuiServer.INSTANCE, "Schnellverbindung"));
|
||||
this.add(new ActButton(0, 28, 400, 24, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
if(GuiMenu.this.hacked == 8)
|
||||
GuiMenu.this.hacked++;
|
||||
else
|
||||
GuiMenu.this.gm.displayGuiScreen(GuiServer.INSTANCE);
|
||||
GuiMenu.this.gm.displayGuiScreen(GuiOptions.getPage());
|
||||
}
|
||||
}, "Schnellverbindung"));
|
||||
this.add(new NavButton(0, 40, 180, 0, GuiOptions.getPage(), "Einstellungen"));
|
||||
this.infoButton = this.add(new ActButton(0, 60, 180, 0, new ButtonCallback() {
|
||||
}, "Einstellungen"));
|
||||
this.infoButton = this.add(new ActButton(0, 56, 400, 24, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
GuiMenu.this.gm.displayGuiScreen(GuiMenu.this.hacked == 10 ? GuiInfo.HAX : GuiInfo.INSTANCE);
|
||||
}
|
||||
}, "Info / Mitwirkende") {
|
||||
}, "Info / Über / Mitwirkende") {
|
||||
public void drawHover() {
|
||||
if(GuiMenu.this.hacked == 10) {
|
||||
Drawing.drawRect(this.pos_x, this.pos_y, this.size_x, this.size_y, 0x287f00ff);
|
||||
|
@ -87,9 +84,9 @@ public class GuiMenu extends Gui {
|
|||
int width = Drawing.getWidth("Hax!");
|
||||
for(int z = 0; z < 64; z++) {
|
||||
Drawing.drawText("Hax!", GuiMenu.this.rand.zrange(Math.max(1, this.gm.fb_x - width)) +
|
||||
(int)(ExtMath.sin(((float)(GuiMenu.this.ticks + GuiMenu.this.rand.zrange(256)) + this.gm.getTickFraction()) / 100.0f * (float)Math.PI * 2.0f) * 16.0f),
|
||||
(int)(ExtMath.sin(((float)(GuiMenu.this.ticks + GuiMenu.this.rand.zrange(256)) + (float)Timing.tick_fraction) / 100.0f * (float)Math.PI * 2.0f) * 16.0f),
|
||||
GuiMenu.this.rand.zrange(Math.max(1, this.gm.fb_y - Font.YGLYPH)) +
|
||||
(int)(ExtMath.sin(((float)(GuiMenu.this.ticks + GuiMenu.this.rand.zrange(256)) + this.gm.getTickFraction()) / 100.0f * (float)Math.PI * 2.0f) * 16.0f),
|
||||
(int)(ExtMath.sin(((float)(GuiMenu.this.ticks + GuiMenu.this.rand.zrange(256)) + (float)Timing.tick_fraction) / 100.0f * (float)Math.PI * 2.0f) * 16.0f),
|
||||
0xff0000ff | (GuiMenu.this.rand.zrange(256) << 16));
|
||||
}
|
||||
}
|
||||
|
@ -98,27 +95,27 @@ public class GuiMenu extends Gui {
|
|||
}
|
||||
}
|
||||
});
|
||||
this.add(new ActButton(0, 90, 180, 0, new ButtonCallback() {
|
||||
this.add(new ActButton(0, 102, 400, 24, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
GuiMenu.this.gm.interrupted = true;
|
||||
}
|
||||
}, "Client schließen"));
|
||||
this.shift();
|
||||
this.add(new Label(4, 4, 200, 0, TextColor.VIOLET + Client.VERSION, true));
|
||||
this.splashLabel = this.add(new Label(0, 100, width, 0, ""));
|
||||
this.add(new Label(4, /* this.gm.fb_y - 2 */ 0, 200, 20, TextColor.VIOLET + Config.CLIENT_VERSION, true));
|
||||
this.splashLabel = this.add(new Label(0, 160, width, 24, ""));
|
||||
this.pickSplash();
|
||||
}
|
||||
else {
|
||||
this.add(new NavButton(0, 0, 180, 0, this.gm.charEditor ? GuiChar.INSTANCE : null, this.gm.charEditor ? "Zurück zum Editor" : "Zurück zum Spiel"));
|
||||
this.add(new NavButton(0, 20, 180, 0, GuiOptions.getPage(), "Einstellungen"));
|
||||
this.add(new NavButton(0, 0, 400, 24, this.gm.charEditor ? GuiChar.INSTANCE : null, this.gm.charEditor ? "Zurück zum Charakter-Editor" : "Zurück zum Spiel"));
|
||||
this.add(new NavButton(0, 28, this.gm.charEditor ? 400 : 198, 24, GuiOptions.getPage(), "Einstellungen"));
|
||||
if(!this.gm.charEditor)
|
||||
this.add(new NavButton(0, 40, 180, 0, GuiCharacters.INSTANCE, "Charakter"));
|
||||
this.add(new ActButton(0, this.gm.charEditor ? 50 : 70, 180, 0, new ButtonCallback() {
|
||||
this.add(new NavButton(202, 28, 198, 24, GuiCharacters.INSTANCE, "Charakter"));
|
||||
this.add(new ActButton(0, 102, 400, 24, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
GuiMenu.this.gm.unload(true);
|
||||
// GuiMenu.this.gm.displayGuiScreen(INSTANCE);
|
||||
}
|
||||
}, "Server verlassen"));
|
||||
}, "Server verlassen und Verbindung trennen"));
|
||||
this.shift();
|
||||
}
|
||||
}
|
||||
|
@ -292,7 +289,7 @@ public class GuiMenu extends Gui {
|
|||
public void drawOverlays() {
|
||||
super.drawOverlays();
|
||||
if(this.gm.world == null) {
|
||||
int y = 99;
|
||||
int y = 164;
|
||||
int h = 16;
|
||||
int n = Drawing.getWidth(this.splashLabel.getText());
|
||||
Drawing.drawRect(0, y, this.gm.fb_x / 2 - n / 2 - 10, h, 0x7f7f00ff);
|
149
client/src/client/gui/GuiServer.java
Normal file
149
client/src/client/gui/GuiServer.java
Normal file
|
@ -0,0 +1,149 @@
|
|||
package client.gui;
|
||||
|
||||
import client.gui.GuiConnect.ServerInfo;
|
||||
import client.gui.element.ActButton;
|
||||
import client.gui.element.ButtonCallback;
|
||||
import client.gui.element.Label;
|
||||
import client.gui.element.NavButton;
|
||||
import client.gui.element.PressType;
|
||||
import client.gui.element.FieldAction;
|
||||
import client.gui.element.Field;
|
||||
import client.gui.element.FieldCallback;
|
||||
import client.vars.CVarCategory;
|
||||
import client.vars.Variable;
|
||||
import common.color.TextColor;
|
||||
import common.init.Config;
|
||||
import common.network.IPlayer;
|
||||
|
||||
public class GuiServer extends Gui implements FieldCallback {
|
||||
public static final GuiServer INSTANCE = new GuiServer(null);
|
||||
|
||||
private final ServerInfo server;
|
||||
|
||||
private Field nameBox;
|
||||
private Field addrBox;
|
||||
private Field portBox;
|
||||
private Field userBox;
|
||||
private Field passBox;
|
||||
private Field accBox;
|
||||
private Label nameLabel;
|
||||
private Label addrLabel;
|
||||
private Label portLabel;
|
||||
private Label userLabel;
|
||||
private Label passLabel;
|
||||
private Label accLabel;
|
||||
|
||||
public GuiServer(ServerInfo server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
@Variable(name = "srv_last_address", category = CVarCategory.SYSTEM, min = 1, max = 128, display = "Letzte Server-Adresse")
|
||||
private String lastAddr = "";
|
||||
@Variable(name = "srv_last_port", category = CVarCategory.SYSTEM, min = 0, max = 65535, display = "Letzter Server-Port")
|
||||
private int lastPort = Config.PORT;
|
||||
@Variable(name = "srv_last_user", category = CVarCategory.SYSTEM, max = IPlayer.MAX_USER_LENGTH, display = "Letzter Server-Nutzer", validator = IPlayer.UserValidator.class)
|
||||
private String lastUser = "";
|
||||
@Variable(name = "srv_last_password", category = CVarCategory.SYSTEM, max = IPlayer.MAX_PASS_LENGTH, display = "Letztes Server-Passwort")
|
||||
private String lastPass = "";
|
||||
@Variable(name = "srv_last_access", category = CVarCategory.SYSTEM, max = IPlayer.MAX_PASS_LENGTH, display = "Letzter Server-Zugang")
|
||||
private String lastAcc = "";
|
||||
|
||||
public void init(int width, int height) {
|
||||
if(this.server != null)
|
||||
this.nameBox = this.add(new Field(0, -50, 400, 24, 128, this, this.server.getName()));
|
||||
this.addrBox = this.add(new Field(0, 20, 400, 24, 128, this, this.server == null ? this.lastAddr : this.server.getAddress()));
|
||||
this.portBox = this.add(new Field(404, 20, 76, 24, 5, this, "" + (this.server == null ? this.lastPort : this.server.getPort())));
|
||||
this.userBox = this.add(new Field(0, 70, 220, 24, IPlayer.MAX_USER_LENGTH, this, IPlayer.VALID_USER, this.server == null ? this.lastUser : this.server.getUser()));
|
||||
this.passBox = this.add(new Field(0, 120, 480, 24, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastPass : this.server.getPassword()));
|
||||
this.accBox = this.add(new Field(0, 170, 480, 24, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastAcc : this.server.getAccess()));
|
||||
this.add(new ActButton(0, 220, 480, 24, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
GuiServer.this.connect();
|
||||
}
|
||||
}, this.server == null ? "Verbinden" : (this.server.getName().isEmpty() ? "Hinzufügen" : "Übernehmen")));
|
||||
this.add(new NavButton(0, 250, 480, 24, this.server != null ? GuiConnect.INSTANCE : GuiMenu.INSTANCE, "Zurück"));
|
||||
if(this.server != null)
|
||||
this.nameLabel = this.add(new Label(0, -70, 410, 20, "Name", true));
|
||||
this.addrLabel = this.add(new Label(0, 0, 410, 20, "Adresse", true));
|
||||
this.portLabel = this.add(new Label(414, 0, 66, 20, "Port", true));
|
||||
this.userLabel = this.add(new Label(0, 50, 220, 20, "Nutzer", true));
|
||||
this.passLabel = this.add(new Label(0, 100, 480, 20, "Passwort", true));
|
||||
this.accLabel = this.add(new Label(0, 150, 480, 20, "Zugang", true));
|
||||
this.shift();
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return this.server == null ? "Mit Server verbinden" : (this.server.getName().isEmpty() ? "Server hinzufügen" : "Server bearbeiten");
|
||||
}
|
||||
|
||||
private void connect() {
|
||||
if(this.gm.world != null)
|
||||
return;
|
||||
String name = null;
|
||||
if(this.server != null) {
|
||||
name = this.nameBox.getText();
|
||||
if(name.isEmpty()) {
|
||||
this.nameLabel.setText(TextColor.RED + "Name");
|
||||
return;
|
||||
}
|
||||
}
|
||||
String addr = this.addrBox.getText();
|
||||
if(addr.isEmpty()) {
|
||||
this.addrLabel.setText(TextColor.RED + "Adresse");
|
||||
return;
|
||||
}
|
||||
int port = -1;
|
||||
if(this.portBox.getText().isEmpty()) {
|
||||
this.portLabel.setText(TextColor.RED + "Port");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
try {
|
||||
port = Integer.parseInt(this.portBox.getText());
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
}
|
||||
if(port < 0 || port > 65535) {
|
||||
this.portLabel.setText(TextColor.RED + "Port");
|
||||
return;
|
||||
}
|
||||
}
|
||||
String user = this.userBox.getText();
|
||||
if(user.isEmpty()) {
|
||||
this.userLabel.setText(TextColor.RED + "Nutzer");
|
||||
return;
|
||||
}
|
||||
String pass = this.passBox.getText();
|
||||
String acc = this.accBox.getText();
|
||||
if(this.server == null) {
|
||||
this.lastAddr = addr;
|
||||
this.lastPort = port;
|
||||
this.lastUser = user;
|
||||
this.lastPass = pass;
|
||||
this.lastAcc = acc;
|
||||
this.gm.setDirty();
|
||||
this.gm.connect(addr, port, user, pass, acc);
|
||||
}
|
||||
else {
|
||||
this.server.setData(name, addr, port, user, pass, acc);
|
||||
GuiConnect.INSTANCE.applyServer(this.server);
|
||||
}
|
||||
}
|
||||
|
||||
public void use(Field elem, FieldAction value) {
|
||||
if(value == FieldAction.SEND) {
|
||||
elem.setDeselected();
|
||||
this.connect();
|
||||
}
|
||||
else if(value == FieldAction.FOCUS) {
|
||||
if(elem == this.addrBox)
|
||||
this.addrLabel.setText("Adresse");
|
||||
else if(elem == this.portBox)
|
||||
this.portLabel.setText("Port");
|
||||
else if(elem == this.userBox)
|
||||
this.userLabel.setText("Nutzer");
|
||||
else if(this.server != null && elem == this.nameBox)
|
||||
this.nameLabel.setText("Name");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,34 +2,35 @@ package client.gui;
|
|||
|
||||
public abstract class Splashes {
|
||||
public static final String[] SPLASHES = {
|
||||
"Aus der Toiletten-Werbung!",
|
||||
"Aus der TV-Werbung!",
|
||||
"Toll!",
|
||||
"0% pur!",
|
||||
"Kann Nüsse enthalten!",
|
||||
"Kann *.,-#+~ enthalten!",
|
||||
"Besser als Crysis!",
|
||||
"Mehr Polygone!",
|
||||
"Sexy!",
|
||||
"Limitierte Edition!",
|
||||
"Blinkende Buchstaben!",
|
||||
"Erstellt von Satan!",
|
||||
"Er ist hier!",
|
||||
"Das Schlimmste seiner Klasse!",
|
||||
"Es ist vollendet (nicht)!",
|
||||
"Erstellt von Notch!",
|
||||
"Es ist hier!",
|
||||
"Das Beste seiner Klasse!",
|
||||
"Es ist vollendet!",
|
||||
"Mehr oder weniger frei von Drachen!",
|
||||
"Aufregung!",
|
||||
"Weniger als -5 verkauft!",
|
||||
"Einzigartig!",
|
||||
"Einen Haufen Scheiße auf YouTube!",
|
||||
"Dev!",
|
||||
"Alpha!",
|
||||
"Beta!",
|
||||
"Indev!",
|
||||
"Spinnen überall!",
|
||||
"Schau es dir an!",
|
||||
"Heilige Kuh, mann!",
|
||||
"Es ist ein Spiel!",
|
||||
"Hergestellt im Schattenland!",
|
||||
"Hergestellt in Schweden!",
|
||||
"Benutzt LWJGL!",
|
||||
"Retikulierende Splinen!",
|
||||
"Meine Kraft!",
|
||||
"Hurraaa!",
|
||||
"Einzelspieler!",
|
||||
"Tastatur ist kompatibel!",
|
||||
"Undokumentiert!",
|
||||
"Barren!",
|
||||
|
@ -40,14 +41,17 @@ public abstract class Splashes {
|
|||
"Überlebe!",
|
||||
"Verlies!",
|
||||
"Exklusiv!",
|
||||
"Die Knie der Biene!",
|
||||
"Weg mit O.P.P.!",
|
||||
"Mit Quellcode (mehr oder weniger)!",
|
||||
"Mit Klasse(n)!",
|
||||
"Wow!",
|
||||
"Niemals auf Steam - und das ist auch gut so!",
|
||||
"Immer noch nicht auf Steam - und das ist auch gut so!",
|
||||
"Oh, mann!",
|
||||
"Grauenvolle Community!",
|
||||
"Pixel!",
|
||||
"Garfiiieeeeeeeld!",
|
||||
"Teetsuuuuoooo!",
|
||||
"Kaaneeeedaaaa!",
|
||||
"Jetzt ohne Schwierigkeit!",
|
||||
"Verbessert!",
|
||||
"9% frei von Bugs!",
|
||||
|
@ -55,26 +59,31 @@ public abstract class Splashes {
|
|||
"13 Kräuter und Gewürze!",
|
||||
"Fettfrei!",
|
||||
"Absolut keine Memes!",
|
||||
"Kostenlose Vampirzähne!",
|
||||
"Kostenlose Zähne!",
|
||||
"Fragen Sie Ihnen Arzt oder Apotheker!",
|
||||
"Alle Bergleute sind willkommen!",
|
||||
"Cloud-Computing!",
|
||||
"Frei von \"\"KI\"\"!",
|
||||
"Legal in Norwegen!",
|
||||
"Illegal in China!",
|
||||
"Legal in Finnland!",
|
||||
"Schwer zu beschreiben!",
|
||||
"Technisch gesehen gut!",
|
||||
"Bringe den Speck nach Hause!",
|
||||
"Indie!",
|
||||
"GOTY!",
|
||||
"Ceci n'est pas une title screen!",
|
||||
"Euklidisch!",
|
||||
"Jetzt in 4D?!",
|
||||
"Jetzt in 3D!",
|
||||
"Bietet Inspiration!",
|
||||
"Herregud!",
|
||||
"Komplexe Zellvorgänge!",
|
||||
"Ja, Sir!",
|
||||
"Ja, Miss!",
|
||||
"Von Trollen gespielt!",
|
||||
"Von Cowboys gespielt!",
|
||||
"OpenGL 1.5 oder höher!",
|
||||
"Millionen von Farben!",
|
||||
"Tausende von Farben!",
|
||||
"Probiere es!",
|
||||
"Age of Wonders ist besser!",
|
||||
"Probiere die Pilzsuppe!",
|
||||
"Sensationell!",
|
||||
"Heiße Tamale, heiße heiße Tamale!",
|
||||
"Spiele ihn runter, Klavierkatze!",
|
||||
"Garantiert!",
|
||||
"Makroskopisch!",
|
||||
|
@ -85,22 +94,27 @@ public abstract class Splashes {
|
|||
"Von Melonen geliebt!",
|
||||
"Ultimative Edition!",
|
||||
"Merkwürdig!",
|
||||
"Du hast einen nagelneuen Schlüssel bekommen!",
|
||||
"Wasserfest!",
|
||||
"Nicht brennbar!",
|
||||
"Oha, du!",
|
||||
"Alles inklusive!",
|
||||
"Sag es deinen Freunden!",
|
||||
"NP ist nicht in P!",
|
||||
"Musik von C418 (DLC)!",
|
||||
"Viel zu oft live gestreamt!",
|
||||
"Heimgesucht!",
|
||||
"Polynomial!",
|
||||
"Terrestrisch!",
|
||||
"Alles ist voller Zerstörung!",
|
||||
"Voll mit Sternen, Planeten und Monden!",
|
||||
"Wissenschaftlich!",
|
||||
"Nicht so cool wie Spock!",
|
||||
"Trage nix bei und höre weg!",
|
||||
"Grabe niemals nach unten, wenn du keine Erze brauchst!",
|
||||
"Mache nie Pause!",
|
||||
"Nicht linear!",
|
||||
"Han hat zuerst geschossen!",
|
||||
"Schön dich zu sehen!",
|
||||
"Eimer mit Lava!",
|
||||
"Reite auf dem Schwein!",
|
||||
|
@ -110,18 +124,25 @@ public abstract class Splashes {
|
|||
"Holz schlagen!",
|
||||
"Von Klippen fallen!",
|
||||
"0% Zucker!",
|
||||
"180% Alkohol!",
|
||||
"150% hyperbol!",
|
||||
"Synecdoche!",
|
||||
"Lasst uns tanzne!",
|
||||
"Geheeimes Freitags-Update!",
|
||||
"Referenz-Implementation!",
|
||||
"Frei mit zwei.. äähhh fünf Typen mit Essen!",
|
||||
"Küsse den Himmel!",
|
||||
"20 GOTO 10!",
|
||||
"Verlet-Intregration!",
|
||||
"Peter Griffin!",
|
||||
"Verteile die Erde gut!",
|
||||
"8263273626252622872652 Zeilen Quellcode (287228 am 30.7.)!",
|
||||
"Cogito ergo sum!",
|
||||
"4815162342 Zeilen Quellcode (287228 am 30.7.)!",
|
||||
"Ein Skelett fiel heraus!",
|
||||
"Das Werk von Luzifer!",
|
||||
"Das Werk von Notch!",
|
||||
"Die Summe seiner Teile!",
|
||||
"mureh srednA!",
|
||||
"BTAF war mal gut!",
|
||||
"Ich vermisse ADOM!",
|
||||
"umop-apisdn!",
|
||||
"GTX750Ti!",
|
||||
"Bringe mir Mentos und Cola!",
|
||||
"Finger-leckend!",
|
||||
|
@ -141,16 +162,25 @@ public abstract class Splashes {
|
|||
"Doppelt gepuffert!",
|
||||
"Fan-Fiction!",
|
||||
"Flaxkikare!",
|
||||
"Jason! Jason! Jason!",
|
||||
"Heißer als die Sonne!",
|
||||
"Internet-Funktionalität!",
|
||||
"Autonom!",
|
||||
"Engagiere!",
|
||||
"Fantasie!",
|
||||
"Mau! Mau! Mau!",
|
||||
"DRR! DRR! DRR!",
|
||||
"Stoß es Wurzel runter!",
|
||||
"Regionale Ressourcen!",
|
||||
"Jaa, facepunch!",
|
||||
"Jaa, somethingawful!",
|
||||
"Jaa, /v/!",
|
||||
"Jaa, tigsource!",
|
||||
"Jaa, weinkraftforum!",
|
||||
"Jaa, worldofweinkraft!",
|
||||
"Buu, reddit!",
|
||||
"Jaa, 2pp!",
|
||||
"Goggle anllyticsed:DD :DDD:D!",
|
||||
"Unterstützt jetzt äöüß!",
|
||||
"Unterstützt jetzt äöü!",
|
||||
"Gebt uns Gordon!",
|
||||
"Gib deinem Kellner Trinkgeld!",
|
||||
"Macht viel Spaß!",
|
||||
|
@ -161,12 +191,15 @@ public abstract class Splashes {
|
|||
"Allmächtig!",
|
||||
"Huch!",
|
||||
"...!",
|
||||
"Bienen, Mienen, Minen, W-!",
|
||||
"Bienen, Bienen, Bienen, Bienen!",
|
||||
"Jag känner en bot!",
|
||||
"Dieser Text ist schwer bei der Standard-Auflösung zu lesen, aber auf 1080p ist es in Ordnung!",
|
||||
"Haha, LOL!",
|
||||
"Hampsterdance!",
|
||||
"Schalter und Erze!",
|
||||
"Menger-Schwamm!",
|
||||
"idspispopd!",
|
||||
"Eple (originale Version)!",
|
||||
"So frisch, so sauber!",
|
||||
"Schnell reagierende Portale!",
|
||||
"Probiere den Warp aus!",
|
||||
|
@ -174,9 +207,10 @@ public abstract class Splashes {
|
|||
"Oh, ok, NPCs!",
|
||||
"Endlich mit Leitern!",
|
||||
"Gruselig!",
|
||||
"Spiele Minenkraft, schaue Topgear, bekomme Schwein!",
|
||||
"Darüber gewittert!",
|
||||
"Spring hoch, spring hoch, und komme runter!",
|
||||
"Strahlung ist klasse!",
|
||||
"Joel ist klasse!",
|
||||
"Ein Rätsel, in einen Mythos verwoben!",
|
||||
"Riesige Landeszüge voll mit TNT!",
|
||||
"Willkommen zu deinem Ende! Muahahahahahaha!",
|
||||
|
@ -188,21 +222,23 @@ public abstract class Splashes {
|
|||
"\"Fast nie\" ist ein interessantes Konzept!",
|
||||
"Eine Menge Wahrheitigkeit!",
|
||||
"Der TNT-Block ist ein Spion!",
|
||||
"Turing-unvollständig!",
|
||||
"Turing-vollständig!",
|
||||
"Es ist bahnbrechend!",
|
||||
"Lasst unsere Schlachten beginnen!",
|
||||
"Der Himmel ist die Grenze - oder auch nicht!",
|
||||
"Dein PC hat tolle Haare, mach das Ding mal sauber!",
|
||||
"Shen hat auch tolle Haare!",
|
||||
"Jeb hat tolle Haare!",
|
||||
"Ryan hat auch tolle Haare!",
|
||||
"Gelegentliches Spielen!",
|
||||
"Unbesiegt!",
|
||||
"Ein Bisschen wie Lemmings!",
|
||||
"Folge dem Zug, CJ!",
|
||||
"Macht von Synergie Verwendung!",
|
||||
"Diese Nachricht sollte niemals als Splash-Text erscheinen, oder etwa doch? Trololololol!",
|
||||
"Diese Nachricht wird niemals als Splash-Text erscheinen, ist das nicht komisch?",
|
||||
"DungeonQuest ist unfair!",
|
||||
"0815!",
|
||||
"666!",
|
||||
"Geh zu den fernen Ländern und weiter!",
|
||||
"Tyrion würde es lieben!",
|
||||
"Probiere auch Stellaris!",
|
||||
"Probiere auch Garry's Mod!",
|
||||
"Probiere auch GZDoom!",
|
||||
|
@ -216,43 +252,52 @@ public abstract class Splashes {
|
|||
"Brot ist Schmerz!",
|
||||
"Lese mehr Bücher!",
|
||||
"Khaaaaaaaaan!",
|
||||
"Weniger süchtig machend als [zensiert da NSFW]!",
|
||||
"Weniger süchtig machend als TV Tropes!",
|
||||
"Mehr süchtig machend als Limonade!",
|
||||
"Größer als eine Brotkiste!",
|
||||
"Millionen von Pfirsichen!",
|
||||
"Fnord!",
|
||||
"Dies ist meine echte Gestalt! Muahahahaha!",
|
||||
"Verschwende keine Zeit mit \"\"KI\"\"!",
|
||||
"Erstellt von einer Katze!",
|
||||
"Habe Dre vollkommen vergessen!",
|
||||
"Verschwende keine Zeit mit den Klonen!",
|
||||
"Kürbiskopf!",
|
||||
"Hobo humping slobo babe!",
|
||||
"Erstellt von Jeb!",
|
||||
"Hat kein Ende!",
|
||||
"Endlich vollständig!",
|
||||
"Voll mit Features!",
|
||||
"Stiefel mit dem Fell!",
|
||||
"Stop, hammertime!",
|
||||
"Test!",
|
||||
"Testificates!",
|
||||
"Nicht konventionell!",
|
||||
"Nicht kommerziell!",
|
||||
"Homeomorphisch zu einer 3-Kugel!",
|
||||
"Vermeidet nicht doppelte Verneinung!",
|
||||
"Platziere ALL die Blöcke!",
|
||||
"Macht Walzen!",
|
||||
"Erfüllt Erwartungen!",
|
||||
"Spielen am PC seit 1992!",
|
||||
"Spielen am PC seit 1873!",
|
||||
"Ghoughpteighbteau tchoghs!",
|
||||
"Deja vu!",
|
||||
"Deja vu!",
|
||||
"Hab deine Nase!",
|
||||
"Haley liebt Elan!",
|
||||
"Hat keine Angst vor der großen, schwarzen Fledermaus!",
|
||||
"Benutzt nicht das U-Wort!",
|
||||
"Nicht wirklich leicht!",
|
||||
"Bis nächsten Freitag oder so!",
|
||||
"Von den Straßen von Nibelheim!",
|
||||
"Von den Straßen von Södermalm!",
|
||||
"150 BPM für 400000 Minuten!",
|
||||
"Technologisch!",
|
||||
"Hallo Japan!",
|
||||
"Funk Soul Bruder!",
|
||||
"Pumpa kungen!",
|
||||
"Hallo Japan!",
|
||||
"Hallo Korea!",
|
||||
"Hallo Wales!",
|
||||
"Hallo Polen!",
|
||||
"Hallo China!",
|
||||
"Hallo China!",
|
||||
"Hallo Russland!",
|
||||
"Hallo Griechenland!",
|
||||
"Mein Leben für Aiur (warte mal..)!",
|
||||
"Mein Leben für Aiur!",
|
||||
"Lenny lenny = new Lenny(\"(°^°)\");",
|
||||
"Ich sehe dein Wortschatz hat sich verbessert!",
|
||||
"Wer hat es dort hin getan?",
|
||||
|
@ -260,14 +305,14 @@ public abstract class Splashes {
|
|||
"if not ok then return end",
|
||||
"Mehrfarbig!",
|
||||
"FUNKY LOL",
|
||||
"Copyright bedeutet LOSER in allen Sprachen!",
|
||||
"SOPA bedeutet LOSER in Schwedisch!",
|
||||
"Große Spitze Zähne!",
|
||||
"Mein Shizun bewacht das Tor!",
|
||||
"Mmmph, mmph!",
|
||||
"Füttere keine Landminen an Piranhas!",
|
||||
"Füttere keine Avocados an Papageien!",
|
||||
"Schwerter für alle!",
|
||||
"Bitteee antworte meinem Tweet! (Nutzer wurde gebannt)",
|
||||
".party().crash().commitWarcrimes().forTheEmperor()!",
|
||||
".party()!",
|
||||
"Nehme ihr Kissen!",
|
||||
"Lege diesen Keks weg!",
|
||||
"Extrem gruselig!",
|
||||
|
@ -275,21 +320,26 @@ public abstract class Splashes {
|
|||
"Jetzt mit extra Sprengstoff!",
|
||||
"Nicht kompatibel zu Java 6!",
|
||||
"Oha.",
|
||||
"HURNERJSGER?",
|
||||
"Was'n los, Doc?",
|
||||
"Enthält jetzt 0 zufällige tägliche Katzen!",
|
||||
"Das ist Numberwang!",
|
||||
"((pls rt)) -- Der Vogel ist tot!",
|
||||
"Willst du meinem Server beitreten?",
|
||||
"Mach einen großen Zaun drum herum! Oder du wirst v-",
|
||||
"Lege eine Landmine drüber!",
|
||||
"Eines Tages, irgendwann in der Zukunft, wird mein Werk r3- ÄÄHHH kopiert werden!",
|
||||
"Eines Tages, irgendwann in der Zukunft, wird mein Werk zitiert werden!",
|
||||
"Jetzt mit zusätzlichem Zeug!",
|
||||
"Zusätzliche Dinge!",
|
||||
"Hurra, Atombomben für alle!",
|
||||
"So süß, wie ein schöner ****!",
|
||||
"So süß, wie ein schöner Bon-Bon!",
|
||||
"Poppende Tags!",
|
||||
"Sehr einflussreich in seinem Kreis!",
|
||||
"Jetzt mit Mehrspieler!",
|
||||
"Stehe aus deinem Grab auf!",
|
||||
"Warnung! Ein großes Kampfschiff \"SHEN\" nähert sich schnell!",
|
||||
"Der blaue Krieger hat das Essen beschossen!",
|
||||
"Renn, Feigling! Ich hunger!",
|
||||
"Geschmack ohne Würze!",
|
||||
"Seltsam, aber nicht fremd!",
|
||||
"Härter als Diamanten, Reich wie Creme!",
|
||||
|
@ -305,13 +355,14 @@ public abstract class Splashes {
|
|||
"Bau mir einen Tisch, einen funkigen Tisch!",
|
||||
"Nehm den Aufzug in die Hölle!",
|
||||
"Hör auf vernünftig zu sein, das hier ist das Internet!",
|
||||
"/give * tnt 67108864 7",
|
||||
"/give @a tnt 67108864 7",
|
||||
"Das ist gut für 3D Realms.",
|
||||
"Jeder Computer ist ein Laptop, wenn du tapfer genug bist!",
|
||||
"Mach es alles, jede Sache!",
|
||||
"Wo ist kein Licht, da kann Spinne!",
|
||||
"GNU Terry Pratchett",
|
||||
"Jetzt Java 21!",
|
||||
"Jetzt Java 8!",
|
||||
"MeinKraft!",
|
||||
"Immer noch zu viele Bugs!",
|
||||
"Wird nicht laggen!",
|
||||
"Er hat es ruiniert!",
|
||||
|
@ -319,6 +370,7 @@ public abstract class Splashes {
|
|||
"OpenGL 2.0+ (definitiv nicht unterstützt)!",
|
||||
"Keine Segfaults (nicht) möglich!",
|
||||
"Keine Abstürze (un)möglich!",
|
||||
"Alpha!",
|
||||
"Enthält Bugs!",
|
||||
"Enthält Mäuse!",
|
||||
"Enthält Gewalt!",
|
||||
|
@ -327,7 +379,6 @@ public abstract class Splashes {
|
|||
"Du hattest eine. aufgabe.",
|
||||
"Spinnen können TNT1 A 0 sein!",
|
||||
"RTFM!",
|
||||
"Hex, nur mit mehr Ameisen!",
|
||||
"Vorherrschaft des Imperiums!",
|
||||
"Vorherrschaft der Eldar!",
|
||||
"Vorherrschaft der Drukhari!",
|
||||
|
@ -358,11 +409,6 @@ public abstract class Splashes {
|
|||
"Eimer mit Wasser!",
|
||||
"Hergestellt in Deutschland!",
|
||||
"Hergestellt in China!",
|
||||
"Jetzt ohne Einzelspieler!",
|
||||
"Jetzt mit tieferen Schluchten!",
|
||||
"Was bist du denn für ein hübsches Ding?",
|
||||
"[TEXT ZENSIERT]",
|
||||
"Mehr Energie!",
|
||||
"Maximale Energie!"
|
||||
"Jetzt mit Einzelspieler!"
|
||||
};
|
||||
}
|
|
@ -17,9 +17,9 @@ public enum Style implements Identifyable, Displayable {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
@Variable(type = IntType.COLOR, name = "color_border_top", category = CVarCategory.GUI, display = "Umrahmung A")
|
||||
@Variable(type = IntType.COLOR, name = "color_border_top", category = CVarCategory.GUI, display = "Umrahmung oben / l.")
|
||||
public int brdr_top;
|
||||
@Variable(type = IntType.COLOR, name = "color_border_btm", category = CVarCategory.GUI, display = "Umrahmung B")
|
||||
@Variable(type = IntType.COLOR, name = "color_border_btm", category = CVarCategory.GUI, display = "Umrahmung unten / r.")
|
||||
public int brdr_btm;
|
||||
|
||||
@Variable(type = IntType.COLOR, name = "color_button_top", category = CVarCategory.GUI, display = "Knopf oben")
|
|
@ -16,15 +16,14 @@ import org.lwjgl.opengl.GL13;
|
|||
|
||||
import client.Client;
|
||||
import client.Client.FileMode;
|
||||
import client.SkinConverter;
|
||||
import client.gui.FileCallback;
|
||||
import client.gui.Font;
|
||||
import client.gui.GuiLoading;
|
||||
import client.gui.element.ActButton;
|
||||
import client.gui.element.Element;
|
||||
import client.gui.element.GuiList;
|
||||
import client.gui.element.Label;
|
||||
import client.gui.element.ListEntry;
|
||||
import client.gui.element.MultiLabel;
|
||||
import client.gui.element.NavButton;
|
||||
import client.gui.element.PressType;
|
||||
import client.gui.element.Slider;
|
||||
|
@ -34,13 +33,12 @@ import client.gui.element.Area;
|
|||
import client.gui.element.ButtonCallback;
|
||||
import client.gui.element.Field;
|
||||
import client.gui.element.FieldCallback;
|
||||
import client.gui.element.TransparentArea;
|
||||
import client.renderer.Drawing;
|
||||
import client.renderer.GlState;
|
||||
import client.renderer.ItemRenderer;
|
||||
import client.renderer.entity.RenderManager;
|
||||
import client.renderer.texture.EntityTexManager;
|
||||
import client.util.FileUtils;
|
||||
import client.util.SkinConverter;
|
||||
import client.vars.CVarCategory;
|
||||
import client.vars.EnumVar;
|
||||
import client.vars.Variable;
|
||||
|
@ -55,7 +53,7 @@ import common.entity.npc.EntityHuman;
|
|||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.npc.SpeciesInfo;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.EntityInfo;
|
||||
import common.init.EntityEggInfo;
|
||||
import common.init.EntityRegistry;
|
||||
import common.init.SpeciesRegistry;
|
||||
import common.init.UniverseRegistry;
|
||||
|
@ -67,6 +65,7 @@ import common.packet.CPacketMessage;
|
|||
import common.packet.CPacketSkin;
|
||||
import common.rng.Random;
|
||||
import common.util.Displayable;
|
||||
import common.util.FileUtils;
|
||||
import common.util.Identifyable;
|
||||
import common.util.Util;
|
||||
|
||||
|
@ -102,7 +101,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}
|
||||
}
|
||||
|
||||
public void draw(int x, int y, int width, int height, int mouseX, int mouseY, boolean hovered)
|
||||
public void draw(int x, int y, int mouseX, int mouseY, boolean hovered)
|
||||
{
|
||||
String str =
|
||||
(this.skinFile != null ? this.skinFile.getName() : (
|
||||
|
@ -114,7 +113,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
Drawing.drawText(str, x + 64 + 3, y, 0xff000000 | (this.charinfo == null ?
|
||||
0xffffff : this.charinfo.color1 | this.charinfo.color2));
|
||||
if(this.charinfo != null)
|
||||
Drawing.drawTextRight(this.charinfo.skin, x + width - 2, y + height - Font.YGLYPH, 0xffc0c0c0);
|
||||
Drawing.drawText(this.charinfo.skin, x + 64 + 3, y + 18, 0xffc0c0c0);
|
||||
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
|
@ -253,8 +252,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
private ActButton templateButton;
|
||||
private DragAdjust adjust;
|
||||
private ActButton dimButton;
|
||||
private MultiLabel descLines;
|
||||
private ActButton cancelButton;
|
||||
private TransparentArea descLines;
|
||||
private float yaw = -15.0f;
|
||||
private float pitch = -15.0f;
|
||||
private boolean waiting = true;
|
||||
|
@ -271,7 +269,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
{
|
||||
super.init(width, height);
|
||||
this.waiting = true;
|
||||
this.setDimensions(390, height, 32, height - 32);
|
||||
this.setDimensions(400, height, 32, height - 32);
|
||||
if(this.gm.getRenderManager().gm == null) {
|
||||
this.unload();
|
||||
this.adjust = null;
|
||||
|
@ -279,7 +277,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}
|
||||
this.currentSkin = this.gm.player != null && !EntityTexManager.hasCustomSkin(this.gm.player.getId()) ? this.gm.player.getChar() : null;
|
||||
this.load(this.gm.player == null ? ModelType.HUMANOID : this.gm.player.getModel(), this.gm.player != null ? this.gm.player.getSpecies() : SpeciesRegistry.CLASSES.get(EntityHuman.class));
|
||||
this.add(new ActButton(2, 12, 193, 0, new ButtonCallback() {
|
||||
this.add(new ActButton(4, 4, 194, 24, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
GuiChar.this.gm.showFileDialog(FileMode.FILE_LOAD_MULTI, "Skin konvertieren", TEXTURE_FOLDER, new FileCallback() {
|
||||
public void selected(File file) {
|
||||
|
@ -289,7 +287,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
});
|
||||
}
|
||||
}, "Importieren: Standard"));
|
||||
this.add(new ActButton(197, 12, 193, 0, new ButtonCallback() {
|
||||
this.add(new ActButton(202, 4, 194, 24, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
GuiChar.this.gm.showFileDialog(FileMode.FILE_LOAD_MULTI, "Skin konvertieren (schlank)", TEXTURE_FOLDER, new FileCallback() {
|
||||
public void selected(File file) {
|
||||
|
@ -299,13 +297,13 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
});
|
||||
}
|
||||
}, "Importieren: Schlank"));
|
||||
this.addSelector("char_filter_species", 392, 12, 250, 0);
|
||||
this.add(new ActButton(2, height - 30, 193, 0, new ButtonCallback() {
|
||||
this.addSelector("char_filter_species", 400, 4, 300, 24);
|
||||
this.add(new ActButton(4, height - 28, 194, 24, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
GuiChar.this.gm.displayGuiScreen(GuiChar.this);
|
||||
}
|
||||
}, "Neu laden"));
|
||||
this.templateButton = this.add(new ActButton(197, height - 30, 193, 0, new ButtonCallback() {
|
||||
this.templateButton = this.add(new ActButton(202, height - 28, 194, 24, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
SkinEntry skin = GuiChar.this.getSelected();
|
||||
if(skin != null && skin.getLocation() != null) {
|
||||
|
@ -322,9 +320,9 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}
|
||||
catch(Exception e) {
|
||||
if(e instanceof FileNotFoundException)
|
||||
Log.IO.warn("Textur ist nicht zum Kopieren vorhanden: " + EntityNPC.getSkinTexture(loc));
|
||||
Log.JNI.warn("Textur ist nicht zum Kopieren vorhanden: " + EntityNPC.getSkinTexture(loc));
|
||||
else
|
||||
Log.IO.error(e, "Konnte Textur nicht kopieren");
|
||||
Log.JNI.error(e, "Konnte Textur nicht kopieren");
|
||||
}
|
||||
finally {
|
||||
if(in != null) {
|
||||
|
@ -339,23 +337,20 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}
|
||||
}
|
||||
}, "Vorlage kopieren"));
|
||||
if(width >= 784 + 460 && height >= 128 + 640)
|
||||
this.adjust = this.add(new DragAdjust(width / 2 - 230, height - 64 - 640, 460, 640));
|
||||
else
|
||||
this.adjust = this.add(new DragAdjust(390 - 115 - 4, height - 32 - 160 - 4, 115, 160));
|
||||
this.adjust = this.add(new DragAdjust(width / 2 - 230, height - 64 - 640, 460, 640));
|
||||
|
||||
this.add(new Label(width - 390, 48, 388, "Spezies: " + (this.gm.player == null ? "<?>" : this.gm.player.getSpecies().name), true));
|
||||
this.add(new NavButton(width - 390, 48, 388, 0, GuiSpecies.INSTANCE, "Spezies ändern"));
|
||||
this.add(new Label(width - 390, 82, 388, "Klasse: " + (this.gm.player == null || this.gm.player.getSpecies().classEnum == null || this.gm.player.getNpcClass() == null || this.gm.player.getNpcClass().toString().isEmpty() ? "<Keine>" : this.gm.player.getNpcClass().toString()), true))
|
||||
this.add(new Label(width - 396, 36, 392, 20, "Spezies: " + (this.gm.player == null ? "<?>" : this.gm.player.getSpecies().name), true));
|
||||
this.add(new NavButton(width - 396, 56, 392, 24, GuiSpecies.INSTANCE, "Spezies ändern"));
|
||||
this.add(new Label(width - 396, 36 + 92, 392, 20, "Klasse: " + (this.gm.player == null || this.gm.player.getSpecies().classEnum == null || this.gm.player.getNpcClass() == null || this.gm.player.getNpcClass().toString().isEmpty() ? "<Keine>" : this.gm.player.getNpcClass().toString()), true))
|
||||
.enabled = this.gm.player != null && this.gm.player.getSpecies().classEnum != null;
|
||||
this.add(new NavButton(width - 390, 82, 388, 0, GuiClass.INSTANCE, "Klasse ändern"))
|
||||
this.add(new NavButton(width - 396, 56 + 92, 392, 24, GuiClass.INSTANCE, "Klasse ändern"))
|
||||
.enabled = this.gm.player != null && this.gm.player.getSpecies().classEnum != null;
|
||||
|
||||
final ActButton[] alignBtns = new ActButton[Alignment.values().length];
|
||||
for (int z = 0; z < Alignment.values().length; z++)
|
||||
{
|
||||
final Alignment align = Alignment.values()[z];
|
||||
alignBtns[z] = this.add(new ActButton(width - 390 + (z % 3) * 130, height - 32 - 20 * 3 + 20 * (z / 3), 128, 0, new ButtonCallback() {
|
||||
alignBtns[z] = this.add(new ActButton(width - 396 + (z % 3) * 132, height - 32 - 28 * 3 + 28 * (z / 3), 128, 24, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
if(GuiChar.this.gm.player != null) {
|
||||
GuiChar.this.waiting = false;
|
||||
|
@ -368,7 +363,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}, align.color + align.display));
|
||||
alignBtns[z].enabled = this.gm.player == null || this.gm.player.getAlignment() != align;
|
||||
}
|
||||
this.add(new Slider(width - 390, 136, 388, 0, 1, this.gm.player == null ? 120 : this.gm.player.getMinSize(), this.gm.player == null ? 320 : this.gm.player.getMaxSize(), this.gm.player == null ? 180 : this.gm.player.getDefaultSize(), this.gm.player == null ? 180 : this.gm.player.getCurrentSize(), new SliderCallback() {
|
||||
this.add(new Slider(width / 2 - 200, height - 28, 400, 24, 1, this.gm.player == null ? 120 : this.gm.player.getMinSize(), this.gm.player == null ? 320 : this.gm.player.getMaxSize(), this.gm.player == null ? 180 : this.gm.player.getDefaultSize(), this.gm.player == null ? 180 : this.gm.player.getCurrentSize(), new SliderCallback() {
|
||||
public void use(Slider elem, int value) {
|
||||
if(GuiChar.this.gm.player != null) {
|
||||
GuiChar.this.waiting = false;
|
||||
|
@ -376,10 +371,10 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}
|
||||
}
|
||||
}, "Spieler-Größe", "cm")).enabled = this.gm.player == null || this.gm.player.getMinSize() != this.gm.player.getMaxSize();
|
||||
this.add(new Label(width - 390, 116, 388, "Name", true));
|
||||
this.add(new Label(width - 390, 170, 388, "Beschreibung", true));
|
||||
final Area descField = this.add(new Area(width - 390, 170, 388, height - 328, IPlayer.MAX_INFO_LENGTH, ""));
|
||||
this.add(new ActButton(width - 195, height - 30, 193, 0, new ButtonCallback() {
|
||||
this.add(new Label(width / 2 - 200, 36, 400, 20, "Name", true));
|
||||
this.add(new Label(width - 396, height - 384, 392, 20, "Beschreibung", true));
|
||||
final Area descField = this.add(new Area(width - 396, height - 364, 392, 130, IPlayer.MAX_INFO_LENGTH, ""));
|
||||
this.add(new ActButton(width - 198, height - 28, 194, 24, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
if(GuiChar.this.gm.player != null) {
|
||||
GuiChar.this.gm.displayGuiScreen(GuiLoading.makeWaitTask("Lade Welt ..."));
|
||||
|
@ -389,14 +384,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}
|
||||
}
|
||||
}, "Charakter erstellen"));
|
||||
this.cancelButton = this.add(new ActButton(width - 390, height - 30, 193, 0, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
if(GuiChar.this.gm.player != null)
|
||||
GuiChar.this.gm.displayGuiScreen(GuiCharacters.INSTANCE);
|
||||
}
|
||||
}, "Abbrechen"));
|
||||
this.setCharsAvailable();
|
||||
this.add(new Field(width - 390, 116, 388, 0, IPlayer.MAX_NICK_LENGTH, new FieldCallback() {
|
||||
this.add(new Field(width / 2 - 200, 36 + 20, 400, 24, IPlayer.MAX_NICK_LENGTH, new FieldCallback() {
|
||||
public void use(Field elem, FieldAction value) {
|
||||
if(value == FieldAction.SEND || value == FieldAction.UNFOCUS) {
|
||||
String name = elem.getText();
|
||||
|
@ -411,9 +399,9 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}, IPlayer.VALID_NICK, this.gm.player == null ? "" : this.gm.player.getCustomNameTag()));
|
||||
this.templateButton.enabled = false;
|
||||
this.dimension = new Random().zrange(UniverseRegistry.getBaseDimensions().size());
|
||||
EntityInfo egg = EntityRegistry.SPAWN_EGGS.get(this.gm.player == null ? EntityRegistry.getEntityString(EntityHuman.class) : EntityRegistry.getEntityString(this.gm.player));
|
||||
if(egg != null && egg.origin() != null) {
|
||||
Dimension dim = UniverseRegistry.getDimension(egg.origin());
|
||||
EntityEggInfo egg = EntityRegistry.SPAWN_EGGS.get(this.gm.player == null ? EntityRegistry.getEntityString(EntityHuman.class) : EntityRegistry.getEntityString(this.gm.player));
|
||||
if(egg != null && egg.origin != null) {
|
||||
Dimension dim = UniverseRegistry.getDimension(egg.origin);
|
||||
if(dim != null) {
|
||||
for(int z = 0; z < UniverseRegistry.getBaseDimensions().size(); z++) {
|
||||
if(UniverseRegistry.getBaseDimensions().get(z).getDimensionId() == dim.getDimensionId()) {
|
||||
|
@ -423,7 +411,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}
|
||||
}
|
||||
}
|
||||
this.dimButton = this.add(new ActButton(width - 390, height - 156, 388, 0, new ButtonCallback() {
|
||||
this.dimButton = this.add(new ActButton(width - 396, height - 220, 392, 24, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType mode) {
|
||||
if(mode == PressType.TERTIARY) {
|
||||
GuiChar.this.dimension = new Random().zrange(UniverseRegistry.getBaseDimensions().size());
|
||||
|
@ -439,7 +427,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
GuiChar.this.setDimButton();
|
||||
}
|
||||
}, ""));
|
||||
this.descLines = this.add(new MultiLabel(width - 390, height - 156 + Element.BASE_HEIGHT, 388, 42, "", true));
|
||||
this.descLines = this.add(new TransparentArea(width - 396, height - 220 + 24, 392, 66, "", false));
|
||||
this.setDimButton();
|
||||
}
|
||||
|
||||
|
@ -461,10 +449,8 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
if(this.adjust != null) {
|
||||
float factor = this.gm.player.width > 2.15f ? 2.15f / this.gm.player.width : 1.0f;
|
||||
factor = this.gm.player.height > 3.0f && 3.0f / this.gm.player.height < factor ? 3.0f / this.gm.player.height : factor;
|
||||
if(this.gm.fb_x >= 784 + 460 && this.gm.fb_y >= 128 + 640)
|
||||
drawEntity(400 + (this.gm.fb_x - 400 - 400) / 2, this.gm.fb_y - 160, 160.0f * factor, this.yaw, this.pitch, this.gm.player);
|
||||
else
|
||||
drawEntity(390 - 4 - 115 / 2, this.gm.fb_y - 60, 40.0f * factor, this.yaw, this.pitch, this.gm.player);
|
||||
drawEntity(400 + (this.gm.fb_x - 400 - 400) / 2, this.gm.fb_y - 160, 160.0f * factor
|
||||
, this.yaw, this.pitch, this.gm.player);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -484,11 +470,6 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
return "Charakter anpassen";
|
||||
}
|
||||
|
||||
public void setCharsAvailable() {
|
||||
if(this.cancelButton != null)
|
||||
this.cancelButton.enabled = !this.gm.characterList.isEmpty();
|
||||
}
|
||||
|
||||
public static BufferedImage loadSkin(File file)
|
||||
{
|
||||
BufferedImage img = null;
|
||||
|
@ -556,6 +537,11 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
|
||||
this.elements.clear();
|
||||
}
|
||||
|
||||
public int getListWidth()
|
||||
{
|
||||
return 400 - 20;
|
||||
}
|
||||
|
||||
public int getSlotHeight()
|
||||
{
|
|
@ -1,21 +1,18 @@
|
|||
package client.gui.character;
|
||||
|
||||
import client.gui.Font;
|
||||
import client.gui.GuiConfirm;
|
||||
import client.gui.GuiMenu;
|
||||
import client.gui.element.ActButton;
|
||||
import client.gui.element.Area;
|
||||
import client.gui.element.ButtonCallback;
|
||||
import client.gui.element.GuiList;
|
||||
import client.gui.element.ListEntry;
|
||||
import client.gui.element.NavButton;
|
||||
import client.gui.element.PressType;
|
||||
import client.gui.element.TransparentArea;
|
||||
import client.renderer.Drawing;
|
||||
import common.color.TextColor;
|
||||
import common.entity.npc.PlayerCharacter;
|
||||
import common.packet.CPacketAction;
|
||||
import common.packet.CPacketAction.Action;
|
||||
import common.util.ExtMath;
|
||||
|
||||
public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry> implements ButtonCallback
|
||||
{
|
||||
|
@ -30,18 +27,18 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry> impleme
|
|||
this.initial = initial;
|
||||
}
|
||||
|
||||
public void draw(int x, int y, int width, int height, int mouseX, int mouseY, boolean hovered)
|
||||
public void draw(int x, int y, int mouseX, int mouseY, boolean hovered)
|
||||
{
|
||||
if(this.initial)
|
||||
Drawing.drawRect(x, y, 1, 36, 0xffaf0000);
|
||||
String str = this.character == null ? TextColor.BLUE + "[" + TextColor.CYAN + "+" + TextColor.BLUE + "]" :
|
||||
String.format(TextColor.GREEN + "Level " + TextColor.DGREEN + "%d " + TextColor.YELLOW + "%s " + TextColor.VIOLET + "%s",
|
||||
character.level(), character.type(), character.name());
|
||||
String.format(TextColor.GREEN + "Level " + TextColor.DGREEN + "%d " + TextColor.YELLOW + "%s " + TextColor.VIOLET + "%s" + TextColor.GRAY + " [%s%s" + TextColor.GRAY + "]",
|
||||
character.level, character.type, character.name, character.align.color, character.align.display);
|
||||
String pos = this.character == null ? TextColor.BROWN + "Neuen Charakter erstellen" :
|
||||
String.format(TextColor.NEON + "%s " + TextColor.GRAY + "bei " + TextColor.ACID + "%d" + TextColor.GRAY + ", " + TextColor.ACID + "%d" + TextColor.GRAY + ", " + TextColor.ACID + "%d",
|
||||
character.dim(), character.pos().getX(), character.pos().getY(), character.pos().getZ());
|
||||
character.dim, character.pos.getX(), character.pos.getY(), character.pos.getZ());
|
||||
Drawing.drawText(str, x + 3, y, 0xffffffff);
|
||||
Drawing.drawText(pos, x + 3, y + height - Font.YGLYPH, 0xffffffff);
|
||||
Drawing.drawText(pos, x + 3, y + 16, 0xffffffff);
|
||||
}
|
||||
|
||||
public void select(boolean dclick, int mx, int my)
|
||||
|
@ -54,7 +51,7 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry> impleme
|
|||
|
||||
public static final GuiCharacters INSTANCE = new GuiCharacters();
|
||||
|
||||
private Area descField;
|
||||
private TransparentArea descField;
|
||||
private ActButton actionButtom;
|
||||
private ActButton deleteButtom;
|
||||
|
||||
|
@ -63,34 +60,40 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry> impleme
|
|||
|
||||
private void updateButtons() {
|
||||
CharacterEntry entry = this.getSelected();
|
||||
this.descField.setText(entry == null ? "" : (entry.character == null ? "*neuer Charakter*" : String.format(TextColor.GRAY + "[%s%s" + TextColor.GRAY + "]\n" + TextColor.RESET + "%s", entry.character.align().color, entry.character.align().display, entry.character.info() == null ? "*keine Beschreibung vorhanden*" : this.getSelected().character.info())));
|
||||
this.descField.setText(entry == null ? "" : (entry.character == null ? "*neuer Charakter*" : (entry.character.info == null ? "*keine Beschreibung vorhanden*" : this.getSelected().character.info)));
|
||||
this.actionButtom.setText(entry != null && entry.character == null ? "Charakter erstellen" : "Charakter spielen");
|
||||
this.actionButtom.enabled = entry != null && !entry.initial;
|
||||
this.deleteButtom.enabled = !this.gm.charEditor && entry != null && entry.character != null && !entry.initial;
|
||||
this.deleteButtom.enabled = entry != null && entry.character != null && !entry.initial;
|
||||
}
|
||||
|
||||
public void init(int width, int height)
|
||||
{
|
||||
super.init(width, height);
|
||||
this.setDimensions(width - 300, height, 32, height - 32);
|
||||
this.setDimensions(600, height, 32, height - 32);
|
||||
this.elements.clear();
|
||||
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()));
|
||||
}
|
||||
if(!this.gm.charEditor)
|
||||
this.elements.add(new CharacterEntry(null, false));
|
||||
this.setSelected(ExtMath.clampi(selected, -1, this.elements.size() - 1));
|
||||
this.descField = this.add(new Area(width - 300, 32, 300, height - 64, ""));
|
||||
this.deleteButtom = this.add(new ActButton(width / 2 - 302, height - 30, 200, 0, this, "Charakter löschen"));
|
||||
this.actionButtom = this.add(new ActButton(width / 2 - 100, height - 30, 200, 0, this, ""));
|
||||
this.add(new NavButton(width / 2 + 102, height - 30, 200, 0, this.gm.charEditor ? GuiChar.INSTANCE : GuiMenu.INSTANCE, this.gm.charEditor ? "Zurück" : "Abbrechen"));
|
||||
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);
|
||||
}
|
||||
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, ""));
|
||||
this.add(new NavButton(width / 2 + 104, height - 28, 200, 24, GuiMenu.INSTANCE, "Abbrechen"));
|
||||
this.updateButtons();
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return "Charakter auswählen";
|
||||
return "Charakter anpassen";
|
||||
}
|
||||
|
||||
public int getListWidth()
|
||||
{
|
||||
return 560;
|
||||
}
|
||||
|
||||
public int getSlotHeight()
|
||||
{
|
||||
|
@ -104,7 +107,7 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry> impleme
|
|||
if(entry.character == null)
|
||||
this.gm.getNetHandler().addToSendQueue(new CPacketAction(CPacketAction.Action.OPEN_EDITOR));
|
||||
else
|
||||
this.gm.getNetHandler().addToSendQueue(new CPacketAction(GuiCharacters.this.gm.charEditor ? Action.CANCEL_EDITOR : CPacketAction.Action.SELECT_CHARACTER, this.selectedElement));
|
||||
this.gm.getNetHandler().addToSendQueue(new CPacketAction(CPacketAction.Action.SELECT_CHARACTER, this.selectedElement));
|
||||
}
|
||||
else if(elem == this.deleteButtom && entry.character != null) {
|
||||
this.gm.displayGuiScreen(new GuiConfirm(new GuiConfirm.Callback() {
|
||||
|
@ -113,7 +116,7 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry> impleme
|
|||
GuiCharacters.this.gm.getNetHandler().addToSendQueue(new CPacketAction(CPacketAction.Action.DELETE_CHARACTER, GuiCharacters.this.selectedElement));
|
||||
GuiCharacters.this.gm.displayGuiScreen(GuiCharacters.this);
|
||||
}
|
||||
}, "Möchtest du diesen Charakter wirklich löschen?", "Der Fortschritt, die Gegenstände und die Historie\nvon \"" + entry.character.name() + "\" werden für immer verloren sein!", "Löschen", "Abbrechen"));
|
||||
}, "Möchtest du diesen Charakter wirklich löschen?", "Der Fortschritt, die Gegenstände und die Historie von \"" + entry.character.name + "\" werden für imer verloren sein!", "Löschen", "Abbrechen"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,7 +20,7 @@ public class GuiClass extends GuiList<GuiClass.ClassEntry> implements ButtonCall
|
|||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
public void draw(int x, int y, int width, int height, int mouseX, int mouseY, boolean hovered)
|
||||
public void draw(int x, int y, int mouseX, int mouseY, boolean hovered)
|
||||
{
|
||||
if(GuiClass.this.gm.player != null && this.clazz == GuiClass.this.gm.player.getNpcClass())
|
||||
Drawing.drawRect(x, y, 1, 44, 0xffaf0000);
|
||||
|
@ -44,19 +44,24 @@ public class GuiClass extends GuiList<GuiClass.ClassEntry> implements ButtonCall
|
|||
public void init(int width, int height)
|
||||
{
|
||||
super.init(width, height);
|
||||
this.setDimensions(width, height, 32, height - 32);
|
||||
this.setDimensions(400, height, 32, height - 32);
|
||||
this.elements.clear();
|
||||
if(this.gm.player != null && this.gm.player.getSpecies().classEnum != null)
|
||||
for(Enum clazz : this.gm.player.getSpecies().classEnum.getEnumConstants()) {
|
||||
this.elements.add(new ClassEntry(clazz));
|
||||
}
|
||||
this.add(new NavButton(width / 2 - 195, height - 30, 194, 0, GuiChar.INSTANCE, "Zurück"));
|
||||
this.selectButton = this.add(new ActButton(width / 2 + 1, height - 30, 194, 0, this, "Klasse ändern"));
|
||||
this.add(new NavButton(width - 198 * 2, height - 28, 194, 24, GuiChar.INSTANCE, "Zurück"));
|
||||
this.selectButton = this.add(new ActButton(width - 198, height - 28, 194, 24, this, "Klasse ändern"));
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return "Klasse wählen";
|
||||
}
|
||||
|
||||
public int getListWidth()
|
||||
{
|
||||
return 400 - 20;
|
||||
}
|
||||
|
||||
public int getSlotHeight()
|
||||
{
|
|
@ -23,7 +23,7 @@ public class GuiSpecies extends GuiList<GuiSpecies.SpeciesEntry> implements Butt
|
|||
this.species = species;
|
||||
}
|
||||
|
||||
public void draw(int x, int y, int width, int height, int mouseX, int mouseY, boolean hovered)
|
||||
public void draw(int x, int y, int mouseX, int mouseY, boolean hovered)
|
||||
{
|
||||
if(GuiSpecies.this.gm.player != null && this.species == GuiSpecies.this.gm.player.getSpecies())
|
||||
Drawing.drawRect(x, y, 1, 44, 0xffaf0000);
|
||||
|
@ -49,18 +49,23 @@ public class GuiSpecies extends GuiList<GuiSpecies.SpeciesEntry> implements Butt
|
|||
public void init(int width, int height)
|
||||
{
|
||||
super.init(width, height);
|
||||
this.setDimensions(width, height, 32, height - 32);
|
||||
this.setDimensions(400, height, 32, height - 32);
|
||||
this.elements.clear();
|
||||
for(SpeciesInfo species : SpeciesRegistry.SPECIMEN) {
|
||||
this.elements.add(new SpeciesEntry(species));
|
||||
}
|
||||
this.add(new NavButton(width / 2 - 195, height - 30, 194, 0, GuiChar.INSTANCE, "Zurück"));
|
||||
this.selectButton = this.add(new ActButton(width / 2 + 1, height - 30, 194, 0, this, "Spezies ändern"));
|
||||
this.add(new NavButton(width - 198 * 2, height - 28, 194, 24, GuiChar.INSTANCE, "Zurück"));
|
||||
this.selectButton = this.add(new ActButton(width - 198, height - 28, 194, 24, this, "Spezies ändern"));
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return "Spezies wählen";
|
||||
}
|
||||
|
||||
public int getListWidth()
|
||||
{
|
||||
return 400 - 20;
|
||||
}
|
||||
|
||||
public int getSlotHeight()
|
||||
{
|
|
@ -6,7 +6,6 @@ import java.util.Set;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL13;
|
||||
|
||||
import client.gui.Font;
|
||||
import client.gui.Gui;
|
||||
import client.gui.element.InventoryButton;
|
||||
import client.renderer.Drawing;
|
||||
|
@ -43,7 +42,7 @@ public abstract class GuiContainer extends Gui
|
|||
|
||||
private static final List<ItemStack> ITEM_LIST = Lists.<ItemStack>newArrayList();
|
||||
|
||||
private static CheatTab selectedTab = CheatTab.BLOCKS;
|
||||
private static CheatTab selectedTab = CheatTab.tabBlocks;
|
||||
// /** The location of the inventory background texture */
|
||||
// protected static final String inventoryBackground = "textures/gui/inventory.png";
|
||||
|
||||
|
@ -375,20 +374,20 @@ public abstract class GuiContainer extends Gui
|
|||
if (this.draggedStack != null && this.isRightMouseClick)
|
||||
{
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.size = ExtMath.ceilf((float)itemstack.size / 2.0F);
|
||||
itemstack.stackSize = ExtMath.ceilf((float)itemstack.stackSize / 2.0F);
|
||||
}
|
||||
else if (this.dragSplitting && this.dragSplittingSlots.size() > 1)
|
||||
{
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.size = this.dragSplittingRemnant;
|
||||
itemstack.stackSize = this.dragSplittingRemnant;
|
||||
|
||||
if (itemstack.size == 0)
|
||||
if (itemstack.stackSize == 0)
|
||||
{
|
||||
s = "" + TextColor.YELLOW + "0";
|
||||
}
|
||||
}
|
||||
else if(itemstack == this.cheatStack) {
|
||||
s = TextColor.DGREEN + "+" + TextColor.GREEN + ItemStack.formatAmount(itemstack.size);
|
||||
s = TextColor.DGREEN + "+" + TextColor.GREEN + ItemStack.formatAmount(itemstack.stackSize);
|
||||
}
|
||||
|
||||
this.drawItemStack(itemstack, mouseX - j2, mouseY - k2, s);
|
||||
|
@ -519,7 +518,7 @@ public abstract class GuiContainer extends Gui
|
|||
if (slotIn == this.clickedSlot && this.draggedStack != null && this.isRightMouseClick && itemstack != null)
|
||||
{
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.size /= 2;
|
||||
itemstack.stackSize /= 2;
|
||||
}
|
||||
else if (this.dragSplitting && this.dragSplittingSlots.contains(slotIn) && itemstack1 != null)
|
||||
{
|
||||
|
@ -532,18 +531,18 @@ public abstract class GuiContainer extends Gui
|
|||
{
|
||||
itemstack = itemstack1.copy();
|
||||
flag = true;
|
||||
Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack, slotIn.getStack() == null ? 0 : slotIn.getStack().size);
|
||||
Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack, slotIn.getStack() == null ? 0 : slotIn.getStack().stackSize);
|
||||
|
||||
if (itemstack.size > itemstack.getMaxStackSize())
|
||||
if (itemstack.stackSize > itemstack.getMaxStackSize())
|
||||
{
|
||||
s = TextColor.YELLOW + ItemStack.formatAmount(itemstack.getMaxStackSize());
|
||||
itemstack.size = itemstack.getMaxStackSize();
|
||||
itemstack.stackSize = itemstack.getMaxStackSize();
|
||||
}
|
||||
|
||||
if (itemstack.size > slotIn.getItemStackLimit(itemstack))
|
||||
if (itemstack.stackSize > slotIn.getItemStackLimit(itemstack))
|
||||
{
|
||||
s = TextColor.YELLOW + ItemStack.formatAmount(slotIn.getItemStackLimit(itemstack));
|
||||
itemstack.size = slotIn.getItemStackLimit(itemstack);
|
||||
itemstack.stackSize = slotIn.getItemStackLimit(itemstack);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -594,25 +593,25 @@ public abstract class GuiContainer extends Gui
|
|||
|
||||
if (itemstack != null && this.dragSplitting)
|
||||
{
|
||||
this.dragSplittingRemnant = itemstack.size;
|
||||
this.dragSplittingRemnant = itemstack.stackSize;
|
||||
|
||||
for (Slot slot : this.dragSplittingSlots)
|
||||
{
|
||||
ItemStack itemstack1 = itemstack.copy();
|
||||
int i = slot.getStack() == null ? 0 : slot.getStack().size;
|
||||
int i = slot.getStack() == null ? 0 : slot.getStack().stackSize;
|
||||
Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack1, i);
|
||||
|
||||
if (itemstack1.size > itemstack1.getMaxStackSize())
|
||||
if (itemstack1.stackSize > itemstack1.getMaxStackSize())
|
||||
{
|
||||
itemstack1.size = itemstack1.getMaxStackSize();
|
||||
itemstack1.stackSize = itemstack1.getMaxStackSize();
|
||||
}
|
||||
|
||||
if (itemstack1.size > slot.getItemStackLimit(itemstack1))
|
||||
if (itemstack1.stackSize > slot.getItemStackLimit(itemstack1))
|
||||
{
|
||||
itemstack1.size = slot.getItemStackLimit(itemstack1);
|
||||
itemstack1.stackSize = slot.getItemStackLimit(itemstack1);
|
||||
}
|
||||
|
||||
this.dragSplittingRemnant -= itemstack1.size - i;
|
||||
this.dragSplittingRemnant -= itemstack1.stackSize - i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -645,7 +644,7 @@ public abstract class GuiContainer extends Gui
|
|||
if(this.cheatStack != null) {
|
||||
Slot slot = this.getSlotAtPosition(mouseX, mouseY);
|
||||
if((mouseButton == 0 || mouseButton == 1) && slot != null && this.gm.player != null && slot.inventory == this.gm.player.inventory)
|
||||
this.gm.player.client.addToSendQueue(new CPacketCheat(this.cheatStack, slot.getIndex(), mouseButton == 0 && this.cheatStack.size > 1));
|
||||
this.gm.player.client.addToSendQueue(new CPacketCheat(this.cheatStack, slot.getIndex(), mouseButton == 0 && this.cheatStack.stackSize > 1));
|
||||
if(mouseButton != 1 && !this.gm.ctrl())
|
||||
this.cheatStack = null;
|
||||
return;
|
||||
|
@ -812,7 +811,7 @@ public abstract class GuiContainer extends Gui
|
|||
// }
|
||||
// }
|
||||
// else
|
||||
if (this.dragSplitting && slot != null && itemstack != null && itemstack.size > this.dragSplittingSlots.size() && Container.canAddItemToSlot(slot, itemstack, true) && slot.isItemValid(itemstack) && this.inventorySlots.canDragIntoSlot(slot))
|
||||
if (this.dragSplitting && slot != null && itemstack != null && itemstack.stackSize > this.dragSplittingSlots.size() && Container.canAddItemToSlot(slot, itemstack, true) && slot.isItemValid(itemstack) && this.inventorySlots.canDragIntoSlot(slot))
|
||||
{
|
||||
this.dragSplittingSlots.add(slot);
|
||||
this.updateDragSplitting();
|
||||
|
@ -1078,7 +1077,7 @@ public abstract class GuiContainer extends Gui
|
|||
|
||||
if (this.gm != null && this.gm.player != null && (!this.gm.player.isEntityAlive() || this.gm.player.dead))
|
||||
{
|
||||
this.gm.displayGuiScreen(null);
|
||||
this.gm.player.closeScreen();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1091,13 +1090,13 @@ public abstract class GuiContainer extends Gui
|
|||
{
|
||||
if (stack != null)
|
||||
{
|
||||
if (stack.size != 1 || text != null)
|
||||
if (stack.stackSize != 1 || text != null)
|
||||
{
|
||||
String s = text == null ? ItemStack.formatAmount(stack.size) : text;
|
||||
String s = text == null ? ItemStack.formatAmount(stack.stackSize) : text;
|
||||
|
||||
if (text == null && stack.size < 1)
|
||||
if (text == null && stack.stackSize < 1)
|
||||
{
|
||||
s = TextColor.RED + ItemStack.formatAmount(stack.size);
|
||||
s = TextColor.RED + ItemStack.formatAmount(stack.stackSize);
|
||||
}
|
||||
// this.drawString(s, , );
|
||||
// Vec2i size = Drawing.txt_size(0, 0, 0, 0, 65536, 65536, s);
|
||||
|
@ -1105,7 +1104,7 @@ public abstract class GuiContainer extends Gui
|
|||
// int y = ;
|
||||
// x = x * 2 + this.container_x;
|
||||
// y = y * 2 + this.container_y;
|
||||
Drawing.drawTextRight(s, xPosition + 32, yPosition + 33 - Font.YGLYPH, 0xffffffff);
|
||||
Drawing.drawTextRight(s, xPosition + 32, yPosition + 17, 0xffffffff);
|
||||
}
|
||||
|
||||
if (stack.isItemDamaged())
|
||||
|
@ -1152,7 +1151,7 @@ public abstract class GuiContainer extends Gui
|
|||
protected void drawTab(CheatTab tab)
|
||||
{
|
||||
this.itemRender.zLevel = 100.0F;
|
||||
ItemStack itemstack = tab.getIcon();
|
||||
ItemStack itemstack = tab.getIconItemStack();
|
||||
GlState.enableDepth();
|
||||
this.itemRender.renderItemAndEffectIntoGUI(itemstack, this.xSize + 2 + 18 * tab.getHorizontal() + 1, 9 * 18 + 4 + 20 * tab.getVertical() + 1);
|
||||
this.itemRender.zLevel = 0.0F;
|
||||
|
@ -1177,7 +1176,7 @@ public abstract class GuiContainer extends Gui
|
|||
selectedTab = tab;
|
||||
this.dragSplittingSlots.clear();
|
||||
ITEM_LIST.clear();
|
||||
tab.filter(ITEM_LIST);
|
||||
tab.displayAllReleventItems(ITEM_LIST);
|
||||
|
||||
this.currentScroll = 0.0F;
|
||||
}
|
||||
|
@ -1202,7 +1201,7 @@ public abstract class GuiContainer extends Gui
|
|||
}
|
||||
else {
|
||||
this.cheatStack = ITEM_LIST.get(i1).copy();
|
||||
this.cheatStack.size = full ? this.cheatStack.getMaxStackSize() : 1;
|
||||
this.cheatStack.stackSize = full ? this.cheatStack.getMaxStackSize() : 1;
|
||||
}
|
||||
return true;
|
||||
}
|
42
client/src/client/gui/container/GuiCrafting.java
Executable file
42
client/src/client/gui/container/GuiCrafting.java
Executable file
|
@ -0,0 +1,42 @@
|
|||
package client.gui.container;
|
||||
|
||||
import common.inventory.ContainerWorkbench;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.util.BlockPos;
|
||||
import common.world.World;
|
||||
|
||||
public class GuiCrafting extends GuiContainer
|
||||
{
|
||||
// private static final String craftingTableGuiTextures = "textures/gui/crafting_table.png";
|
||||
|
||||
public GuiCrafting(InventoryPlayer playerInv, World worldIn)
|
||||
{
|
||||
this(playerInv, worldIn, BlockPos.ORIGIN);
|
||||
}
|
||||
|
||||
public GuiCrafting(InventoryPlayer playerInv, World worldIn, BlockPos blockPosition)
|
||||
{
|
||||
super(new ContainerWorkbench(playerInv, worldIn, blockPosition));
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
|
||||
*/
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
this.drawString("Handwerk", 28, 6);
|
||||
this.drawString("Inventar", 8, this.ySize - 96 + 2);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Args : renderPartialTicks, mouseX, mouseY
|
||||
// */
|
||||
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
|
||||
// {
|
||||
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// this.gm.getTextureManager().bindTexture(craftingTableGuiTextures);
|
||||
// int i = (this.width - this.xSize) / 2;
|
||||
// int j = (this.height - this.ySize) / 2;
|
||||
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
|
||||
// }
|
||||
}
|
|
@ -5,7 +5,7 @@ import common.enchantment.Enchantment;
|
|||
import common.inventory.ContainerEnchantment;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.rng.Random;
|
||||
import common.util.Pair;
|
||||
import common.tileentity.IWorldNameable;
|
||||
import common.world.World;
|
||||
|
||||
public class GuiEnchant extends GuiContainer
|
||||
|
@ -19,7 +19,7 @@ public class GuiEnchant extends GuiContainer
|
|||
private final Random nameRand = new Random();
|
||||
private final Random random = new Random();
|
||||
private final ContainerEnchantment container;
|
||||
private final String title;
|
||||
private final IWorldNameable table;
|
||||
|
||||
// public int field_147073_u;
|
||||
// public float field_147071_v;
|
||||
|
@ -30,12 +30,12 @@ public class GuiEnchant extends GuiContainer
|
|||
// public float field_147076_A;
|
||||
// ItemStack field_147077_B;
|
||||
|
||||
public GuiEnchant(InventoryPlayer inventory, World worldIn, String title)
|
||||
public GuiEnchant(InventoryPlayer inventory, World worldIn, IWorldNameable table)
|
||||
{
|
||||
super(new ContainerEnchantment(inventory, worldIn));
|
||||
this.playerInventory = inventory;
|
||||
this.container = (ContainerEnchantment)this.inventorySlots;
|
||||
this.title = title;
|
||||
this.table = table;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,7 +43,7 @@ public class GuiEnchant extends GuiContainer
|
|||
*/
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
this.drawString(this.title, 12, 5);
|
||||
this.drawString(this.table.getCommandName(), 12, 5);
|
||||
this.drawString(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
|
||||
|
@ -89,14 +89,14 @@ public class GuiEnchant extends GuiContainer
|
|||
*/
|
||||
public void drawGuiContainerBackgroundLayer()
|
||||
{
|
||||
this.nameRand.setSeed((long)this.container.seed);
|
||||
this.nameRand.setSeed((long)this.container.xpSeed);
|
||||
|
||||
for (int l = 0; l < 3; ++l)
|
||||
{
|
||||
int i1 = 60;
|
||||
int j1 = i1 + 20;
|
||||
String s = this.getRandomName();
|
||||
int l1 = this.container.mana[l];
|
||||
int l1 = this.container.enchantLevels[l];
|
||||
|
||||
if (l1 == 0)
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ public class GuiEnchant extends GuiContainer
|
|||
String s1 = "" + l1;
|
||||
int i2 = 6839882;
|
||||
|
||||
if (/* (k < l + 1 || */ this.gm.player.getManaPoints() < l1) // && !this.gm.thePlayer.creative)
|
||||
if (/* (k < l + 1 || */ this.gm.player.experienceLevel < l1) // && !this.gm.thePlayer.creative)
|
||||
{
|
||||
this.rect(i1, 14 + 19 * l, 108, 19, 0x400000);
|
||||
this.rect(i1 + 1, 15 + 19 * l, 16, 16, 0x200000);
|
||||
|
@ -150,16 +150,19 @@ public class GuiEnchant extends GuiContainer
|
|||
|
||||
for (int j = 0; j < 3; ++j)
|
||||
{
|
||||
int k = this.container.mana[j];
|
||||
Pair<Enchantment, Integer> l = this.container.ench[j];
|
||||
int k = this.container.enchantLevels[j];
|
||||
int l = this.container.enchantmentIds[j];
|
||||
int i1 = j + 1;
|
||||
|
||||
if (this.isPointInRegion(60, 14 + 19 * j, 108, 17, mouseX, mouseY) && k > 0 && l != null)
|
||||
if (this.isPointInRegion(60, 14 + 19 * j, 108, 17, mouseX, mouseY) && k > 0 && l >= 0)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
String s = l.first().getFormattedName(l.second());
|
||||
sb.append(TextColor.WHITE + s + " . . . ?");
|
||||
if (l >= 0 && Enchantment.getEnchantmentById(l & 255) != null)
|
||||
{
|
||||
String s = Enchantment.getEnchantmentById(l & 255).getFormattedName((l & 65280) >> 8);
|
||||
sb.append(TextColor.WHITE + s + " . . . ?");
|
||||
}
|
||||
|
||||
// if (!flag)
|
||||
// {
|
||||
|
@ -168,9 +171,9 @@ public class GuiEnchant extends GuiContainer
|
|||
// sb.append("\n");
|
||||
// }
|
||||
|
||||
if (this.gm.player.getManaPoints() < k)
|
||||
if (this.gm.player.experienceLevel < k)
|
||||
{
|
||||
sb.append((sb.length() != 0 ? "\n" : "") + TextColor.RED + String.format("%d Mana erforderlich", this.container.mana[j]));
|
||||
sb.append((sb.length() != 0 ? "\n" : "") + TextColor.RED + String.format("Erfahrungsstufe %d erforderlich", this.container.enchantLevels[j]));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -196,11 +199,11 @@ public class GuiEnchant extends GuiContainer
|
|||
|
||||
if (i1 == 1)
|
||||
{
|
||||
s1 = "1 Manapunkt";
|
||||
s1 = "1 Erfahrungsstufe";
|
||||
}
|
||||
else
|
||||
{
|
||||
s1 = String.format("%d Manapunkte", i1);
|
||||
s1 = String.format("%d Erfahrungsstufen", i1);
|
||||
}
|
||||
|
||||
sb.append((sb.length() != 0 ? "\n" : "") + TextColor.LGRAY.toString() + "" + s1);
|
|
@ -1,26 +1,45 @@
|
|||
package client.gui.container;
|
||||
|
||||
import client.Client;
|
||||
import common.entity.Entity;
|
||||
import common.inventory.ContainerEntityInventory;
|
||||
import common.entity.animal.EntityHorse;
|
||||
import common.inventory.ContainerHorseInventory;
|
||||
import common.inventory.IInventory;
|
||||
|
||||
|
||||
public class GuiEntity extends GuiContainer
|
||||
public class GuiHorse extends GuiContainer
|
||||
{
|
||||
private IInventory playerInventory;
|
||||
private IInventory entityInventory;
|
||||
// private static final String horseGuiTextures = "textures/gui/horse.png";
|
||||
|
||||
public GuiEntity(IInventory playerInv, IInventory entityInv, Entity entity)
|
||||
/** The player inventory bound to this GUI. */
|
||||
private IInventory playerInventory;
|
||||
|
||||
/** The horse inventory bound to this GUI. */
|
||||
private IInventory horseInventory;
|
||||
|
||||
// /** The EntityHorse whose inventory is currently being accessed. */
|
||||
// private EntityHorse horseEntity;
|
||||
|
||||
// /** The mouse x-position recorded during the last rendered frame. */
|
||||
// private float mousePosx;
|
||||
//
|
||||
// /** The mouse y-position recorded during the last renderered frame. */
|
||||
// private float mousePosY;
|
||||
|
||||
public GuiHorse(IInventory playerInv, IInventory horseInv, EntityHorse horse)
|
||||
{
|
||||
super(new ContainerEntityInventory(playerInv, entityInv, entity, Client.CLIENT.player));
|
||||
super(new ContainerHorseInventory(playerInv, horseInv, horse, Client.CLIENT.player));
|
||||
this.playerInventory = playerInv;
|
||||
this.entityInventory = entityInv;
|
||||
this.horseInventory = horseInv;
|
||||
// this.horseEntity = horse;
|
||||
// this.allowUserInput = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
|
||||
*/
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
this.drawString(this.entityInventory.getCommandName(), 8, 6);
|
||||
this.drawString(this.horseInventory.getCommandName(), 8, 6);
|
||||
this.drawString(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
|
44
client/src/client/gui/container/GuiMachine.java
Executable file
44
client/src/client/gui/container/GuiMachine.java
Executable file
|
@ -0,0 +1,44 @@
|
|||
package client.gui.container;
|
||||
|
||||
import client.Client;
|
||||
import common.inventory.ContainerMachine;
|
||||
import common.inventory.IInventory;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.tileentity.TileEntityMachine;
|
||||
|
||||
|
||||
public class GuiMachine extends GuiContainer
|
||||
{
|
||||
// private final String texture;
|
||||
private final IInventory playerInv;
|
||||
private final IInventory machineInv;
|
||||
private final TileEntityMachine machine;
|
||||
|
||||
public GuiMachine(InventoryPlayer player, IInventory inv, TileEntityMachine machine)
|
||||
{
|
||||
super(new ContainerMachine(player, machine, inv, Client.CLIENT.player));
|
||||
this.playerInv = player;
|
||||
this.machineInv = machine;
|
||||
// this.allowUserInput = false;
|
||||
this.ySize = 153;
|
||||
// this.texture = "textures/gui/" + texture + ".png";
|
||||
this.machine = machine;
|
||||
}
|
||||
|
||||
public void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
this.drawString(this.machine.getStatus().color + this.machineInv.getCommandName() + " - " + this.machine.getStatus().name, 8, 6);
|
||||
this.drawString(this.playerInv.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
this.drawString(String.format("Temperatur: %d °", this.machine.getTemperature()), 8, 18);
|
||||
this.drawString(this.machine.formatDisplay(), 8, 28);
|
||||
}
|
||||
|
||||
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
|
||||
// {
|
||||
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// this.gm.getTextureManager().bindTexture(this.texture);
|
||||
// int i = (this.width - this.xSize) / 2;
|
||||
// int j = (this.height - this.ySize) / 2;
|
||||
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
|
||||
// }
|
||||
}
|
|
@ -81,9 +81,9 @@ public class GuiMerchant extends GuiContainer
|
|||
if (merchantrecipelist != null && !merchantrecipelist.isEmpty()) {
|
||||
int k = this.selectedMerchantRecipe;
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
|
||||
ItemStack itemstack = merchantrecipe.first();
|
||||
ItemStack itemstack1 = merchantrecipe.second();
|
||||
ItemStack itemstack2 = merchantrecipe.result();
|
||||
ItemStack itemstack = merchantrecipe.getItemToBuy();
|
||||
ItemStack itemstack1 = merchantrecipe.getSecondItemToBuy();
|
||||
ItemStack itemstack2 = merchantrecipe.getItemToSell();
|
||||
this.renderItemOverlayIntoGUI(itemstack, 36, 24, null);
|
||||
if(itemstack1 != null)
|
||||
this.renderItemOverlayIntoGUI(itemstack1, 62, 24, null);
|
||||
|
@ -180,9 +180,9 @@ public class GuiMerchant extends GuiContainer
|
|||
// int j = (this.height - this.ySize) / 2;
|
||||
int k = this.selectedMerchantRecipe;
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
|
||||
ItemStack itemstack = merchantrecipe.first();
|
||||
ItemStack itemstack1 = merchantrecipe.second();
|
||||
ItemStack itemstack2 = merchantrecipe.result();
|
||||
ItemStack itemstack = merchantrecipe.getItemToBuy();
|
||||
ItemStack itemstack1 = merchantrecipe.getSecondItemToBuy();
|
||||
ItemStack itemstack2 = merchantrecipe.getItemToSell();
|
||||
GL11.glPushMatrix();
|
||||
ItemRenderer.enableGUIStandardItemLighting();
|
||||
GlState.disableLighting();
|
|
@ -68,7 +68,7 @@ public class GuiRepair extends GuiContainer implements ICrafting
|
|||
{
|
||||
int i = 8453920;
|
||||
boolean flag = true;
|
||||
String s = String.format("Manakosten: %d", this.anvil.maximumCost);
|
||||
String s = String.format("Erfahrungskosten: %d", this.anvil.maximumCost);
|
||||
|
||||
if (this.anvil.maximumCost >= 40) // && !this.gm.thePlayer.creative)
|
||||
{
|
|
@ -17,7 +17,7 @@ public class Dropdown<T> extends Element {
|
|||
for(T value : Dropdown.this.values) {
|
||||
if(sb.length() > 0)
|
||||
sb.append('\n');
|
||||
sb.append(value instanceof Displayable disp ? disp.getDisplay() : value.toString());
|
||||
sb.append(value instanceof Displayable ? ((Displayable)value).getDisplay() : value.toString());
|
||||
}
|
||||
this.setText(sb.toString());
|
||||
this.visible = /* this.r_dirty = */ false;
|
||||
|
@ -82,15 +82,10 @@ public class Dropdown<T> extends Element {
|
|||
}
|
||||
|
||||
public Dropdown(int x, int y, int w, int h, boolean up, T[] values, T def, T init, DropdownCallback<T> callback, final String text) {
|
||||
this(x, y, w, h, up, values, def, init, callback, text == null ? new Formatter<Dropdown<T>>() {
|
||||
this(x, y, w, h, up, values, def, init, callback, new Formatter<Dropdown<T>>() {
|
||||
public String use(Dropdown<T> elem) {
|
||||
T value = elem.getValue();
|
||||
return value instanceof Displayable disp ? disp.getDisplay() : value.toString();
|
||||
}
|
||||
} : new Formatter<Dropdown<T>>() {
|
||||
public String use(Dropdown<T> elem) {
|
||||
T value = elem.getValue();
|
||||
return String.format("%s: %s", text, value instanceof Displayable disp ? disp.getDisplay() : value.toString());
|
||||
return String.format("%s: %s", text, value instanceof Displayable ? ((Displayable)value).getDisplay() : value.toString());
|
||||
}
|
||||
});
|
||||
}
|
|
@ -15,8 +15,6 @@ import common.sound.PositionedSound;
|
|||
import common.util.Util;
|
||||
|
||||
public abstract class Element {
|
||||
public static final int BASE_HEIGHT = 18;
|
||||
|
||||
protected final Client gm = Client.CLIENT;
|
||||
|
||||
protected Gui gui;
|
||||
|
@ -38,11 +36,12 @@ public abstract class Element {
|
|||
public boolean visible = true;
|
||||
public boolean enabled = true;
|
||||
|
||||
|
||||
public Element(int x, int y, int w, int h, Formatter formatter) {
|
||||
this.pos_x = x;
|
||||
this.pos_y = y;
|
||||
this.size_x = w;
|
||||
this.size_y = h <= 0 ? BASE_HEIGHT : h;
|
||||
this.size_y = h;
|
||||
this.format = formatter;
|
||||
// gui_update_style(this, 1);
|
||||
// if(type != ElemType.SLIDER) {
|
||||
|
@ -113,8 +112,8 @@ public abstract class Element {
|
|||
|
||||
public void updateText() {
|
||||
Vec2i size = Drawing.getSize(this.text);
|
||||
this.text_x = ((this.size_x - (this.margin_x1 + this.margin_x2)) - size.xpos) / 2;
|
||||
this.text_y = ((this.size_y - (this.margin_y1 + this.margin_y2)) - size.ypos + 1) / 2;
|
||||
this.text_x = (this.size_x - size.xpos) / 2;
|
||||
this.text_y = (this.size_y - size.ypos) / 2;
|
||||
}
|
||||
|
||||
public void setText(String str) {
|
||||
|
@ -221,7 +220,7 @@ public abstract class Element {
|
|||
int x2 = this.size_x - (this.margin_x1 + this.margin_x2);
|
||||
int y2 = this.size_y - (this.margin_y1 + this.margin_y2);
|
||||
// if(elem.type == ElemType.FIELD) {
|
||||
this.gm.scissor(x1 < 0 ? 0 : x1, (this.gm.fb_y - (y1 + y2)) < 0 ? 0 : (this.gm.fb_y - (y1 + y2)), x2 < 0 ? 0 : x2, y2 < 0 ? 0 : y2);
|
||||
GL11.glScissor(x1 < 0 ? 0 : x1, (this.gm.fb_y - (y1 + y2)) < 0 ? 0 : (this.gm.fb_y - (y1 + y2)), x2 < 0 ? 0 : x2, y2 < 0 ? 0 : y2);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
// }
|
||||
// if(this.type == ElemType.CUSTOM)
|
|
@ -34,7 +34,7 @@ public class Field extends Textbox {
|
|||
public void updateText() {
|
||||
this.textWidth = Drawing.txt_size(this.pos_x + this.margin_x1, this.pos_y + this.margin_y1,
|
||||
this.pos_x + this.margin_x1, this.pos_y + this.margin_y1,
|
||||
Integer.MAX_VALUE, Integer.MAX_VALUE, this.getDrawnText()).xpos;
|
||||
Integer.MAX_VALUE, Integer.MAX_VALUE, this.text).xpos;
|
||||
}
|
||||
|
||||
public void mouserel() {
|
||||
|
@ -95,7 +95,7 @@ public class Field extends Textbox {
|
|||
|
||||
protected void updateCursor(int offset, boolean shift, int x1, int y1, int x2, int y2) {
|
||||
Vec2i coord = Drawing.txt_coord(offset, x1 + this.text_x, y1 + this.text_y,
|
||||
x1 + this.text_x, y1 + this.text_y, 0x7fffffff, 0x7fffffff, this.getDrawnText());
|
||||
x1 + this.text_x, y1 + this.text_y, 0x7fffffff, 0x7fffffff, this.text);
|
||||
this.cursorPos = coord.xpos;
|
||||
if(shift) {
|
||||
if(this.cursorPos < x1)
|
||||
|
@ -108,7 +108,7 @@ public class Field extends Textbox {
|
|||
|
||||
protected int onCursorOffset(int x, int y, int x1, int y1, int x2, int y2) {
|
||||
Offset off = Drawing.txt_offset(x, y, x1 + this.text_x, y1 + this.text_y,
|
||||
x1 + this.text_x, y1 + this.text_y, 0x7fffffff, 0x7fffffff, this.getDrawnText());
|
||||
x1 + this.text_x, y1 + this.text_y, 0x7fffffff, 0x7fffffff, this.text);
|
||||
if(off != null) {
|
||||
this.cursorPos = off.xpos;
|
||||
}
|
||||
|
@ -130,21 +130,17 @@ public class Field extends Textbox {
|
|||
protected void drawForeground(int x1, int y1, int x2, int y2) {
|
||||
Drawing.txt_draw(x1 + this.text_x, y1 + this.text_y,
|
||||
x1 + this.text_x, y1 + this.text_y,
|
||||
Integer.MAX_VALUE, Integer.MAX_VALUE, this.enabled ? this.gm.style.text_field : Util.mulColor(this.gm.style.text_field, 0.5f), this.getDrawnText());
|
||||
Integer.MAX_VALUE, Integer.MAX_VALUE, this.enabled ? this.gm.style.text_field : Util.mulColor(this.gm.style.text_field, 0.5f), this.text);
|
||||
if(this.sel_start >= 0 && this.sel_end != this.sel_start)
|
||||
Drawing.txt_overlay(this.sel_start, this.sel_end, x1 + this.text_x, y1 + this.text_y,
|
||||
x1 + this.text_x, y1 + this.text_y,
|
||||
Integer.MAX_VALUE, Integer.MAX_VALUE, this.enabled ? 0x808080ff : 0x80404040, this.getDrawnText());
|
||||
Integer.MAX_VALUE, Integer.MAX_VALUE, this.enabled ? 0x808080ff : 0x80404040, this.text);
|
||||
}
|
||||
|
||||
protected char getNewline() {
|
||||
return ' ';
|
||||
}
|
||||
|
||||
protected String getDrawnText() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -50,8 +50,8 @@ public class Fill extends Element {
|
|||
public void updateText() {
|
||||
Vec2i size = Drawing.getSize(this.text);
|
||||
if(!this.left)
|
||||
this.text_x = ((this.size_x - (this.margin_x1 + this.margin_x2)) - size.xpos) / 2;
|
||||
this.text_x = (this.size_x - size.xpos) / 2;
|
||||
if(!this.top)
|
||||
this.text_y = ((this.size_y - (this.margin_y1 + this.margin_y2)) - size.ypos + 1) / 2;
|
||||
this.text_y = (this.size_y - size.ypos) / 2;
|
||||
}
|
||||
}
|
413
client/src/client/gui/element/GuiList.java
Executable file
413
client/src/client/gui/element/GuiList.java
Executable file
|
@ -0,0 +1,413 @@
|
|||
package client.gui.element;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import client.gui.Gui;
|
||||
import client.renderer.DefaultVertexFormats;
|
||||
import client.renderer.Drawing;
|
||||
import client.renderer.GlState;
|
||||
import client.renderer.RenderBuffer;
|
||||
import client.renderer.Tessellator;
|
||||
import client.window.Button;
|
||||
import common.collect.Lists;
|
||||
import common.util.ExtMath;
|
||||
|
||||
public abstract class GuiList<T extends ListEntry> extends Gui
|
||||
{
|
||||
protected final List<T> elements = Lists.newArrayList();
|
||||
|
||||
protected int width;
|
||||
protected int height;
|
||||
|
||||
protected int top;
|
||||
protected int bottom;
|
||||
protected int right;
|
||||
protected int left;
|
||||
protected int mouseX;
|
||||
protected int mouseY;
|
||||
protected int initialClickY = -2;
|
||||
protected float scrollMultiplier;
|
||||
protected float amountScrolled;
|
||||
protected int selectedElement = -1;
|
||||
protected long lastClicked;
|
||||
|
||||
public abstract int getListWidth(); // 220
|
||||
|
||||
public abstract int getSlotHeight();
|
||||
|
||||
protected int getScrollBarX()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setDimensions(int widthIn, int heightIn, int topIn, int bottomIn)
|
||||
{
|
||||
this.width = widthIn;
|
||||
this.height = heightIn;
|
||||
this.top = topIn;
|
||||
this.bottom = bottomIn;
|
||||
this.left = 0;
|
||||
this.right = widthIn;
|
||||
}
|
||||
|
||||
public void init(int width, int height) {
|
||||
|
||||
this.selectedElement = -1;
|
||||
}
|
||||
|
||||
public void setSlotXBoundsFromLeft(int leftIn)
|
||||
{
|
||||
this.left = leftIn;
|
||||
this.right = leftIn + this.width;
|
||||
}
|
||||
|
||||
public final T getListEntry(int index) {
|
||||
return this.elements.get(index);
|
||||
}
|
||||
|
||||
public final T getSelected() {
|
||||
return this.selectedElement < 0 ? null : this.elements.get(this.selectedElement);
|
||||
}
|
||||
|
||||
public final int getSize() {
|
||||
return this.elements.size();
|
||||
}
|
||||
|
||||
public final void setSelected(int index) {
|
||||
this.selectedElement = index;
|
||||
}
|
||||
|
||||
protected int getContentHeight()
|
||||
{
|
||||
return this.getSize() * this.getSlotHeight();
|
||||
}
|
||||
|
||||
public int getSlotIndexFromScreenCoords(int x, int y)
|
||||
{
|
||||
int i = this.left + this.width / 2 - this.getListWidth() / 2;
|
||||
int j = this.left + this.width / 2 + this.getListWidth() / 2;
|
||||
int k = y - this.top + (int)this.amountScrolled - 4;
|
||||
int l = k / this.getSlotHeight();
|
||||
return this.isInList(x, y) && x >= i && x <= j && l >= 0 && k >= 0 && l < this.getSize() ? l : -1;
|
||||
}
|
||||
|
||||
protected boolean isInList(int x, int y)
|
||||
{
|
||||
return x >= this.getScrollBarX() + 6; // x < this.getScrollBarX();
|
||||
}
|
||||
|
||||
protected final boolean isSelected(int slotIndex)
|
||||
{
|
||||
return slotIndex == this.selectedElement;
|
||||
}
|
||||
|
||||
protected void bindAmountScrolled()
|
||||
{
|
||||
this.amountScrolled = ExtMath.clampf(this.amountScrolled, 0.0F, (float)this.getMaxScroll());
|
||||
}
|
||||
|
||||
public int getMaxScroll()
|
||||
{
|
||||
return Math.max(0, this.getContentHeight() - (this.bottom - this.top - 4));
|
||||
}
|
||||
|
||||
public int getAmountScrolled()
|
||||
{
|
||||
return (int)this.amountScrolled;
|
||||
}
|
||||
|
||||
public boolean isMouseYWithinSlotBounds(int p_148141_1_)
|
||||
{
|
||||
return p_148141_1_ >= this.top && p_148141_1_ <= this.bottom && this.mouseX >= this.left && this.mouseX <= this.right;
|
||||
}
|
||||
|
||||
public void scrollBy(int amount)
|
||||
{
|
||||
this.amountScrolled += (float)amount;
|
||||
this.bindAmountScrolled();
|
||||
this.initialClickY = -2;
|
||||
}
|
||||
|
||||
// public void actionPerformed(Button button)
|
||||
// {
|
||||
// if (button.enabled)
|
||||
// {
|
||||
// if (button.id == this.scrollUpButtonID)
|
||||
// {
|
||||
// this.amountScrolled -= (float)(this.slotHeight * 2 / 3);
|
||||
// this.initialClickY = -2;
|
||||
// this.bindAmountScrolled();
|
||||
// }
|
||||
// else if (button.id == this.scrollDownButtonID)
|
||||
// {
|
||||
// this.amountScrolled += (float)(this.slotHeight * 2 / 3);
|
||||
// this.initialClickY = -2;
|
||||
// this.bindAmountScrolled();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
public void draw()
|
||||
{
|
||||
int mouseXIn = this.gm.mouse_x;
|
||||
int mouseYIn = this.gm.mouse_y;
|
||||
this.mouseX = mouseXIn;
|
||||
this.mouseY = mouseYIn;
|
||||
this.drawBackground();
|
||||
int i = this.getScrollBarX();
|
||||
int j = i + 6;
|
||||
this.bindAmountScrolled();
|
||||
GlState.disableLighting();
|
||||
GlState.disableFog();
|
||||
GlState.enableTexture2D();
|
||||
RenderBuffer worldrenderer = Tessellator.getBuffer();
|
||||
this.gm.getTextureManager().bindTexture(Gui.DIRT_BACKGROUND);
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
float f = 32.0F;
|
||||
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
worldrenderer.pos((double)0, (double)this.bottom, 0.0D).tex((double)((float)0 / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
|
||||
worldrenderer.pos((double)this.gm.fb_x, (double)this.bottom, 0.0D).tex((double)((float)this.gm.fb_x / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
|
||||
worldrenderer.pos((double)this.gm.fb_x, (double)this.top, 0.0D).tex((double)((float)this.gm.fb_x / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
|
||||
worldrenderer.pos((double)0, (double)this.top, 0.0D).tex((double)((float)0 / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
|
||||
Tessellator.draw();
|
||||
|
||||
int x = this.left + this.width / 2 - this.getListWidth() / 2 + 2;
|
||||
int y = this.top + 4 - (int)this.amountScrolled;
|
||||
|
||||
this.drawSelectionBox(x, y, mouseXIn, mouseYIn);
|
||||
GlState.disableDepth();
|
||||
|
||||
this.overlayBackground(0, this.top, 255, 255);
|
||||
this.overlayBackground(this.bottom, this.height, 255, 255);
|
||||
|
||||
GlState.enableBlend();
|
||||
GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ZERO, GL11.GL_ONE);
|
||||
GlState.disableAlpha();
|
||||
GlState.shadeModel(GL11.GL_SMOOTH);
|
||||
GlState.disableTexture2D();
|
||||
|
||||
int i1 = 4;
|
||||
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
worldrenderer.pos((double)0, (double)(this.top + i1), 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 0).endVertex();
|
||||
worldrenderer.pos((double)this.gm.fb_x, (double)(this.top + i1), 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 0).endVertex();
|
||||
worldrenderer.pos((double)this.gm.fb_x, (double)this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
|
||||
worldrenderer.pos((double)0, (double)this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
|
||||
Tessellator.draw();
|
||||
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
worldrenderer.pos((double)0, (double)this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
|
||||
worldrenderer.pos((double)this.gm.fb_x, (double)this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
|
||||
worldrenderer.pos((double)this.gm.fb_x, (double)(this.bottom - i1), 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 0).endVertex();
|
||||
worldrenderer.pos((double)0, (double)(this.bottom - i1), 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 0).endVertex();
|
||||
Tessellator.draw();
|
||||
|
||||
int j1 = this.getMaxScroll();
|
||||
|
||||
if (j1 > 0)
|
||||
{
|
||||
int k1 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight();
|
||||
k1 = ExtMath.clampi(k1, 32, this.bottom - this.top - 8);
|
||||
int l1 = (int)this.amountScrolled * (this.bottom - this.top - k1) / j1 + this.top;
|
||||
|
||||
if (l1 < this.top)
|
||||
{
|
||||
l1 = this.top;
|
||||
}
|
||||
|
||||
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
worldrenderer.pos((double)i, (double)this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
|
||||
worldrenderer.pos((double)j, (double)this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
|
||||
worldrenderer.pos((double)j, (double)this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
|
||||
worldrenderer.pos((double)i, (double)this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
|
||||
Tessellator.draw();
|
||||
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
worldrenderer.pos((double)i, (double)(l1 + k1), 0.0D).tex(0.0D, 1.0D).color(128, 128, 128, 255).endVertex();
|
||||
worldrenderer.pos((double)j, (double)(l1 + k1), 0.0D).tex(1.0D, 1.0D).color(128, 128, 128, 255).endVertex();
|
||||
worldrenderer.pos((double)j, (double)l1, 0.0D).tex(1.0D, 0.0D).color(128, 128, 128, 255).endVertex();
|
||||
worldrenderer.pos((double)i, (double)l1, 0.0D).tex(0.0D, 0.0D).color(128, 128, 128, 255).endVertex();
|
||||
Tessellator.draw();
|
||||
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
worldrenderer.pos((double)i, (double)(l1 + k1 - 1), 0.0D).tex(0.0D, 1.0D).color(192, 192, 192, 255).endVertex();
|
||||
worldrenderer.pos((double)(j - 1), (double)(l1 + k1 - 1), 0.0D).tex(1.0D, 1.0D).color(192, 192, 192, 255).endVertex();
|
||||
worldrenderer.pos((double)(j - 1), (double)l1, 0.0D).tex(1.0D, 0.0D).color(192, 192, 192, 255).endVertex();
|
||||
worldrenderer.pos((double)i, (double)l1, 0.0D).tex(0.0D, 0.0D).color(192, 192, 192, 255).endVertex();
|
||||
Tessellator.draw();
|
||||
}
|
||||
|
||||
GlState.enableTexture2D();
|
||||
GlState.shadeModel(GL11.GL_FLAT);
|
||||
GlState.enableAlpha();
|
||||
GlState.disableBlend();
|
||||
|
||||
super.draw();
|
||||
}
|
||||
|
||||
public void handleMouseInput()
|
||||
{
|
||||
if (this.isMouseYWithinSlotBounds(this.mouseY))
|
||||
{
|
||||
// if (Button.MOUSE_LEFT.isDown() && this.getEnabled())
|
||||
// {
|
||||
if (this.initialClickY == -1)
|
||||
{
|
||||
boolean flag1 = true;
|
||||
|
||||
if (this.mouseY >= this.top && this.mouseY <= this.bottom)
|
||||
{
|
||||
int j2 = (this.width - this.getListWidth()) / 2;
|
||||
int k2 = (this.width + this.getListWidth()) / 2;
|
||||
int l2 = this.mouseY - this.top + (int)this.amountScrolled - 4;
|
||||
int i1 = l2 / this.getSlotHeight();
|
||||
|
||||
if (i1 < this.getSize() && this.mouseX >= j2 && this.mouseX <= k2 && i1 >= 0 && l2 >= 0)
|
||||
{
|
||||
}
|
||||
else if (this.mouseX >= j2 && this.mouseX <= k2 && l2 < 0)
|
||||
{
|
||||
flag1 = false;
|
||||
}
|
||||
|
||||
int i3 = this.getScrollBarX();
|
||||
int j1 = i3 + 6;
|
||||
|
||||
if (this.mouseX >= i3 && this.mouseX <= j1)
|
||||
{
|
||||
this.scrollMultiplier = -1.0F;
|
||||
int k1 = this.getMaxScroll();
|
||||
|
||||
if (k1 < 1)
|
||||
{
|
||||
k1 = 1;
|
||||
}
|
||||
|
||||
int l1 = (int)((float)((this.bottom - this.top) * (this.bottom - this.top)) / (float)this.getContentHeight());
|
||||
l1 = ExtMath.clampi(l1, 32, this.bottom - this.top - 8);
|
||||
this.scrollMultiplier /= (float)(this.bottom - this.top - l1) / (float)k1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.scrollMultiplier = 1.0F;
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
this.initialClickY = this.mouseY;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.initialClickY = -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.initialClickY = -2;
|
||||
}
|
||||
}
|
||||
else if (this.initialClickY >= 0)
|
||||
{
|
||||
this.amountScrolled -= (float)(this.mouseY - this.initialClickY) * this.scrollMultiplier;
|
||||
this.initialClickY = this.mouseY;
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.initialClickY = -1;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawSelectionBox(int x, int y, int mouseXIn, int mouseYIn)
|
||||
{
|
||||
int size = this.getSize();
|
||||
RenderBuffer rb = Tessellator.getBuffer();
|
||||
|
||||
for (int z = 0; z < size; z++)
|
||||
{
|
||||
int y1 = y + z * this.getSlotHeight();
|
||||
int h = this.getSlotHeight() - 4;
|
||||
|
||||
if (this.isSelected(z))
|
||||
{
|
||||
int x1 = this.left + (this.width / 2 - this.getListWidth() / 2);
|
||||
int x2 = this.left + this.width / 2 + this.getListWidth() / 2;
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlState.disableTexture2D();
|
||||
rb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
rb.pos((double)x1, (double)(y1 + h + 2), 0.0D).tex(0.0D, 1.0D).color(128, 128, 128, 255).endVertex();
|
||||
rb.pos((double)x2, (double)(y1 + h + 2), 0.0D).tex(1.0D, 1.0D).color(128, 128, 128, 255).endVertex();
|
||||
rb.pos((double)x2, (double)(y1 - 2), 0.0D).tex(1.0D, 0.0D).color(128, 128, 128, 255).endVertex();
|
||||
rb.pos((double)x1, (double)(y1 - 2), 0.0D).tex(0.0D, 0.0D).color(128, 128, 128, 255).endVertex();
|
||||
rb.pos((double)(x1 + 1), (double)(y1 + h + 1), 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
|
||||
rb.pos((double)(x2 - 1), (double)(y1 + h + 1), 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
|
||||
rb.pos((double)(x2 - 1), (double)(y1 - 1), 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
|
||||
rb.pos((double)(x1 + 1), (double)(y1 - 1), 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
|
||||
Tessellator.draw();
|
||||
GlState.enableTexture2D();
|
||||
}
|
||||
|
||||
boolean hover = this.getSlotIndexFromScreenCoords(mouseXIn, mouseYIn) == z;
|
||||
this.getListEntry(z).draw(x, y1, mouseXIn - x, mouseYIn - y1, hover);
|
||||
if(hover)
|
||||
Drawing.drawRect(x - 2, y1 - 2, this.getListWidth(), this.getSlotHeight(), Gui.HOVER_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
protected void overlayBackground(int startY, int endY, int startAlpha, int endAlpha)
|
||||
{
|
||||
RenderBuffer rb = Tessellator.getBuffer();
|
||||
this.gm.getTextureManager().bindTexture(Gui.DIRT_BACKGROUND);
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
float f = 32.0F;
|
||||
rb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
rb.pos((double)0, (double)endY, 0.0D).tex(0.0D, (double)((float)endY / 32.0F)).color(64, 64, 64, endAlpha).endVertex();
|
||||
rb.pos((double)this.gm.fb_x, (double)endY, 0.0D).tex((double)((float)this.gm.fb_x / 32.0F), (double)((float)endY / 32.0F)).color(64, 64, 64, endAlpha).endVertex();
|
||||
rb.pos((double)this.gm.fb_x, (double)startY, 0.0D).tex((double)((float)this.gm.fb_x / 32.0F), (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex();
|
||||
rb.pos((double)0, (double)startY, 0.0D).tex(0.0D, (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex();
|
||||
Tessellator.draw();
|
||||
}
|
||||
|
||||
public void mouse(Button btn, int x, int y, boolean ctrl, boolean shift)
|
||||
{
|
||||
super.mouse(btn, x, y, ctrl, shift);
|
||||
if (this.isMouseYWithinSlotBounds(y))
|
||||
{
|
||||
int i = this.getSlotIndexFromScreenCoords(x, y);
|
||||
|
||||
if (i >= 0)
|
||||
{
|
||||
int j = this.left + this.width / 2 - this.getListWidth() / 2 + 2;
|
||||
int k = this.top + 4 - this.getAmountScrolled() + i * this.getSlotHeight();
|
||||
int l = x - j;
|
||||
int i1 = y - k;
|
||||
|
||||
boolean flag = i == this.selectedElement && System.currentTimeMillis() - this.lastClicked < (long)this.gm.dclickDelay;
|
||||
this.selectedElement = i;
|
||||
this.lastClicked = System.currentTimeMillis();
|
||||
|
||||
this.getListEntry(i).select(flag, l, i1);
|
||||
}
|
||||
}
|
||||
if(btn == Button.MOUSE_LEFT && this.clicked(x, y) == null)
|
||||
this.handleMouseInput();
|
||||
}
|
||||
|
||||
public void mouserel(Button btn, int x, int y) {
|
||||
super.mouserel(btn, x, y);
|
||||
if(btn == Button.MOUSE_LEFT)
|
||||
this.initialClickY = -1;
|
||||
}
|
||||
|
||||
public void scroll(int scr_x, int scr_y, int x, int y, boolean ctrl, boolean shift) {
|
||||
super.scroll(scr_x, scr_y, x, y, ctrl, shift);
|
||||
if(scr_y != 0 && this.clicked(x, y) == null)
|
||||
this.amountScrolled -= (float)(ExtMath.clampi(scr_y, -1, 1) * this.getSlotHeight() / 2);
|
||||
}
|
||||
|
||||
public void drag(int x, int y) {
|
||||
super.drag(x, y);
|
||||
if(this.selected == null && Button.MOUSE_LEFT.isDown())
|
||||
this.handleMouseInput();
|
||||
}
|
||||
}
|
|
@ -4,30 +4,16 @@ import client.renderer.Drawing;
|
|||
import common.util.Util;
|
||||
|
||||
public class Label extends Fill {
|
||||
public static final int LABEL_HEIGHT = 14;
|
||||
|
||||
public Label(int x, int y, int w, int h, String text, boolean top, boolean left) {
|
||||
super(x, y, w, h <= 0 ? LABEL_HEIGHT : h, text, top, left);
|
||||
super(x, y, w, h, text, top, left);
|
||||
}
|
||||
|
||||
public Label(int x, int y, int w, int h, String text, boolean left) {
|
||||
super(x, y, w, h <= 0 ? LABEL_HEIGHT : h, text, left);
|
||||
super(x, y, w, h, text, left);
|
||||
}
|
||||
|
||||
public Label(int x, int y, int w, int h, String text) {
|
||||
super(x, y, w, h <= 0 ? LABEL_HEIGHT : h, text);
|
||||
}
|
||||
|
||||
public Label(int x, int y, int w, String text, boolean top, boolean left) {
|
||||
super(x, y - LABEL_HEIGHT, w, LABEL_HEIGHT, text, top, left);
|
||||
}
|
||||
|
||||
public Label(int x, int y, int w, String text, boolean left) {
|
||||
super(x, y - LABEL_HEIGHT, w, LABEL_HEIGHT, text, left);
|
||||
}
|
||||
|
||||
public Label(int x, int y, int w, String text) {
|
||||
super(x, y - LABEL_HEIGHT, w, LABEL_HEIGHT, text);
|
||||
super(x, y, w, h, text);
|
||||
}
|
||||
|
||||
protected void drawBackground() {
|
|
@ -2,6 +2,6 @@ package client.gui.element;
|
|||
|
||||
public interface ListEntry
|
||||
{
|
||||
void draw(int x, int y, int width, int height, int mouseX, int mouseY, boolean hovered);
|
||||
void draw(int x, int y, int mouseX, int mouseY, boolean hovered);
|
||||
void select(boolean dclick, int mx, int my);
|
||||
}
|
20
client/src/client/gui/element/PasswordField.java
Normal file
20
client/src/client/gui/element/PasswordField.java
Normal file
|
@ -0,0 +1,20 @@
|
|||
package client.gui.element;
|
||||
|
||||
import client.renderer.Drawing;
|
||||
import common.util.Util;
|
||||
|
||||
public class PasswordField extends Field {
|
||||
public PasswordField(int x, int y, int w, int h, int cap, FieldCallback callback, String text) {
|
||||
super(x, y, w, h, cap, callback, text);
|
||||
}
|
||||
|
||||
protected void drawForeground(int x1, int y1, int x2, int y2) {
|
||||
Drawing.txt_draw(x1 + this.text_x, y1 + this.text_y,
|
||||
x1 + this.text_x, y1 + this.text_y,
|
||||
Integer.MAX_VALUE, Integer.MAX_VALUE, this.enabled ? this.gm.style.text_field : Util.mulColor(this.gm.style.text_field, 0.5f), this.text.isEmpty() ? "" : "****");
|
||||
}
|
||||
|
||||
protected int getCursorX(int x1, int x2) {
|
||||
return x1;
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@ import common.util.ExtMath;
|
|||
import common.util.Util;
|
||||
|
||||
public class Slider extends Element {
|
||||
private static final int SLIDER_WIDTH = 8;
|
||||
private static final int SLIDER_WIDTH = 10;
|
||||
|
||||
private final SliderCallback func;
|
||||
private final int def;
|
||||
|
@ -21,7 +21,7 @@ public class Slider extends Element {
|
|||
|
||||
public Slider(int x, int y, int w, int h, int prec, int min, int max, int def, int init, SliderCallback callback, Formatter<Slider> formatter) {
|
||||
super(x, y, w, h, formatter);
|
||||
this.handle = ((this.size_y * SLIDER_WIDTH) / BASE_HEIGHT) & ~1;
|
||||
this.handle = ((this.size_y * SLIDER_WIDTH) / 24) & ~1;
|
||||
this.func = callback;
|
||||
this.precision = prec;
|
||||
this.min = min;
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue