misc updates, remove mipmapping
This commit is contained in:
parent
88a6cbe826
commit
1ce918c0af
377 changed files with 2910 additions and 3223 deletions
|
@ -168,7 +168,7 @@ import common.sound.EventType;
|
|||
import common.sound.MovingSoundMinecart;
|
||||
import common.sound.PositionedSound;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.CharValidator;
|
||||
import common.util.ChunkPos;
|
||||
|
@ -176,13 +176,12 @@ import common.util.ExtMath;
|
|||
import common.util.HitPosition;
|
||||
import common.util.IntHashMap;
|
||||
import common.util.LongHashMap;
|
||||
import common.util.MutablePos;
|
||||
import common.util.ParticleType;
|
||||
import common.util.Color;
|
||||
import common.util.Displayable;
|
||||
import common.util.Util;
|
||||
import common.util.Var;
|
||||
import common.util.HitPosition.ObjectType;
|
||||
import common.util.Identifyable;
|
||||
import common.vars.Vars;
|
||||
import common.world.Chunk;
|
||||
import common.world.State;
|
||||
|
@ -211,28 +210,6 @@ import common.world.World;
|
|||
*/
|
||||
|
||||
public class Client implements IThreadListener {
|
||||
public static enum MipmapType implements Identifyable, Displayable {
|
||||
NONE("off", "Keine"),
|
||||
NEAREST("nearest", "Nächster nachbar"),
|
||||
LINEAR("linear", "Linear interpoliert");
|
||||
|
||||
private final String name;
|
||||
private final String display;
|
||||
|
||||
private MipmapType(String name, String display) {
|
||||
this.name = name;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getDisplay() {
|
||||
return this.display;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SyncFunction implements IntFunction {
|
||||
public void apply(IntVar cv, int value) {
|
||||
Client.CLIENT.sync(value);
|
||||
|
@ -312,12 +289,6 @@ public class Client implements IThreadListener {
|
|||
}
|
||||
}
|
||||
|
||||
public static class MipmapFunction implements EnumFunction<MipmapType> {
|
||||
public void apply(EnumVar cv, MipmapType value) {
|
||||
Client.CLIENT.updateTexture();
|
||||
}
|
||||
}
|
||||
|
||||
public static class LightFunction implements FloatFunction {
|
||||
public void apply(FloatVar cv, float value) {
|
||||
Client.CLIENT.renderer.loadRenderers();
|
||||
|
@ -366,11 +337,11 @@ public class Client implements IThreadListener {
|
|||
return Client.this.getChunk(x, z);
|
||||
}
|
||||
|
||||
public Chunk getChunk(BlockPos pos) {
|
||||
public Chunk getChunk(LocalPos pos) {
|
||||
return Client.this.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
|
||||
}
|
||||
|
||||
protected float getTemperature(BlockPos pos) {
|
||||
protected float getTemperature(LocalPos pos) {
|
||||
if(!isValid(pos))
|
||||
return 0.0f;
|
||||
ChunkClient chunk = Client.this.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
|
||||
|
@ -385,19 +356,19 @@ public class Client implements IThreadListener {
|
|||
Client.this.effectRenderer.spawnParticle(Client.this.getRenderViewEntity(), particle, xCoord, yCoord, zCoord, data);
|
||||
}
|
||||
|
||||
public void playEffect(EntityNPC player, int sfxType, BlockPos blockPosIn, int data) {
|
||||
public void playEffect(EntityNPC player, int sfxType, LocalPos blockPosIn, int data) {
|
||||
if(Client.this.getNetHandler() != null)
|
||||
Client.this.getNetHandler().playAuxSFX(sfxType, blockPosIn, data);
|
||||
}
|
||||
|
||||
public void markBlockForUpdate(BlockPos pos) {
|
||||
public void markBlockForUpdate(LocalPos pos) {
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
Client.this.renderer.markUpdate(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1);
|
||||
}
|
||||
|
||||
public void clientNotifyLight(BlockPos pos) {
|
||||
public void clientNotifyLight(LocalPos pos) {
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
|
@ -412,15 +383,15 @@ public class Client implements IThreadListener {
|
|||
Client.this.renderer.setLastLightning(last, color);
|
||||
}
|
||||
|
||||
public void checkBlockLight(BlockPos pos) {
|
||||
public void checkBlockLight(LocalPos pos) {
|
||||
Client.this.renderer.checkBlockLight(pos);
|
||||
}
|
||||
|
||||
public int getCombinedLight(BlockPos pos) {
|
||||
public int getCombinedLight(LocalPos pos) {
|
||||
return Client.this.renderer.getCombinedLight(pos);
|
||||
}
|
||||
|
||||
public int getCombinedBrightness(BlockPos pos) {
|
||||
public int getCombinedBrightness(LocalPos pos) {
|
||||
return Client.this.renderer.getCombinedBrightness(pos);
|
||||
}
|
||||
}
|
||||
|
@ -492,7 +463,6 @@ public class Client implements IThreadListener {
|
|||
public boolean freecam;
|
||||
public boolean servercam;
|
||||
public boolean shaders;
|
||||
public boolean mipmaps;
|
||||
|
||||
private int leftClickCounter;
|
||||
private int rightClickTimer;
|
||||
|
@ -574,7 +544,7 @@ public class Client implements IThreadListener {
|
|||
public World world;
|
||||
public EntityNPC player;
|
||||
public HitPosition pointed;
|
||||
public BlockPos pointedLiquid;
|
||||
public LocalPos pointedLiquid;
|
||||
public DisplayMode vidMode;
|
||||
public String dimensionName;
|
||||
private ChunkClient emptyChunk;
|
||||
|
@ -594,9 +564,9 @@ public class Client implements IThreadListener {
|
|||
private int lightUpdates = 2048;
|
||||
@Variable(name = "chunk_light_range", category = CVarCategory.RENDER, min = 5, max = 1024, display = "Radius Licht-Updates")
|
||||
private int lightRange = 32;
|
||||
@Variable(name = "gl_fov", category = CVarCategory.RENDER, min = 1.0f, max = 179.0f, display = "Sichtfeld (FOV)", unit = "°", precision = 1)
|
||||
@Variable(name = "draw_fov", category = CVarCategory.RENDER, min = 1.0f, max = 179.0f, display = "Sichtfeld (FOV)", unit = "°", precision = 1)
|
||||
public float fov = 70.0f;
|
||||
@Variable(name = "gl_wireframe", category = CVarCategory.RENDER, display = "Gitter-Render-Modus")
|
||||
@Variable(name = "draw_wireframe", category = CVarCategory.RENDER, display = "Gitter-Render-Modus")
|
||||
private boolean wireframe = false;
|
||||
|
||||
@Variable(name = "con_timestamps", category = CVarCategory.CONSOLE, display = "Zeiten")
|
||||
|
@ -623,7 +593,7 @@ public class Client implements IThreadListener {
|
|||
@Variable(name = "gui_scale_hotbar", category = CVarCategory.GUI, display = "Leiste vergrößern")
|
||||
public boolean scaleHotbar = false;
|
||||
@Variable(name = "hud_margin", category = CVarCategory.GUI, min = 0, max = 120, unit = "px", display = "Seitenabstand der HUD")
|
||||
private int hudMargin = 8;
|
||||
private int hudMargin = 4;
|
||||
@Variable(name = "phy_sensitivity", category = CVarCategory.INPUT, min = 0.01f, max = 10.0f, display = "Mausempfindlichkeit", precision = 2, unit = "%")
|
||||
private float sensitivity = 1.0f;
|
||||
@Variable(name = "gui_dclick_delay", category = CVarCategory.INPUT, min = 150, max = 750, display = "Doppelklick bei", unit = "ms")
|
||||
|
@ -644,7 +614,7 @@ public class Client implements IThreadListener {
|
|||
private boolean chatPermanent = false;
|
||||
@Variable(name = "overlay_opacity", category = CVarCategory.CONSOLE, min = 0x00, max = 0xff, display = "Deckkraft Hintergrund")
|
||||
private int hudOpacity = 0x40;
|
||||
@Variable(name = "gl_vsync_flush", category = CVarCategory.RENDER, display = "Puffer leeren")
|
||||
@Variable(name = "vsync_flush", category = CVarCategory.RENDER, display = "Puffer leeren")
|
||||
private boolean glFlush = false;
|
||||
@Variable(name = "con_autoclose", category = CVarCategory.CONSOLE, display = "Schließen")
|
||||
public boolean conAutoclose = true;
|
||||
|
@ -709,9 +679,7 @@ public class Client implements IThreadListener {
|
|||
@Variable(name = "mid_visualizer", category = CVarCategory.SOUND, display = "Visualisation")
|
||||
public boolean midiVisualizer = true;
|
||||
|
||||
@Variable(name = "gl_tex_mipmaps", category = CVarCategory.RENDER, display = "Mipmaps", callback = MipmapFunction.class)
|
||||
private MipmapType mipmapType = MipmapType.NONE;
|
||||
@Variable(name = "gl_use_shader", category = CVarCategory.RENDER, display = "Shader verwenden")
|
||||
@Variable(name = "draw_use_shader", category = CVarCategory.RENDER, display = "Shader verwenden")
|
||||
public boolean useShader = false;
|
||||
|
||||
public static final Client CLIENT = new Client();
|
||||
|
@ -856,7 +824,8 @@ public class Client implements IThreadListener {
|
|||
this.renderItem.onReload();
|
||||
this.renderer.cacheSprites();
|
||||
EntityTexManager.loadNpcTextures();
|
||||
this.updateTexture();
|
||||
this.textureManager.bindTexture(TextureMap.BLOCKS);
|
||||
TextureUtil.setParams();
|
||||
this.renderer.loadRenderers();
|
||||
this.logFeed("Texturen wurden neu geladen");
|
||||
}
|
||||
|
@ -868,7 +837,6 @@ public class Client implements IThreadListener {
|
|||
this.soundManager = new SoundManager(this);
|
||||
Log.RENDER.debug("Maximale Texturgröße: %d", GL15.glGetInteger(GL15.GL_MAX_TEXTURE_SIZE));
|
||||
Log.RENDER.debug("Shader verfügbar: %s", (this.shaders = GL.getCapabilities().OpenGL20) ? "Ja (OpenGL 2.0+)" : "Nein (OpenGL 1.5)");
|
||||
Log.RENDER.debug("Mipmaps verfügbar: %s", (this.mipmaps = GL.getCapabilities().OpenGL30) ? "Ja (OpenGL 3.0+)" : "Nein (OpenGL 1.5-2.1)");
|
||||
GlState.enableTexture2D();
|
||||
GlState.shadeModel(GL15.GL_SMOOTH);
|
||||
GL15.glClearDepth(1.0D);
|
||||
|
@ -883,7 +851,8 @@ public class Client implements IThreadListener {
|
|||
GL15.glMatrixMode(GL15.GL_MODELVIEW);
|
||||
this.textureMap = new TextureMap();
|
||||
this.textureManager.loadTexture(TextureMap.BLOCKS, this.textureMap);
|
||||
this.updateTexture();
|
||||
this.textureManager.bindTexture(TextureMap.BLOCKS);
|
||||
TextureUtil.setParams();
|
||||
this.modelManager = new ModelManager(this.textureMap);
|
||||
this.modelManager.onReload();
|
||||
this.renderItem = new RenderItem(this.textureManager, this.modelManager);
|
||||
|
@ -1009,7 +978,7 @@ public class Client implements IThreadListener {
|
|||
{
|
||||
this.controller.update();
|
||||
}
|
||||
this.textureMap.update(this.mipmaps && this.mipmapType != MipmapType.NONE);
|
||||
this.textureMap.update();
|
||||
if (this.open != null)
|
||||
{
|
||||
this.open.updateScreen();
|
||||
|
@ -1296,7 +1265,7 @@ public class Client implements IThreadListener {
|
|||
int color = 0x000000;
|
||||
float bar = -1.0f;
|
||||
if((this.pointed != null && this.pointed.type == ObjectType.BLOCK && this.pointed.block != null) || this.pointedLiquid != null) {
|
||||
BlockPos pos = this.pointedLiquid != null ? this.pointedLiquid : this.pointed.block;
|
||||
LocalPos pos = this.pointedLiquid != null ? this.pointedLiquid : this.pointed.block;
|
||||
State state = this.world.getState(pos);
|
||||
Block block = state.getBlock();
|
||||
if(this.pointedLiquid != null ? block.getMaterial().isLiquid() : block != Blocks.air) {
|
||||
|
@ -1576,7 +1545,7 @@ public class Client implements IThreadListener {
|
|||
{
|
||||
if (leftClick && this.pointed != null && this.pointed.type == HitPosition.ObjectType.BLOCK)
|
||||
{
|
||||
BlockPos blockpos = this.pointed.block;
|
||||
LocalPos blockpos = this.pointed.block;
|
||||
|
||||
if (this.world.getState(blockpos).getBlock() != Blocks.air && this.controller.damageBlock(blockpos, this.pointed.side))
|
||||
{
|
||||
|
@ -1622,7 +1591,7 @@ public class Client implements IThreadListener {
|
|||
break;
|
||||
case BLOCK:
|
||||
this.player.swingItem();
|
||||
BlockPos blockpos = this.pointed.block;
|
||||
LocalPos blockpos = this.pointed.block;
|
||||
if (this.world.getState(blockpos).getBlock() != Blocks.air)
|
||||
{
|
||||
this.controller.clickBlock(blockpos, this.pointed.side);
|
||||
|
@ -1678,7 +1647,7 @@ public class Client implements IThreadListener {
|
|||
break;
|
||||
|
||||
case BLOCK:
|
||||
BlockPos blockpos = this.pointed.block;
|
||||
LocalPos blockpos = this.pointed.block;
|
||||
|
||||
if (this.world.getState(blockpos).getBlock() != Blocks.air)
|
||||
{
|
||||
|
@ -1987,7 +1956,7 @@ public class Client implements IThreadListener {
|
|||
if(this.world == null)
|
||||
return mem;
|
||||
|
||||
BlockPos pos = new BlockPos(this.viewEntity.posX, this.viewEntity.getEntityBoundingBox().minY, this.viewEntity.posZ);
|
||||
LocalPos pos = new LocalPos(this.viewEntity.posX, this.viewEntity.getEntityBoundingBox().minY, this.viewEntity.posZ);
|
||||
String dirStr;
|
||||
switch(this.viewEntity.getHorizontalFacing()) {
|
||||
case NORTH:
|
||||
|
@ -2059,7 +2028,7 @@ public class Client implements IThreadListener {
|
|||
;
|
||||
}
|
||||
|
||||
private String formatState(BlockPos pos, String desc) {
|
||||
private String formatState(LocalPos pos, String desc) {
|
||||
State block = this.world.getState(pos);
|
||||
|
||||
if(!this.debugWorld) {
|
||||
|
@ -2390,6 +2359,8 @@ public class Client implements IThreadListener {
|
|||
GlState.enableBlend();
|
||||
GlState.blendFunc(GL15.GL_SRC_ALPHA, GL15.GL_ONE_MINUS_SRC_ALPHA);
|
||||
this.initConsole();
|
||||
this.textureManager.bindTexture(TextureMap.BLOCKS);
|
||||
TextureUtil.setParams();
|
||||
if(this.shaders)
|
||||
ShaderContext.loadShaders();
|
||||
this.startSound(true);
|
||||
|
@ -3529,7 +3500,7 @@ public class Client implements IThreadListener {
|
|||
private void displayTick(int posX, int posY, int posZ) {
|
||||
int range = 16;
|
||||
Random rand = new Random();
|
||||
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
||||
MutablePos pos = new MutablePos();
|
||||
for(int n = 0; n < 1000; n++) {
|
||||
int x = posX + rand.zrange(range) - rand.zrange(range);
|
||||
int y = posY + rand.zrange(range) - rand.zrange(range);
|
||||
|
@ -3670,7 +3641,7 @@ public class Client implements IThreadListener {
|
|||
int x = ExtMath.floord(this.player.posX) + this.world.rand.range(-radius, radius);
|
||||
int y = ExtMath.floord(this.player.posY) + this.world.rand.range(-radius, radius);
|
||||
int z = ExtMath.floord(this.player.posZ) + this.world.rand.range(-radius, radius);
|
||||
this.world.checkBlockLight(new BlockPos(x, y, z));
|
||||
this.world.checkBlockLight(new LocalPos(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3850,11 +3821,6 @@ public class Client implements IThreadListener {
|
|||
public List<TileEntity> getTiles() {
|
||||
return this.tiles;
|
||||
}
|
||||
|
||||
public void updateTexture() {
|
||||
this.textureManager.bindTexture(TextureMap.BLOCKS);
|
||||
TextureUtil.setParams(this.mipmapType != MipmapType.NONE, this.mipmapType == MipmapType.LINEAR);
|
||||
}
|
||||
|
||||
private static byte[] genTriwave(int w, int h, int color1, int color2, int color3, int color4, int color5, int color6) {
|
||||
byte[] data = new byte[w * h * 4];
|
||||
|
|
|
@ -19,7 +19,7 @@ import client.window.Keysym;
|
|||
import common.collect.Lists;
|
||||
import common.network.IPlayer;
|
||||
import common.packet.CPacketComplete;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.HitPosition;
|
||||
import common.util.Color;
|
||||
|
@ -282,7 +282,7 @@ public class GuiConsole extends Gui implements FieldCallback {
|
|||
{
|
||||
if (currentText.length() >= 1)
|
||||
{
|
||||
BlockPos blockpos = null;
|
||||
LocalPos blockpos = null;
|
||||
int eid = -1;
|
||||
if (this.gm.pointed != null && this.gm.pointed.type == HitPosition.ObjectType.BLOCK)
|
||||
{
|
||||
|
@ -291,7 +291,7 @@ public class GuiConsole extends Gui implements FieldCallback {
|
|||
else if (this.gm.pointed != null && this.gm.pointed.type == HitPosition.ObjectType.ENTITY)
|
||||
{
|
||||
eid = this.gm.pointed.entity.getId();
|
||||
blockpos = new BlockPos(this.gm.pointed.entity);
|
||||
blockpos = new LocalPos(this.gm.pointed.entity);
|
||||
}
|
||||
if(currentText.startsWith("/")) {
|
||||
if(this.gm.player != null) {
|
||||
|
|
|
@ -3,14 +3,14 @@ package client.gui.container;
|
|||
import common.block.tech.BlockWorkbench;
|
||||
import common.inventory.ContainerWorkbench;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.world.World;
|
||||
|
||||
public class GuiCrafting extends GuiContainer {
|
||||
private final BlockWorkbench type;
|
||||
|
||||
public GuiCrafting(EntityNPC inv, World world, BlockWorkbench type) {
|
||||
super(new ContainerWorkbench(inv, world, BlockPos.ORIGIN, type));
|
||||
super(new ContainerWorkbench(inv, world, LocalPos.ORIGIN, type));
|
||||
this.type = type;
|
||||
this.ySize = 36 + 18 * ((inv.getInventoryCapacity() + 11) / 12) + 18 * this.type.getSize();
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ import client.gui.element.Field;
|
|||
import client.gui.element.FieldCallback;
|
||||
import client.network.ClientPlayer;
|
||||
import common.packet.CPacketSign;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
|
||||
public class GuiSign extends Gui implements FieldCallback {
|
||||
private final BlockPos position;
|
||||
private final LocalPos position;
|
||||
private final Field[] lines;
|
||||
private final String[] tempLines;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class GuiSign extends Gui implements FieldCallback {
|
|||
}
|
||||
}
|
||||
|
||||
public GuiSign(BlockPos sign, String[] lines) {
|
||||
public GuiSign(LocalPos sign, String[] lines) {
|
||||
this.position = sign;
|
||||
this.lines = new Field[lines.length];
|
||||
this.tempLines = new String[lines.length];
|
||||
|
|
|
@ -53,7 +53,7 @@ public class GuiBinds extends GuiOptions {
|
|||
}
|
||||
y += x != 0 ? 1 : 0;
|
||||
x = (150 * cols + 2 * (cols - 1) - 482) / 2;
|
||||
this.add(new ActButton(x, 96 + y * 34, 482, 0, new ButtonCallback() {
|
||||
this.add(new ActButton(x, 96 + y * 34, 240, 0, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
boolean flag = false;
|
||||
for(Bind bind : Bind.values()) {
|
||||
|
@ -65,9 +65,10 @@ public class GuiBinds extends GuiOptions {
|
|||
GuiBinds.this.reformat();
|
||||
}
|
||||
}
|
||||
}, "Zurücksetzen"));
|
||||
this.addSelector("phy_sensitivity", x, 116 + y * 34, 240, 0);
|
||||
this.addSelector("gui_dclick_delay", x + 242, 116 + y * 34, 240, 0);
|
||||
}, "Tasten zurücksetzen"));
|
||||
this.addSelector("phy_sensitivity", x + 242, 96 + y * 34, 240, 0);
|
||||
this.addSelector("gui_dclick_delay", x, 116 + y * 34, 240, 0);
|
||||
this.addSelector("gui_scroll_lines", x + 242, 116 + y * 34, 240, 0);
|
||||
super.init(width, height);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,119 +1,35 @@
|
|||
package client.gui.options;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import client.Client;
|
||||
import client.gui.Font;
|
||||
import client.gui.Formatter;
|
||||
import client.gui.element.Dropdown;
|
||||
import client.gui.element.DropdownCallback;
|
||||
import client.gui.element.Element;
|
||||
import client.gui.element.Fill;
|
||||
import client.gui.element.Slider;
|
||||
import client.gui.element.SliderCallback;
|
||||
import client.gui.element.Toggle;
|
||||
import client.gui.element.ToggleCallback;
|
||||
import client.window.Button;
|
||||
import client.window.DisplayMode;
|
||||
import client.window.Window;
|
||||
import common.collect.Lists;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Color;
|
||||
|
||||
public class GuiDisplay extends GuiOptions {
|
||||
private static final String[] DISTANCES = new String[] {"Gruselig", "Winzig", "Gering", "Normal", "Weit"};
|
||||
|
||||
private Element distanceSlider;
|
||||
|
||||
protected GuiDisplay() {
|
||||
}
|
||||
|
||||
public void init(int width, int height) {
|
||||
this.add(new Toggle(0, 0, 240, 0, false, GuiDisplay.this.gm.fullscreen, new ToggleCallback() {
|
||||
public void use(Toggle elem, boolean value) {
|
||||
GuiDisplay.this.gm.full(value);
|
||||
}
|
||||
}, "Vollbild"));
|
||||
int maxModes = ExtMath.clampi((height - ((3 * 20 + 2) * 2 + 18 + 4)) / Font.HEIGHT, 4, 28);
|
||||
DisplayMode[] dmodes = Window.getDisplayModes();
|
||||
if(dmodes != null) {
|
||||
List<DisplayMode> modes = Lists.newArrayList();
|
||||
for(int z = dmodes.length - 1; z >= 0 && modes.size() < maxModes; z--) {
|
||||
DisplayMode mode = dmodes[z];
|
||||
if(mode.width() >= Client.MIN_WIDTH && mode.height() >= Client.MIN_HEIGHT)
|
||||
modes.add(0, mode);
|
||||
}
|
||||
if(modes.isEmpty()) {
|
||||
dmodes = null;
|
||||
}
|
||||
else {
|
||||
DisplayMode selected = modes.get(modes.size() - 1);
|
||||
for(DisplayMode mode : modes) {
|
||||
if(mode.equals(this.gm.vidMode))
|
||||
selected = mode;
|
||||
}
|
||||
this.add(new Dropdown<DisplayMode>(242, 0, 240, 0, false, modes.toArray(new DisplayMode[modes.size()]), modes.get(modes.size() - 1), selected, new DropdownCallback<DisplayMode>() {
|
||||
public void use(Dropdown<DisplayMode> elem, DisplayMode value) {
|
||||
GuiDisplay.this.gm.vidMode = value;
|
||||
GuiDisplay.this.gm.full(true);
|
||||
}
|
||||
}, (String)null));
|
||||
}
|
||||
}
|
||||
if(dmodes == null)
|
||||
this.add(new Fill(242, 0, 240, 0, Color.RED + "<?>"));
|
||||
this.addSelector("overlay_enabled", 0, 0, 240, 0);
|
||||
this.addSelector("overlay_opacity", 242, 0, 240, 0);
|
||||
|
||||
this.addSelector("overlay_fadeout", 0, 20, 240, 0);
|
||||
this.addSelector("chat_permanent", 242, 20, 240, 0);
|
||||
|
||||
this.addSelector("console_size", 0, 40, 240, 0);
|
||||
this.addSelector("chat_size", 242, 40, 240, 0);
|
||||
|
||||
this.addSelector("feed_size", 0, 60, 240, 0);
|
||||
this.addSelector("hotbar_size", 242, 60, 240, 0);
|
||||
|
||||
this.addSelector("crosshair_simple", 0, 90, 240, 0);
|
||||
this.addSelector("crosshair_size", 242, 90, 240, 0);
|
||||
|
||||
this.add(new Slider(0, 20, 240, 0, 0, 0, 360 - 8, 0, (this.gm.sync < 0) ? (360 - 8) : (this.gm.sync != 0 ? ((this.gm.sync < 10) ? 1 : (this.gm.sync - 9)) : 0), new SliderCallback() {
|
||||
public void use(Slider elem, int value) {
|
||||
GuiDisplay.this.gm.getVar("win_sync").parse("" + ((value > 0 && value < 360 - 8) ? (value + 9) : (value != 0 ? -1 : 0)));
|
||||
GuiDisplay.this.gm.setDirty();
|
||||
}
|
||||
}, new Formatter<Slider>() {
|
||||
public String use(Slider elem) {
|
||||
int value = elem.getValue();
|
||||
return "Max. Bildrate: " + (value > 0 && value < (360 - 8) ? (value + 9) + " FPS" : (value != 0 ? "Unbegrenzt" : "VSync"));
|
||||
}
|
||||
}));
|
||||
this.addSelector("gl_vsync_flush", 242, 20, 240, 0);
|
||||
|
||||
this.addSelector("overlay_enabled", 0, 50, 240, 0);
|
||||
this.addSelector("overlay_opacity", 242, 50, 240, 0);
|
||||
|
||||
this.addSelector("overlay_fadeout", 0, 70, 240, 0);
|
||||
this.addSelector("chat_permanent", 242, 70, 240, 0);
|
||||
|
||||
this.addSelector("console_size", 0, 90, 240, 0);
|
||||
this.addSelector("chat_size", 242, 90, 240, 0);
|
||||
|
||||
this.addSelector("feed_size", 0, 110, 240, 0);
|
||||
this.addSelector("hotbar_size", 242, 110, 240, 0);
|
||||
this.addSelector("crosshair_color_notarget", 0, 125, 240, 0);
|
||||
this.addSelector("crosshair_color_target", 242, 125, 240, 0);
|
||||
|
||||
this.addSelector("gl_fov", 0, 140, 240, 0);
|
||||
|
||||
this.distanceSlider = this.addSelector("chunk_view_distance", 0, 160, 240, 0);
|
||||
this.addSelector("chunk_build_time", 242, 160, 240, 0);
|
||||
|
||||
this.addSelector("chunk_light_updates", 0, 180, 240, 0);
|
||||
this.addSelector("chunk_light_range", 242, 180, 240, 0);
|
||||
this.addSelector("hud_margin", 0, 145, 240, 0);
|
||||
this.addSelector("gui_scale_hotbar", 242, 145, 240, 0);
|
||||
|
||||
super.init(width, height);
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return "Grafik und Anzeige";
|
||||
}
|
||||
|
||||
private String getDistanceName() {
|
||||
int distance = this.gm.renderDistance;
|
||||
distance = distance > 16 ? 16 : distance;
|
||||
String str = distance < 0 ? DISTANCES[0] : DISTANCES[(distance + 1) / 4];
|
||||
if(distance > 2 && (((distance + 1) / 2) & 1) == 1)
|
||||
str = str + "+";
|
||||
return String.format("Sichtweite: %d [%d, %s]", this.gm.renderDistance, this.gm.renderDistance * 16, str);
|
||||
}
|
||||
|
||||
public void updateScreen() {
|
||||
if(!Button.isMouseDown())
|
||||
this.distanceSlider.setText(this.getDistanceName());
|
||||
return "Head-Up-Display";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,42 +1,129 @@
|
|||
package client.gui.options;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import client.Client;
|
||||
import client.gui.Font;
|
||||
import client.gui.Formatter;
|
||||
import client.gui.element.Dropdown;
|
||||
import client.gui.element.DropdownCallback;
|
||||
import client.gui.element.Fill;
|
||||
import client.gui.element.Label;
|
||||
import client.gui.element.Slider;
|
||||
import client.gui.element.SliderCallback;
|
||||
import client.gui.element.Toggle;
|
||||
import client.gui.element.ToggleCallback;
|
||||
import client.window.DisplayMode;
|
||||
import client.window.Window;
|
||||
import common.collect.Lists;
|
||||
import common.util.Color;
|
||||
import common.util.ExtMath;
|
||||
|
||||
public class GuiGraphics extends GuiOptions {
|
||||
private static final String[] DISTANCES = new String[] {
|
||||
"Gruselig", "Winzig", "Gering", "Normal", // 0
|
||||
"Weit", "Weiter", "Sehr weit", "Noch weiter", // 16
|
||||
"Extrem", "Extremer", "Sehr extrem", "Extrem extrem", // 32
|
||||
"Überdreht", "Überdrehter", "Sehr überdreht", "GPU aufheizen", "GPU backen" // 48
|
||||
};
|
||||
|
||||
private Label distanceLabel;
|
||||
private Label fovLabel;
|
||||
|
||||
protected GuiGraphics() {
|
||||
}
|
||||
|
||||
public void init(int width, int height) {
|
||||
this.addSelector("draw_downfall_range", 0, 0, 240, 0);
|
||||
this.addSelector("draw_rain_particle_range", 242, 0, 240, 0);
|
||||
|
||||
this.addSelector("draw_void_particles", 0, 20, 240, 0);
|
||||
this.addSelector("draw_void_fog", 242, 20, 240, 0);
|
||||
|
||||
this.addSelector("draw_player_firstperson", 0, 40, 240, 0);
|
||||
|
||||
this.addSelector("crosshair_simple", 0, 60, 240, 0);
|
||||
this.addSelector("crosshair_size", 242, 60, 240, 0);
|
||||
this.add(new Toggle(0, 0, 240, 0, false, GuiGraphics.this.gm.fullscreen, new ToggleCallback() {
|
||||
public void use(Toggle elem, boolean value) {
|
||||
GuiGraphics.this.gm.full(value);
|
||||
}
|
||||
}, "Vollbild"));
|
||||
int maxModes = ExtMath.clampi((height - ((3 * 20 + 2) * 2 + 18 + 4)) / Font.HEIGHT, 4, 28);
|
||||
DisplayMode[] dmodes = Window.getDisplayModes();
|
||||
if(dmodes != null) {
|
||||
List<DisplayMode> modes = Lists.newArrayList();
|
||||
for(int z = dmodes.length - 1; z >= 0 && modes.size() < maxModes; z--) {
|
||||
DisplayMode mode = dmodes[z];
|
||||
if(mode.width() >= Client.MIN_WIDTH && mode.height() >= Client.MIN_HEIGHT)
|
||||
modes.add(0, mode);
|
||||
}
|
||||
if(modes.isEmpty()) {
|
||||
dmodes = null;
|
||||
}
|
||||
else {
|
||||
DisplayMode selected = modes.get(modes.size() - 1);
|
||||
for(DisplayMode mode : modes) {
|
||||
if(mode.equals(this.gm.vidMode))
|
||||
selected = mode;
|
||||
}
|
||||
this.add(new Dropdown<DisplayMode>(242, 0, 240, 0, false, modes.toArray(new DisplayMode[modes.size()]), modes.get(modes.size() - 1), selected, new DropdownCallback<DisplayMode>() {
|
||||
public void use(Dropdown<DisplayMode> elem, DisplayMode value) {
|
||||
GuiGraphics.this.gm.vidMode = value;
|
||||
GuiGraphics.this.gm.full(true);
|
||||
}
|
||||
}, (String)null));
|
||||
}
|
||||
}
|
||||
if(dmodes == null)
|
||||
this.add(new Fill(242, 0, 240, 0, Color.RED + "<?>"));
|
||||
|
||||
this.addSelector("crosshair_color_notarget", 0, 100, 240, 0);
|
||||
this.addSelector("crosshair_color_target", 242, 100, 240, 0);
|
||||
this.add(new Slider(0, 20, 240, 0, 0, 0, 360 - 8, 0, (this.gm.sync < 0) ? (360 - 8) : (this.gm.sync != 0 ? ((this.gm.sync < 10) ? 1 : (this.gm.sync - 9)) : 0), new SliderCallback() {
|
||||
public void use(Slider elem, int value) {
|
||||
GuiGraphics.this.gm.getVar("win_sync").parse("" + ((value > 0 && value < 360 - 8) ? (value + 9) : (value != 0 ? -1 : 0)));
|
||||
GuiGraphics.this.gm.setDirty();
|
||||
}
|
||||
}, new Formatter<Slider>() {
|
||||
public String use(Slider elem) {
|
||||
int value = elem.getValue();
|
||||
return "Max. Bildrate: " + (value > 0 && value < (360 - 8) ? (value + 9) + " FPS" : (value != 0 ? "Unbegrenzt" : "VSync"));
|
||||
}
|
||||
}));
|
||||
this.addSelector("vsync_flush", 242, 20, 240, 0);
|
||||
|
||||
this.distanceLabel = this.add(new Label(0, 55, 240, ""));
|
||||
this.addSelector("chunk_view_distance", 0, 55, 240, 0);
|
||||
this.fovLabel = this.add(new Label(242, 55, 240, ""));
|
||||
this.addSelector("draw_fov", 242, 55, 240, 0);
|
||||
|
||||
this.addSelector("chunk_light_range", 0, 75, 240, 0);
|
||||
this.addSelector("chunk_light_updates", 242, 75, 240, 0);
|
||||
|
||||
this.addSelector("hud_margin", 0, 140, 240, 0);
|
||||
this.addSelector("chunk_build_time", 0, 95, 240, 0);
|
||||
this.addSelector("draw_player_firstperson", 242, 95, 240, 0);
|
||||
|
||||
this.addSelector("draw_downfall_range", 0, 115, 240, 0);
|
||||
this.addSelector("draw_rain_particle_range", 242, 115, 240, 0);
|
||||
|
||||
this.addSelector("draw_void_particles", 0, 135, 240, 0);
|
||||
this.addSelector("draw_void_fog", 242, 135, 240, 0);
|
||||
|
||||
if(this.gm.shaders)
|
||||
this.addSelector("gl_use_shader", 0, 180, 240, 0);
|
||||
this.addSelector("draw_use_shader", 0, 155, 240, 0);
|
||||
else
|
||||
this.add(new Fill(0, 180, 240, 0, Color.RED + "Shader nicht unterstützt"));
|
||||
if(this.gm.mipmaps)
|
||||
this.addSelector("gl_tex_mipmaps", 242, 180, 240, 0);
|
||||
else
|
||||
this.add(new Fill(242, 180, 240, 0, Color.RED + "Mipmaps nicht unterstützt"));
|
||||
this.add(new Fill(0, 155, 240, 0, Color.RED + "Shader nicht unterstützt"));
|
||||
|
||||
super.init(width, height);
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return "Darstellung";
|
||||
return "Grafik und Anzeige";
|
||||
}
|
||||
|
||||
private String getDistanceName() {
|
||||
int distance = this.gm.renderDistance;
|
||||
String str = distance < 0 ? DISTANCES[0] : DISTANCES[(distance + 1) / 4];
|
||||
if(distance > 2 && (((distance + 1) / 2) & 1) == 1)
|
||||
str = str + "+";
|
||||
return String.format("%d Blöcke, %s", this.gm.renderDistance * 16, str);
|
||||
}
|
||||
|
||||
private String getFovName() {
|
||||
return this.gm.fov < 25.0f ? "Fernglas" : (this.gm.fov > 120.0f ? "Pro-Gamer TM" : "Normal");
|
||||
}
|
||||
|
||||
public void updateScreen() {
|
||||
this.distanceLabel.setText(this.getDistanceName());
|
||||
this.fovLabel.setText(this.getFovName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,11 @@ public class GuiSound extends GuiOptions {
|
|||
}
|
||||
|
||||
public void init(int width, int height) {
|
||||
this.addSelector("mid_opl_voices", 0, 0, 240, 0);
|
||||
this.addSelector("mid_opl_bank", 242, 0, 240, 0);
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int y = 30;
|
||||
for(Volume volume : Volume.values()) {
|
||||
this.addSelector(volume.getCVarName(), x, y, 240, 0);
|
||||
x = (x == 0) ? 242 : 0;
|
||||
|
@ -19,21 +22,17 @@ public class GuiSound extends GuiOptions {
|
|||
y += 20;
|
||||
}
|
||||
|
||||
this.addSelector("snd_enabled", 0, 50, 240, 0);
|
||||
this.addSelector("snd_enabled", 0, 80, 240, 0);
|
||||
|
||||
this.addSelector("snd_buffer_size", 0, 70, 240, 0);
|
||||
this.addSelector("snd_frame_size", 242, 70, 240, 0);
|
||||
this.addSelector("snd_buffer_size", 0, 100, 240, 0);
|
||||
this.addSelector("snd_frame_size", 242, 100, 240, 0);
|
||||
|
||||
this.add(new ActButton(0, 100, 482, 0, new ButtonCallback() {
|
||||
this.add(new ActButton(0, 120, 482, 0, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType action) {
|
||||
GuiSound.this.gm.restartSound(false);
|
||||
}
|
||||
}, "Übernehmen und Audio neu starten"));
|
||||
|
||||
|
||||
this.addSelector("mid_opl_voices", 0, 130, 240, 0);
|
||||
this.addSelector("mid_opl_bank", 242, 130, 240, 0);
|
||||
|
||||
this.addSelector("mid_velocity_func", 0, 150, 240, 0);
|
||||
this.addSelector("mid_keep_notes", 242, 150, 240, 0);
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import client.gui.element.ButtonCallback;
|
|||
import client.gui.element.Element;
|
||||
import client.gui.element.Field;
|
||||
import client.gui.element.PressType;
|
||||
import client.vars.CVar;
|
||||
import client.vars.ColorVar;
|
||||
|
||||
public class GuiStyle extends GuiOptions {
|
||||
|
@ -31,22 +30,19 @@ public class GuiStyle extends GuiOptions {
|
|||
protected GuiStyle() {
|
||||
}
|
||||
|
||||
protected Element addSelector(String cvar, int x, int y, int w, int h) {
|
||||
CVar cv = this.gm.getVar(cvar);
|
||||
if(cv instanceof ColorVar color) {
|
||||
this.add(color.label(x, y, w));
|
||||
if(this.gm.style != Style.CUSTOM)
|
||||
return this.add(new Field(x, y, w, h, color.getFieldValue(this.gm.style)));
|
||||
else
|
||||
return this.add(color.editor(x, y, w, h));
|
||||
}
|
||||
return super.addSelector(cvar, x, y, w, h);
|
||||
protected Element addColorSelector(String cvar, int x, int y, int w, int h) {
|
||||
ColorVar color = (ColorVar)this.gm.getVar(cvar);
|
||||
this.add(color.label(x, y, w));
|
||||
if(this.gm.style != Style.CUSTOM)
|
||||
return this.add(new Field(x, y, w, h, color.getFieldValue(this.gm.style)));
|
||||
else
|
||||
return this.add(color.editor(x, y, w, h));
|
||||
}
|
||||
|
||||
public void init(int width, int height) {
|
||||
for(int z = 0; z < STYLE_CVARS.length; z++) {
|
||||
if(STYLE_CVARS[z] != null)
|
||||
this.addSelector(STYLE_CVARS[z], (z / 3) * 120, (z % 3) * 34, 118, 0);
|
||||
this.addColorSelector(STYLE_CVARS[z], (z / 3) * 120, (z % 3) * 34, 118, 0);
|
||||
}
|
||||
|
||||
this.addSelector("gui_theme", 0, 3 * 34, 240, 0);
|
||||
|
@ -76,8 +72,9 @@ public class GuiStyle extends GuiOptions {
|
|||
|
||||
this.addSelector("gui_scale", 0, 3 * 34 + 20, 240, 0);
|
||||
this.addSelector("gui_font", 242, 3 * 34 + 20, 240, 0);
|
||||
|
||||
this.addSelector("gui_scale_items", 0, 3 * 34 + 40, 240, 0);
|
||||
this.addSelector("gui_scale_hotbar", 242, 3 * 34 + 40, 240, 0);
|
||||
|
||||
super.init(width, height);
|
||||
}
|
||||
|
||||
|
|
|
@ -128,11 +128,11 @@ import common.tileentity.Device;
|
|||
import common.tileentity.TileEntityDisplay;
|
||||
import common.tileentity.TileEntityItemPipe;
|
||||
import common.tileentity.TileEntitySign;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.Pair;
|
||||
import common.util.ParticleType;
|
||||
import common.util.BlockPos.MutableBlockPos;
|
||||
import common.util.Equipment;
|
||||
import common.util.MutablePos;
|
||||
import common.village.MerchantRecipeList;
|
||||
import common.world.State;
|
||||
import common.world.Weather;
|
||||
|
@ -1047,7 +1047,7 @@ public class ClientPlayer implements IClientPlayer
|
|||
else
|
||||
this.gm.world.clientParticle(ParticleType.EXPLOSION_LARGE, packetIn.getX(), packetIn.getY(), packetIn.getZ(), 100);
|
||||
if(packetIn.getBlocks() != null) {
|
||||
for(BlockPos pos : packetIn.getBlocks()) {
|
||||
for(LocalPos pos : packetIn.getBlocks()) {
|
||||
double d0 = (double)((float)pos.getX() + this.gm.world.rand.floatv());
|
||||
double d1 = (double)((float)pos.getY() + this.gm.world.rand.floatv());
|
||||
double d2 = (double)((float)pos.getZ() + this.gm.world.rand.floatv());
|
||||
|
@ -1371,12 +1371,12 @@ public class ClientPlayer implements IClientPlayer
|
|||
this.gm.effectRenderer.spawnParticle(this.gm.getRenderViewEntity(), particle, xCoord, yCoord, zCoord, 0);
|
||||
}
|
||||
|
||||
private void playSoundAtPos(BlockPos pos, SoundEvent sound, float volume)
|
||||
private void playSoundAtPos(LocalPos pos, SoundEvent sound, float volume)
|
||||
{
|
||||
this.gm.getSoundManager().playSound(new PositionedSound(sound, volume, (float)pos.getX() + 0.5f, (float)pos.getY() + 0.5f, (float)pos.getZ() + 0.5f));
|
||||
}
|
||||
|
||||
public void playAuxSFX(int sfxType, BlockPos blockPosIn, int data)
|
||||
public void playAuxSFX(int sfxType, LocalPos blockPosIn, int data)
|
||||
{
|
||||
switch (sfxType)
|
||||
{
|
||||
|
@ -1461,7 +1461,7 @@ public class ClientPlayer implements IClientPlayer
|
|||
break;
|
||||
|
||||
case 1025:
|
||||
MutableBlockPos pos = new MutableBlockPos(blockPosIn.getX(), blockPosIn.getY(), blockPosIn.getZ());
|
||||
MutablePos pos = new MutablePos(blockPosIn.getX(), blockPosIn.getY(), blockPosIn.getZ());
|
||||
for(int z = 0; z < 1000; z++) {
|
||||
this.spawnParticle(ParticleType.EXPLOSION_HUGE,
|
||||
(double)pos.getX() + this.rand.gaussian() * 128.0, (double)pos.getY() + this.rand.gaussian() * 2.0, (double)pos.getZ() + this.rand.gaussian() * 128.0);
|
||||
|
|
|
@ -21,7 +21,7 @@ import common.init.ItemRegistry;
|
|||
import common.item.Item;
|
||||
import common.item.consumable.ItemPotion;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.ParticleType;
|
||||
|
@ -77,7 +77,7 @@ public class EffectRenderer {
|
|||
}
|
||||
|
||||
public int getBrightness(float partial) {
|
||||
BlockPos pos = new BlockPos(this.posX, this.posY, this.posZ);
|
||||
LocalPos pos = new LocalPos(this.posX, this.posY, this.posZ);
|
||||
return world.isBlockLoaded(pos) ? world.getCombinedBrightness(pos) : 0;
|
||||
}
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ public class EffectRenderer {
|
|||
return true;
|
||||
}
|
||||
|
||||
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
|
||||
LocalPos blockpos = new LocalPos(this.posX, this.posY, this.posZ);
|
||||
State iblockstate = world.getState(blockpos);
|
||||
Block block = iblockstate.getBlock();
|
||||
block.setBlockBounds(world, blockpos);
|
||||
|
@ -1078,7 +1078,7 @@ public class EffectRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
public void destroyBlock(BlockPos pos, State state) {
|
||||
public void destroyBlock(LocalPos pos, State state) {
|
||||
if(state.getBlock() != Blocks.air) {
|
||||
state = state.getBlock().getState(state, this.world, pos);
|
||||
int i = 4;
|
||||
|
@ -1096,7 +1096,7 @@ public class EffectRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
public void damageBlock(BlockPos pos, Facing side) {
|
||||
public void damageBlock(LocalPos pos, Facing side) {
|
||||
State iblockstate = this.world.getState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import common.init.Blocks;
|
|||
import common.item.Item;
|
||||
import common.item.ItemAction;
|
||||
import common.item.ItemStack;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Vec3;
|
||||
import common.world.State;
|
||||
|
@ -68,12 +68,12 @@ public class ItemRenderer
|
|||
float f1 = 0.6F;
|
||||
float f2 = 0.0F;
|
||||
GL15.glLightfv(GL15.GL_LIGHT0, GL15.GL_POSITION, setColorBuffer(
|
||||
(float)LIGHT0_POS.xCoord, (float)LIGHT0_POS.yCoord, (float)LIGHT0_POS.zCoord, 0.0f));
|
||||
(float)LIGHT0_POS.x, (float)LIGHT0_POS.y, (float)LIGHT0_POS.z, 0.0f));
|
||||
GL15.glLightfv(GL15.GL_LIGHT0, GL15.GL_DIFFUSE, setColorBuffer(f1, f1, f1, 1.0F));
|
||||
GL15.glLightfv(GL15.GL_LIGHT0, GL15.GL_AMBIENT, setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GL15.glLightfv(GL15.GL_LIGHT0, GL15.GL_SPECULAR, setColorBuffer(f2, f2, f2, 1.0F));
|
||||
GL15.glLightfv(GL15.GL_LIGHT1, GL15.GL_POSITION, setColorBuffer(
|
||||
(float)LIGHT1_POS.xCoord, (float)LIGHT1_POS.yCoord, (float)LIGHT1_POS.zCoord, 0.0f));
|
||||
(float)LIGHT1_POS.x, (float)LIGHT1_POS.y, (float)LIGHT1_POS.z, 0.0f));
|
||||
GL15.glLightfv(GL15.GL_LIGHT1, GL15.GL_DIFFUSE, setColorBuffer(f1, f1, f1, 1.0F));
|
||||
GL15.glLightfv(GL15.GL_LIGHT1, GL15.GL_AMBIENT, setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GL15.glLightfv(GL15.GL_LIGHT1, GL15.GL_SPECULAR, setColorBuffer(f2, f2, f2, 1.0F));
|
||||
|
@ -126,7 +126,7 @@ public class ItemRenderer
|
|||
|
||||
private void setLightMapFromPlayer(EntityNPC clientPlayer)
|
||||
{
|
||||
int i = this.gm.renderer.getCombinedBrightness(new BlockPos(clientPlayer.posX, clientPlayer.posY + (double)clientPlayer.getEyeHeight(), clientPlayer.posZ));
|
||||
int i = this.gm.renderer.getCombinedBrightness(new LocalPos(clientPlayer.posX, clientPlayer.posY + (double)clientPlayer.getEyeHeight(), clientPlayer.posZ));
|
||||
float f = (float)(i & 65535);
|
||||
float f1 = (float)(i >> 16);
|
||||
GL15.glMultiTexCoord2f(GL15.GL_TEXTURE1, f, f1);
|
||||
|
@ -394,7 +394,7 @@ public class ItemRenderer
|
|||
|
||||
if (this.gm.player.isEntityInsideOpaqueBlock())
|
||||
{
|
||||
State iblockstate = this.gm.world.getState(new BlockPos(this.gm.player));
|
||||
State iblockstate = this.gm.world.getState(new LocalPos(this.gm.player));
|
||||
EntityNPC entityplayer = this.gm.player;
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
|
@ -402,7 +402,7 @@ public class ItemRenderer
|
|||
double d0 = entityplayer.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * entityplayer.width * 0.8F);
|
||||
double d1 = entityplayer.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F);
|
||||
double d2 = entityplayer.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * entityplayer.width * 0.8F);
|
||||
BlockPos blockpos = new BlockPos(d0, d1 + (double)entityplayer.getEyeHeight(), d2);
|
||||
LocalPos blockpos = new LocalPos(d0, d1 + (double)entityplayer.getEyeHeight(), d2);
|
||||
State iblockstate1 = this.gm.world.getState(blockpos);
|
||||
|
||||
if (iblockstate1.getBlock().isVisuallyOpaque())
|
||||
|
|
|
@ -11,7 +11,7 @@ import common.block.Block;
|
|||
import common.block.liquid.BlockLiquid;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Vec3;
|
||||
import common.world.State;
|
||||
|
@ -58,12 +58,12 @@ public class MatrixState {
|
|||
double x = entity.prevX + (entity.posX - entity.prevX) * partial;
|
||||
double y = entity.prevY + (entity.posY - entity.prevY) * partial;
|
||||
double z = entity.prevZ + (entity.posZ - entity.prevZ) * partial;
|
||||
return new Vec3(x + position.xCoord, y + position.yCoord, z + position.zCoord);
|
||||
return new Vec3(x + position.x, y + position.y, z + position.z);
|
||||
}
|
||||
|
||||
public static Block getLookedBlock(World world, Entity entity, float partial) {
|
||||
Vec3 view = project(entity, (double)partial);
|
||||
BlockPos pos = new BlockPos(view);
|
||||
LocalPos pos = new LocalPos(view);
|
||||
State state = world.getState(pos);
|
||||
Block block = state.getBlock();
|
||||
if(block.getMaterial().isLiquid()) {
|
||||
|
@ -71,7 +71,7 @@ public class MatrixState {
|
|||
if(state.getBlock() instanceof BlockLiquid)
|
||||
height = BlockLiquid.getLiquidHeightPercent(((Integer)state.getValue(BlockLiquid.LEVEL)).intValue()) - 0.11111111F;
|
||||
float y = (float)(pos.getY() + 1) - height;
|
||||
if(view.yCoord >= (double)y)
|
||||
if(view.y >= (double)y)
|
||||
block = world.getState(pos.up()).getBlock();
|
||||
}
|
||||
return block;
|
||||
|
|
|
@ -6,7 +6,7 @@ import client.world.ChunkClient;
|
|||
import client.Client;
|
||||
import common.init.Blocks;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Vec3i;
|
||||
import common.world.IWorldAccess;
|
||||
|
@ -21,12 +21,12 @@ public class RegionRenderCache implements IWorldAccess
|
|||
private final int zPos;
|
||||
private final ChunkClient[][] chunks;
|
||||
private final boolean sky;
|
||||
private final BlockPos position;
|
||||
private final LocalPos position;
|
||||
private final boolean empty;
|
||||
private int[] combinedLights;
|
||||
private State[] blockStates;
|
||||
|
||||
public RegionRenderCache(Client world, BlockPos from, BlockPos to, int sub)
|
||||
public RegionRenderCache(Client world, LocalPos from, LocalPos to, int sub)
|
||||
{
|
||||
this.sky = world.world.dimension.hasSkyLight();
|
||||
this.xPos = from.getX() - sub >> 4;
|
||||
|
@ -62,14 +62,14 @@ public class RegionRenderCache implements IWorldAccess
|
|||
this.blockStates = new State[16000];
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity(BlockPos pos)
|
||||
public TileEntity getTileEntity(LocalPos pos)
|
||||
{
|
||||
int i = (pos.getX() >> 4) - this.xPos;
|
||||
int j = (pos.getZ() >> 4) - this.zPos;
|
||||
return this.chunks[i][j].getTileEntity(pos, TileEntity.CreateMode.QUEUED);
|
||||
}
|
||||
|
||||
public int getCombinedLight(BlockPos pos)
|
||||
public int getCombinedLight(LocalPos pos)
|
||||
{
|
||||
int i = this.getPositionIndex(pos);
|
||||
int j = this.combinedLights[i];
|
||||
|
@ -83,7 +83,7 @@ public class RegionRenderCache implements IWorldAccess
|
|||
return j;
|
||||
}
|
||||
|
||||
public State getState(BlockPos pos)
|
||||
public State getState(LocalPos pos)
|
||||
{
|
||||
int i = this.getPositionIndex(pos);
|
||||
State iblockstate = this.blockStates[i];
|
||||
|
@ -97,7 +97,7 @@ public class RegionRenderCache implements IWorldAccess
|
|||
return iblockstate;
|
||||
}
|
||||
|
||||
private State getBlockStateRaw(BlockPos pos)
|
||||
private State getBlockStateRaw(LocalPos pos)
|
||||
{
|
||||
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ public class RegionRenderCache implements IWorldAccess
|
|||
}
|
||||
}
|
||||
|
||||
private int getPositionIndex(BlockPos p_175630_1_)
|
||||
private int getPositionIndex(LocalPos p_175630_1_)
|
||||
{
|
||||
int i = p_175630_1_.getX() - this.position.getX();
|
||||
int j = p_175630_1_.getY() - this.position.getY();
|
||||
|
@ -124,7 +124,7 @@ public class RegionRenderCache implements IWorldAccess
|
|||
return this.empty;
|
||||
}
|
||||
|
||||
private int getBlockLightExt(BlockPos pos)
|
||||
private int getBlockLightExt(LocalPos pos)
|
||||
{
|
||||
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
||||
{
|
||||
|
@ -169,7 +169,7 @@ public class RegionRenderCache implements IWorldAccess
|
|||
}
|
||||
}
|
||||
|
||||
private int getBlockLight(BlockPos pos)
|
||||
private int getBlockLight(LocalPos pos)
|
||||
{
|
||||
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
||||
{
|
||||
|
|
|
@ -45,7 +45,6 @@ import common.collect.Lists;
|
|||
import common.collect.Maps;
|
||||
import common.collect.Sets;
|
||||
import common.dimension.DimType;
|
||||
import common.dimension.Shader;
|
||||
import common.effect.Effect;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityCameraHolder;
|
||||
|
@ -60,12 +59,13 @@ import common.rng.Random;
|
|||
import common.sound.PositionedSound;
|
||||
import common.sound.Sound;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.HitPosition;
|
||||
import common.util.InheritanceMultiMap;
|
||||
import common.util.MutablePos;
|
||||
import common.util.Pair;
|
||||
import common.util.HitPosition.ObjectType;
|
||||
import common.vars.Vars;
|
||||
|
@ -119,7 +119,7 @@ public class Renderer {
|
|||
private final RenderManager renderManager;
|
||||
private final ModelManager manager;
|
||||
private final Set<TileEntity> setTileEntities = Sets.<TileEntity>newHashSet();
|
||||
private final Map<BlockPos, Sound> mapSoundPositions = Maps.<BlockPos, Sound>newHashMap();
|
||||
private final Map<LocalPos, Sound> mapSoundPositions = Maps.<LocalPos, Sound>newHashMap();
|
||||
private final Map<BlockLiquid, Sprite[]> fluids = Maps.newHashMap();
|
||||
private final Map<Block, Sprite> dynamic = Maps.newHashMap();
|
||||
|
||||
|
@ -308,15 +308,15 @@ public class Renderer {
|
|||
|
||||
if (this.gm.pointed != null)
|
||||
{
|
||||
dist = this.gm.pointed.vec.distanceTo(eye);
|
||||
dist = this.gm.pointed.vec.distance(eye);
|
||||
}
|
||||
|
||||
Vec3 look = entity.getLook(partialTicks);
|
||||
Vec3 eyelook = eye.addVector(look.xCoord * max, look.yCoord * max, look.zCoord * max);
|
||||
Vec3 eyelook = eye.add(look.x * max, look.y * max, look.z * max);
|
||||
this.pointedEntity = null;
|
||||
Vec3 hit = null;
|
||||
float exp = 1.0F;
|
||||
List<Entity> list = this.gm.world.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(look.xCoord * max, look.yCoord * max, look.zCoord * max).expand((double)exp, (double)exp, (double)exp), new Predicate<Entity>()
|
||||
List<Entity> list = this.gm.world.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(look.x * max, look.y * max, look.z * max).expand((double)exp, (double)exp, (double)exp), new Predicate<Entity>()
|
||||
{
|
||||
public boolean test(Entity p_apply_1_)
|
||||
{
|
||||
|
@ -343,7 +343,7 @@ public class Renderer {
|
|||
}
|
||||
else if (objpos != null)
|
||||
{
|
||||
double eyehit = eye.distanceTo(objpos.vec);
|
||||
double eyehit = eye.distance(objpos.vec);
|
||||
|
||||
if (eyehit < edist || edist == 0.0D)
|
||||
{
|
||||
|
@ -642,7 +642,7 @@ public class Renderer {
|
|||
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
double d7 = movingobjectposition.vec.distanceTo(new Vec3(d0, d1, d2));
|
||||
double d7 = movingobjectposition.vec.distance(new Vec3(d0, d1, d2));
|
||||
|
||||
if (d7 < d3)
|
||||
{
|
||||
|
@ -860,7 +860,7 @@ public class Renderer {
|
|||
}
|
||||
|
||||
private Vec3 getSkyColor(Entity entity, float partial) {
|
||||
BlockPos pos = new BlockPos(ExtMath.floord(entity.posX), ExtMath.floord(entity.posY),
|
||||
LocalPos pos = new LocalPos(ExtMath.floord(entity.posX), ExtMath.floord(entity.posY),
|
||||
ExtMath.floord(entity.posZ));
|
||||
Vec3 vec;
|
||||
if(this.gm.world.dimension.isExterminated())
|
||||
|
@ -869,11 +869,11 @@ public class Renderer {
|
|||
vec = new Vec3(this.gm.world.dimension.getSkyColor());
|
||||
if(this.gm.world.dimension.hasDaylight()) {
|
||||
float mult = ExtMath.clampf(ExtMath.cos(this.getDayPhase(partial)) * 2.0F + 0.5F, 0.0F, 1.0F);
|
||||
vec = new Vec3(vec.xCoord * mult, vec.yCoord * mult, vec.zCoord * mult);
|
||||
vec = new Vec3(vec.x * mult, vec.y * mult, vec.z * mult);
|
||||
}
|
||||
float r = (float)vec.xCoord;
|
||||
float g = (float)vec.yCoord;
|
||||
float b = (float)vec.zCoord;
|
||||
float r = (float)vec.x;
|
||||
float g = (float)vec.y;
|
||||
float b = (float)vec.z;
|
||||
|
||||
float rain = this.gm.world.getRainStrength();
|
||||
if(rain > 0.0F) {
|
||||
|
@ -898,9 +898,9 @@ public class Renderer {
|
|||
if(light > 1.0F)
|
||||
light = 1.0F;
|
||||
// light = light * 0.45F;
|
||||
r = r * (1.0F - light) + (float)this.lightColor.xCoord * light;
|
||||
g = g * (1.0F - light) + (float)this.lightColor.yCoord * light;
|
||||
b = b * (1.0F - light) + (float)this.lightColor.zCoord * light;
|
||||
r = r * (1.0F - light) + (float)this.lightColor.x * light;
|
||||
g = g * (1.0F - light) + (float)this.lightColor.y * light;
|
||||
b = b * (1.0F - light) + (float)this.lightColor.z * light;
|
||||
}
|
||||
|
||||
float space = this.getSpaceFactor();
|
||||
|
@ -917,9 +917,9 @@ public class Renderer {
|
|||
Vec3 color = new Vec3(this.gm.world.dimension.getCloudColor());
|
||||
if(this.gm.world.dimension.isExterminated())
|
||||
color = new Vec3(0x000000);
|
||||
float r = (float)color.xCoord;
|
||||
float g = (float)color.yCoord;
|
||||
float b = (float)color.zCoord;
|
||||
float r = (float)color.x;
|
||||
float g = (float)color.y;
|
||||
float b = (float)color.z;
|
||||
|
||||
float rain = this.gm.world.getRainStrength();
|
||||
if(rain > 0.0F) {
|
||||
|
@ -1003,9 +1003,9 @@ public class Renderer {
|
|||
{
|
||||
Vec3 lightColor = new Vec3(world.dimension.getLightColor());
|
||||
float light = world.dimension.hasSkyLight() ? Math.max(sky, brightness) : 1.0f;
|
||||
red = (float)lightColor.xCoord * light;
|
||||
green = (float)lightColor.yCoord * light;
|
||||
blue = (float)lightColor.zCoord * light;
|
||||
red = (float)lightColor.x * light;
|
||||
green = (float)lightColor.y * light;
|
||||
blue = (float)lightColor.z * light;
|
||||
}
|
||||
if(space > 0.0f) {
|
||||
red = red * (1.0F - space) + space;
|
||||
|
@ -1018,9 +1018,9 @@ public class Renderer {
|
|||
if(intens > 1.0F)
|
||||
intens = 1.0F;
|
||||
float light = world.dimension.hasSkyLight() ? rsky : 1.0f;
|
||||
red = red * (1.0F - intens) + (float)this.lightColor.xCoord * light * intens;
|
||||
green = green * (1.0F - intens) + (float)this.lightColor.yCoord * light * intens;
|
||||
blue = blue * (1.0F - intens) + (float)this.lightColor.zCoord * light * intens;
|
||||
red = red * (1.0F - intens) + (float)this.lightColor.x * light * intens;
|
||||
green = green * (1.0F - intens) + (float)this.lightColor.y * light * intens;
|
||||
blue = blue * (1.0F - intens) + (float)this.lightColor.z * light * intens;
|
||||
}
|
||||
|
||||
if(block > 1.0F)
|
||||
|
@ -1320,7 +1320,7 @@ public class Renderer {
|
|||
this.rng.setSeed((long)this.rendererUpdateCount * 312987231L);
|
||||
Entity entity = this.gm.getRenderViewEntity();
|
||||
World world = this.gm.world;
|
||||
BlockPos blockpos = new BlockPos(entity);
|
||||
LocalPos blockpos = new LocalPos(entity);
|
||||
int i = this.gm.rainParticleRange;
|
||||
if(i <= 0)
|
||||
return;
|
||||
|
@ -1344,8 +1344,8 @@ public class Renderer {
|
|||
|
||||
for (int l = 0; l < k; ++l)
|
||||
{
|
||||
BlockPos blockpos1 = world.getPrecipitationHeight(blockpos.add(this.rng.zrange(i) - this.rng.zrange(i), 0, this.rng.zrange(i) - this.rng.zrange(i)));
|
||||
BlockPos blockpos2 = blockpos1.down();
|
||||
LocalPos blockpos1 = world.getPrecipitationHeight(blockpos.add(this.rng.zrange(i) - this.rng.zrange(i), 0, this.rng.zrange(i) - this.rng.zrange(i)));
|
||||
LocalPos blockpos2 = blockpos1.down();
|
||||
Block block = world.getState(blockpos2).getBlock();
|
||||
float temp = world.getTemperatureC(blockpos1);
|
||||
|
||||
|
@ -1431,7 +1431,7 @@ public class Renderer {
|
|||
float tic = (float)this.rendererUpdateCount + partial;
|
||||
buf.setTranslation(-ax, -ay, -az);
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
||||
MutablePos pos = new MutablePos();
|
||||
|
||||
for(int z = ez - range; z <= ez + range; z++) {
|
||||
for(int x = ex - range; x <= ex + range; x++) {
|
||||
|
@ -1540,9 +1540,9 @@ public class Renderer {
|
|||
Entity entity = this.gm.getRenderViewEntity();
|
||||
|
||||
Vec3 fog = new Vec3(world.dimension.getFogColor());
|
||||
this.fogColorRed = (float)fog.xCoord;
|
||||
this.fogColorGreen = (float)fog.yCoord;
|
||||
this.fogColorBlue = (float)fog.zCoord;
|
||||
this.fogColorRed = (float)fog.x;
|
||||
this.fogColorGreen = (float)fog.y;
|
||||
this.fogColorBlue = (float)fog.z;
|
||||
|
||||
if(world.dimension.isExterminated()) {
|
||||
this.fogColorRed = 0.188f;
|
||||
|
@ -1568,7 +1568,7 @@ public class Renderer {
|
|||
{
|
||||
double neg = -1.0D;
|
||||
Vec3 pos = ExtMath.sin(this.getDayPhase(partial)) > 0.0F ? new Vec3(neg, 0.0D, 0.0D) : new Vec3(1.0D, 0.0D, 0.0D);
|
||||
float shift = (float)entity.getLook(partial).dotProduct(pos);
|
||||
float shift = (float)entity.getLook(partial).dot(pos);
|
||||
if (shift > 0.0F)
|
||||
{
|
||||
float[] sun = calcSunriseSunsetColors(this.getDayPhase(partial), partial);
|
||||
|
@ -1585,9 +1585,9 @@ public class Renderer {
|
|||
float dist = 0.25F + 0.75F * (float)this.gm.renderDistance / 32.0F;
|
||||
dist = 1.0F - (float)Math.pow((double)dist, 0.25D);
|
||||
Vec3 sky = this.getSkyColor(this.gm.getRenderViewEntity(), partial);
|
||||
this.fogColorRed += ((float)sky.xCoord - this.fogColorRed) * dist;
|
||||
this.fogColorGreen += ((float)sky.yCoord - this.fogColorGreen) * dist;
|
||||
this.fogColorBlue += ((float)sky.zCoord - this.fogColorBlue) * dist;
|
||||
this.fogColorRed += ((float)sky.x - this.fogColorRed) * dist;
|
||||
this.fogColorGreen += ((float)sky.y - this.fogColorGreen) * dist;
|
||||
this.fogColorBlue += ((float)sky.z - this.fogColorBlue) * dist;
|
||||
|
||||
float rain = world.getRainStrength();
|
||||
if (rain > 0.0F)
|
||||
|
@ -2241,7 +2241,7 @@ public class Renderer {
|
|||
|
||||
// boolean flag3 = this.gm.getRenderViewEntity() instanceof EntityLivingBase ? ((EntityLivingBase)this.gm.getRenderViewEntity()).isPlayerSleeping() : false;
|
||||
|
||||
if (entity2.posY < (double)(-World.MAX_SIZE_Y) || entity2.posY >= (double)World.MAX_SIZE_Y || this.theWorld.isBlockLoaded(new BlockPos(entity2)))
|
||||
if (entity2.posY < (double)(-World.MAX_SIZE_Y) || entity2.posY >= (double)World.MAX_SIZE_Y || this.theWorld.isBlockLoaded(new LocalPos(entity2)))
|
||||
{
|
||||
if((entity2 != this.gm.getRenderViewEntity() || this.gm.thirdPersonView != 0 || this.gm.showPlayerFirstPerson)) {
|
||||
++this.countEntitiesRendered;
|
||||
|
@ -2339,9 +2339,9 @@ public class Renderer {
|
|||
double d4 = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * partialTicks;
|
||||
double d5 = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * partialTicks;
|
||||
this.initialize(d3, d4, d5);
|
||||
BlockPos blockpos1 = new BlockPos(d3, d4 + (double)viewEntity.getEyeHeight(), d5);
|
||||
LocalPos blockpos1 = new LocalPos(d3, d4 + (double)viewEntity.getEyeHeight(), d5);
|
||||
RenderChunk renderchunk = this.viewFrustum.getRenderChunk(blockpos1);
|
||||
BlockPos blockpos = new BlockPos(ExtMath.floord(d3 / 16.0D) * 16, ExtMath.floord(d4 / 16.0D) * 16, ExtMath.floord(d5 / 16.0D) * 16);
|
||||
LocalPos blockpos = new LocalPos(ExtMath.floord(d3 / 16.0D) * 16, ExtMath.floord(d4 / 16.0D) * 16, ExtMath.floord(d5 / 16.0D) * 16);
|
||||
this.displayListEntitiesDirty = this.displayListEntitiesDirty || !this.chunksToUpdate.isEmpty() || viewEntity.posX != this.lastViewEntityX || viewEntity.posY != this.lastViewEntityY || viewEntity.posZ != this.lastViewEntityZ || (double)viewEntity.rotPitch != this.lastViewEntityPitch || (double)viewEntity.rotYaw != this.lastViewEntityYaw;
|
||||
this.lastViewEntityX = viewEntity.posX;
|
||||
this.lastViewEntityY = viewEntity.posY;
|
||||
|
@ -2401,7 +2401,7 @@ public class Renderer {
|
|||
{
|
||||
for (int i = -this.renderDistanceChunks; i <= this.renderDistanceChunks; ++i)
|
||||
{
|
||||
RenderChunk renderchunk1 = this.viewFrustum.getRenderChunk(new BlockPos((j << 4) + 8, (i << 4) + 8, (k << 4) + 8));
|
||||
RenderChunk renderchunk1 = this.viewFrustum.getRenderChunk(new LocalPos((j << 4) + 8, (i << 4) + 8, (k << 4) + 8));
|
||||
|
||||
if (renderchunk1 != null && Frustum.isInFrustum(renderchunk1.boundingBox))
|
||||
{
|
||||
|
@ -2421,7 +2421,7 @@ public class Renderer {
|
|||
RenderInfo render1 = (RenderInfo)queue.poll();
|
||||
RenderChunk chunk1 = render1.chunk;
|
||||
Facing face1 = this.gm.xrayActive ? null : render1.facing;
|
||||
BlockPos pos1 = chunk1.getPosition();
|
||||
LocalPos pos1 = chunk1.getPosition();
|
||||
this.renderInfos.add(render1);
|
||||
|
||||
for (Facing face2 : Facing.values())
|
||||
|
@ -2484,7 +2484,7 @@ public class Renderer {
|
|||
{
|
||||
for (int i = -this.renderDistanceChunks; i <= this.renderDistanceChunks; ++i)
|
||||
{
|
||||
RenderChunk renderchunk1 = this.viewFrustum.getRenderChunk(new BlockPos((j << 4) + 8, (i << 4) + 8, (k << 4) + 8));
|
||||
RenderChunk renderchunk1 = this.viewFrustum.getRenderChunk(new LocalPos((j << 4) + 8, (i << 4) + 8, (k << 4) + 8));
|
||||
|
||||
if (renderchunk1 != null)
|
||||
{
|
||||
|
@ -2496,19 +2496,19 @@ public class Renderer {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isPositionInRenderChunk(BlockPos pos, RenderChunk renderChunkIn)
|
||||
private boolean isPositionInRenderChunk(LocalPos pos, RenderChunk renderChunkIn)
|
||||
{
|
||||
BlockPos blockpos = renderChunkIn.getPosition();
|
||||
LocalPos blockpos = renderChunkIn.getPosition();
|
||||
return ExtMath.absi(pos.getX() - blockpos.getX()) > 16 ? false : (ExtMath.absi(pos.getY() - blockpos.getY()) > 16 ? false : ExtMath.absi(pos.getZ() - blockpos.getZ()) <= 16);
|
||||
}
|
||||
|
||||
private Set<Facing> getVisibleFacings(BlockPos pos)
|
||||
private Set<Facing> getVisibleFacings(LocalPos pos)
|
||||
{
|
||||
VisGraph visgraph = new VisGraph();
|
||||
BlockPos blockpos = new BlockPos(pos.getX() >> 4 << 4, pos.getY() >> 4 << 4, pos.getZ() >> 4 << 4);
|
||||
LocalPos blockpos = new LocalPos(pos.getX() >> 4 << 4, pos.getY() >> 4 << 4, pos.getZ() >> 4 << 4);
|
||||
ChunkClient chunk = this.gm.getChunk(blockpos.getX() >> 4, blockpos.getZ() >> 4);
|
||||
|
||||
for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(blockpos, blockpos.add(15, 15, 15)))
|
||||
for (MutablePos blockpos$mutableblockpos : MutablePos.mutableArea(blockpos, blockpos.add(15, 15, 15)))
|
||||
{
|
||||
if (chunk.getBlock(blockpos$mutableblockpos).isOpaqueCube())
|
||||
{
|
||||
|
@ -2522,9 +2522,9 @@ public class Renderer {
|
|||
* Returns RenderChunk offset from given RenderChunk in given direction, or null if it can't be seen by player at
|
||||
* given BlockPos.
|
||||
*/
|
||||
private RenderChunk getRenderChunkOffset(BlockPos playerPos, RenderChunk renderChunkBase, Facing facing)
|
||||
private RenderChunk getRenderChunkOffset(LocalPos playerPos, RenderChunk renderChunkBase, Facing facing)
|
||||
{
|
||||
BlockPos blockpos = renderChunkBase.getBlockPosOffset16(facing);
|
||||
LocalPos blockpos = renderChunkBase.getBlockPosOffset16(facing);
|
||||
return ExtMath.absi(playerPos.getX() - blockpos.getX()) > this.renderDistanceChunks * 16 ? null : (ExtMath.absi(playerPos.getY() - blockpos.getY()) <= this.renderDistanceChunks * 16 ? (ExtMath.absi(playerPos.getZ() - blockpos.getZ()) > this.renderDistanceChunks * 16 ? null : this.viewFrustum.getRenderChunk(blockpos)) : null);
|
||||
}
|
||||
|
||||
|
@ -2585,7 +2585,7 @@ public class Renderer {
|
|||
{
|
||||
VertexBuffer vertexbuffer = renderchunk.getVertexBuffer();
|
||||
|
||||
BlockPos blockpos = renderchunk.getPosition();
|
||||
LocalPos blockpos = renderchunk.getPosition();
|
||||
context.vec("offset", (float)((double)blockpos.getX() - this.viewEntityX), (float)((double)blockpos.getY() - this.viewEntityY), (float)((double)blockpos.getZ() - this.viewEntityZ));
|
||||
context.matrix("model", renderchunk.getModelviewMatrix());
|
||||
context.integer("chunk_x", blockpos.getX());
|
||||
|
@ -2697,7 +2697,7 @@ public class Renderer {
|
|||
|
||||
private void preRenderChunk(RenderChunk renderChunkIn)
|
||||
{
|
||||
BlockPos blockpos = renderChunkIn.getPosition();
|
||||
LocalPos blockpos = renderChunkIn.getPosition();
|
||||
GL15.glTranslatef((float)((double)blockpos.getX() - this.viewEntityX), (float)((double)blockpos.getY() - this.viewEntityY), (float)((double)blockpos.getZ() - this.viewEntityZ));
|
||||
}
|
||||
|
||||
|
@ -2766,9 +2766,9 @@ public class Renderer {
|
|||
{
|
||||
GlState.disableTexture2D();
|
||||
Vec3 vec3 = this.gm.renderer.getSkyColor(this.gm.getRenderViewEntity(), partialTicks);
|
||||
float f = (float)vec3.xCoord;
|
||||
float f1 = (float)vec3.yCoord;
|
||||
float f2 = (float)vec3.zCoord;
|
||||
float f = (float)vec3.x;
|
||||
float f1 = (float)vec3.y;
|
||||
float f2 = (float)vec3.z;
|
||||
|
||||
// if (pass != 2)
|
||||
// {
|
||||
|
@ -2861,8 +2861,8 @@ public class Renderer {
|
|||
if(color != 0xffffffff) {
|
||||
this.renderEngine.bindTexture((color & 0xff000000) != 0 ? EXTERMINATED_TEX : SUN_TEX);
|
||||
Vec3 ncolor = new Vec3(color);
|
||||
float mul = Math.min(1.0f / (float)ncolor.xCoord, Math.min(1.0f / (float)ncolor.yCoord, 1.0f / (float)ncolor.zCoord));
|
||||
GlState.color((float)ncolor.xCoord * mul, (float)ncolor.yCoord * mul, (float)ncolor.zCoord * mul, f16);
|
||||
float mul = Math.min(1.0f / (float)ncolor.x, Math.min(1.0f / (float)ncolor.y, 1.0f / (float)ncolor.z));
|
||||
GlState.color((float)ncolor.x * mul, (float)ncolor.y * mul, (float)ncolor.z * mul, f16);
|
||||
worldrenderer.begin(GL15.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
worldrenderer.pos((double)(-size), 100.0D, (double)(-size)).tex(0.0D, 0.0D).endVertex();
|
||||
worldrenderer.pos((double)size, 100.0D, (double)(-size)).tex(1.0D, 0.0D).endVertex();
|
||||
|
@ -2879,8 +2879,8 @@ public class Renderer {
|
|||
boolean destroyed = (colors[z] & 0xff000000) != 0;
|
||||
this.renderEngine.bindTexture(destroyed ? EXTERMINATED_TEX : (this.gm.world.dimension.getType() == DimType.MOON ? PLANET_TEX : MOON_TEX));
|
||||
Vec3 ncolor = new Vec3(colors[z]);
|
||||
float mul = Math.min(1.0f / (float)ncolor.xCoord, Math.min(1.0f / (float)ncolor.yCoord, 1.0f / (float)ncolor.zCoord));
|
||||
GlState.color((float)ncolor.xCoord * mul, (float)ncolor.yCoord * mul, (float)ncolor.zCoord * mul, f16);
|
||||
float mul = Math.min(1.0f / (float)ncolor.x, Math.min(1.0f / (float)ncolor.y, 1.0f / (float)ncolor.z));
|
||||
GlState.color((float)ncolor.x * mul, (float)ncolor.y * mul, (float)ncolor.z * mul, f16);
|
||||
int phase = this.theWorld.getMoonPhase(z);
|
||||
int tx = phase % 4;
|
||||
int ty = phase / 4 % 2;
|
||||
|
@ -2909,7 +2909,7 @@ public class Renderer {
|
|||
}
|
||||
else {
|
||||
Vec3 color = new Vec3(stars);
|
||||
GlState.color((float)color.xCoord, (float)color.yCoord, (float)color.zCoord, f15);
|
||||
GlState.color((float)color.x, (float)color.y, (float)color.z, f15);
|
||||
}
|
||||
|
||||
// if (this.vboEnabled)
|
||||
|
@ -2936,7 +2936,7 @@ public class Renderer {
|
|||
}
|
||||
else {
|
||||
Vec3 color = new Vec3(stars);
|
||||
GlState.color((float)color.xCoord, (float)color.yCoord, (float)color.zCoord, f15);
|
||||
GlState.color((float)color.x, (float)color.y, (float)color.z, f15);
|
||||
}
|
||||
|
||||
// if (this.vboEnabled)
|
||||
|
@ -2984,9 +2984,9 @@ public class Renderer {
|
|||
GlState.enableBlend();
|
||||
GlState.tryBlendFuncSeparate(GL15.GL_SRC_ALPHA, GL15.GL_ONE_MINUS_SRC_ALPHA, GL15.GL_ONE, GL15.GL_ZERO);
|
||||
Vec3 vec3 = this.gm.renderer.getCloudColor(this.gm.getRenderViewEntity(), partialTicks);
|
||||
float f4 = (float)vec3.xCoord;
|
||||
float f5 = (float)vec3.yCoord;
|
||||
float f6 = (float)vec3.zCoord;
|
||||
float f4 = (float)vec3.x;
|
||||
float f5 = (float)vec3.y;
|
||||
float f6 = (float)vec3.z;
|
||||
|
||||
// if (pass != 2)
|
||||
// {
|
||||
|
@ -3158,7 +3158,7 @@ public class Renderer {
|
|||
GlState.disableTexture2D();
|
||||
GlState.depthMask(false);
|
||||
float f = 0.002F;
|
||||
BlockPos blockpos = movingObjectPositionIn.block;
|
||||
LocalPos blockpos = movingObjectPositionIn.block;
|
||||
Block block = this.theWorld.getState(blockpos).getBlock();
|
||||
|
||||
if(block != Blocks.air) // && this.theWorld.getWorldBorder().contains(blockpos))
|
||||
|
@ -3301,7 +3301,7 @@ public class Renderer {
|
|||
GlState.enableBlend();
|
||||
GlState.tryBlendFuncSeparate(GL15.GL_SRC_ALPHA, GL15.GL_ONE, GL15.GL_ONE, GL15.GL_ZERO);
|
||||
ItemRenderer.disableStandardItemLighting();
|
||||
GlState.color((float)stars.xCoord, (float)stars.yCoord, (float)stars.zCoord, 1.0f);
|
||||
GlState.color((float)stars.x, (float)stars.y, (float)stars.z, 1.0f);
|
||||
this.starVBO.bindBuffer();
|
||||
GL15.glEnableClientState(GL15.GL_VERTEX_ARRAY);
|
||||
GL15.nglVertexPointer(3, GL15.GL_FLOAT, 12, 0L);
|
||||
|
@ -3345,7 +3345,7 @@ public class Renderer {
|
|||
}
|
||||
}
|
||||
|
||||
public void renderBlockEntity(State state, BlockPos brightPos)
|
||||
public void renderBlockEntity(State state, LocalPos brightPos)
|
||||
{
|
||||
if (state.getBlock() != Blocks.air && !state.getBlock().getMaterial().isLiquid())
|
||||
{
|
||||
|
@ -3378,7 +3378,7 @@ public class Renderer {
|
|||
}
|
||||
}
|
||||
|
||||
public int getLightColor(BlockPos pos, Facing side) {
|
||||
public int getLightColor(LocalPos pos, Facing side) {
|
||||
int light = this.getCombinedLight(pos);
|
||||
float sky = this.skyLight ? pos.getY() < 0 ? 0.0f : (pos.getY() < 64 ? (float)pos.getY() / 64.0f : 1.0f) : 1.0f;
|
||||
float shading = side == null ? 1.0f : FaceBakery.getFaceBrightness(side);
|
||||
|
@ -3395,7 +3395,7 @@ public class Renderer {
|
|||
return 0xff000000 | (int)(Math.min(directR, 1.0f) * 255.0f) << 16 | (int)(Math.min(directG, 1.0f) * 255.0f) << 8 | (int)(Math.min(directB, 1.0f) * 255.0f);
|
||||
}
|
||||
|
||||
public int getVertexColor(BlockPos pos, Facing side, int light, boolean flip) {
|
||||
public int getVertexColor(LocalPos pos, Facing side, int light, boolean flip) {
|
||||
float sky = this.skyLight ? pos.getY() < 0 ? 0.0f : (pos.getY() < 64 ? (float)pos.getY() / 64.0f : 1.0f) : 1.0f;
|
||||
float shading = side == null ? 1.0f : FaceBakery.getFaceBrightness(side);
|
||||
float max = (float)Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) / 255.0f;
|
||||
|
@ -3406,7 +3406,7 @@ public class Renderer {
|
|||
return 0xff000000 | (int)(Math.min(flip ? directB : directR, 1.0f) * 255.0f) << 16 | (int)(Math.min(directG, 1.0f) * 255.0f) << 8 | (int)(Math.min(flip ? directR : directB, 1.0f) * 255.0f);
|
||||
}
|
||||
|
||||
public int getSkyBrightness(BlockPos pos) {
|
||||
public int getSkyBrightness(LocalPos pos) {
|
||||
int light = this.getCombinedLight(pos);
|
||||
float sky = this.skyLight ? pos.getY() < 0 ? 0.0f : (pos.getY() < 64 ? (float)pos.getY() / 64.0f : 1.0f) : 1.0f;
|
||||
float block = (float)Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) / 255.0f;
|
||||
|
@ -3414,13 +3414,13 @@ public class Renderer {
|
|||
return ((int)(sky * 255.0f) / 16) << 20 | ((int)(block * 255.0f) / 16) << 4;
|
||||
}
|
||||
|
||||
public int getCombinedBrightness(BlockPos pos) {
|
||||
public int getCombinedBrightness(LocalPos pos) {
|
||||
int light = this.getLightColor(pos, null);
|
||||
light = Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) / 16;
|
||||
return light << 20 | light << 4;
|
||||
}
|
||||
|
||||
public boolean renderBlock(State state, BlockPos pos, IWorldAccess world, RenderBuffer rb) {
|
||||
public boolean renderBlock(State state, LocalPos pos, IWorldAccess world, RenderBuffer rb) {
|
||||
Block block = state.getBlock();
|
||||
if(this.gm.xrayActive && !block.isXrayVisible())
|
||||
return false;
|
||||
|
@ -3446,7 +3446,7 @@ public class Renderer {
|
|||
for(Facing side : Facing.values()) {
|
||||
List<BakedQuad> list = model.getFace(side);
|
||||
if(!list.isEmpty()) {
|
||||
BlockPos bpos = pos.offset(side);
|
||||
LocalPos bpos = pos.offset(side);
|
||||
if(!checkSides || block.canRender(world, bpos, side)) {
|
||||
int light = this.getLightmapValue(world, bpos, side);
|
||||
int sky = this.getSkyBrightness(bpos);
|
||||
|
@ -3467,7 +3467,7 @@ public class Renderer {
|
|||
return Math.max((lightA >> 16) & 0xff, (lightB >> 16) & 0xff) << 16 | Math.max((lightA >> 8) & 0xff, (lightB >> 8) & 0xff) << 8 | Math.max(lightA & 0xff, lightB & 0xff);
|
||||
}
|
||||
|
||||
private int getLightmapValue(IWorldAccess world, BlockPos pos, Facing side) {
|
||||
private int getLightmapValue(IWorldAccess world, LocalPos pos, Facing side) {
|
||||
Block block = world.getState(pos).getBlock();
|
||||
int light = componentMax(world.getCombinedLight(pos), block.getLight());
|
||||
if(light == 0 && block instanceof BlockSlab) {
|
||||
|
@ -3478,13 +3478,13 @@ public class Renderer {
|
|||
return getVertexColor(pos, side, light, true);
|
||||
}
|
||||
|
||||
private int getLightmapValueLiquid(IWorldAccess world, BlockPos pos, Facing side) {
|
||||
private int getLightmapValueLiquid(IWorldAccess world, LocalPos pos, Facing side) {
|
||||
int light = world.getCombinedLight(pos);
|
||||
int up = world.getCombinedLight(pos.up());
|
||||
return getVertexColor(pos, side, componentMax(light, up), false);
|
||||
}
|
||||
|
||||
private void renderModelStandardQuads(IWorldAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, Facing faceIn, int light, int sky, boolean ownLight, RenderBuffer worldRendererIn, List<BakedQuad> listQuadsIn, BitSet boundsFlags)
|
||||
private void renderModelStandardQuads(IWorldAccess blockAccessIn, Block blockIn, LocalPos blockPosIn, Facing faceIn, int light, int sky, boolean ownLight, RenderBuffer worldRendererIn, List<BakedQuad> listQuadsIn, BitSet boundsFlags)
|
||||
{
|
||||
double d0 = (double)blockPosIn.getX();
|
||||
double d1 = (double)blockPosIn.getY();
|
||||
|
@ -3580,7 +3580,7 @@ public class Renderer {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean renderFluid(IWorldAccess blockAccess, State blockStateIn, BlockPos blockPosIn, RenderBuffer worldRendererIn)
|
||||
private boolean renderFluid(IWorldAccess blockAccess, State blockStateIn, LocalPos blockPosIn, RenderBuffer worldRendererIn)
|
||||
{
|
||||
BlockLiquid blockliquid = (BlockLiquid)blockStateIn.getBlock();
|
||||
blockliquid.setBlockBounds(blockAccess, blockPosIn);
|
||||
|
@ -3711,7 +3711,7 @@ public class Renderer {
|
|||
++j1;
|
||||
}
|
||||
|
||||
BlockPos blockpos = blockPosIn.add(j1, 0, k1);
|
||||
LocalPos blockpos = blockPosIn.add(j1, 0, k1);
|
||||
Sprite textureatlassprite1 = atextureatlassprite[1];
|
||||
|
||||
if (aboolean[np])
|
||||
|
@ -3783,14 +3783,14 @@ public class Renderer {
|
|||
}
|
||||
}
|
||||
|
||||
private float getFluidHeight(IBlockAccess blockAccess, BlockPos blockPosIn)
|
||||
private float getFluidHeight(IBlockAccess blockAccess, LocalPos blockPosIn)
|
||||
{
|
||||
int i = 0;
|
||||
float f = 0.0F;
|
||||
|
||||
for (int j = 0; j < 4; ++j)
|
||||
{
|
||||
BlockPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1));
|
||||
LocalPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1));
|
||||
|
||||
if (blockAccess.getState(blockpos.up()).getBlock().getMaterial().isLiquid())
|
||||
{
|
||||
|
@ -3826,7 +3826,7 @@ public class Renderer {
|
|||
return 1.0F - f / (float)i;
|
||||
}
|
||||
|
||||
private boolean renderDynamic(IWorldAccess blockAccess, State blockStateIn, BlockPos blockPosIn, RenderBuffer worldRendererIn)
|
||||
private boolean renderDynamic(IWorldAccess blockAccess, State blockStateIn, LocalPos blockPosIn, RenderBuffer worldRendererIn)
|
||||
{
|
||||
Block block = blockStateIn.getBlock();
|
||||
block.setBlockBounds(blockAccess, blockPosIn);
|
||||
|
@ -3933,7 +3933,7 @@ public class Renderer {
|
|||
++j1;
|
||||
}
|
||||
|
||||
BlockPos blockpos = blockPosIn.add(j1, 0, k1);
|
||||
LocalPos blockpos = blockPosIn.add(j1, 0, k1);
|
||||
Sprite textureatlassprite1 = textureatlassprite;
|
||||
|
||||
if (aboolean[np])
|
||||
|
@ -4005,7 +4005,7 @@ public class Renderer {
|
|||
}
|
||||
}
|
||||
|
||||
private float getAdjacentHeight(IBlockAccess blockAccess, BlockPos blockPosIn, Block block)
|
||||
private float getAdjacentHeight(IBlockAccess blockAccess, LocalPos blockPosIn, Block block)
|
||||
{
|
||||
int i = 0;
|
||||
float f = 0.0F;
|
||||
|
@ -4015,7 +4015,7 @@ public class Renderer {
|
|||
|
||||
for (int j = 0; j < 4; ++j)
|
||||
{
|
||||
BlockPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1));
|
||||
LocalPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1));
|
||||
|
||||
if (blockAccess.getState(blockpos.up()).getBlock() != Blocks.air)
|
||||
{
|
||||
|
@ -4052,9 +4052,9 @@ public class Renderer {
|
|||
return n == 4 ? 1.0f : (s + a == 4 && a > 1 ? 0.0f : 1.0F - f / (float)i);
|
||||
}
|
||||
|
||||
private int getLight(BlockPos pos) {
|
||||
private int getLight(LocalPos pos) {
|
||||
if(pos.getY() < -World.MAX_SIZE_Y) {
|
||||
pos = new BlockPos(pos.getX(), -World.MAX_SIZE_Y, pos.getZ());
|
||||
pos = new LocalPos(pos.getX(), -World.MAX_SIZE_Y, pos.getZ());
|
||||
}
|
||||
|
||||
if(!World.isValid(pos)) {
|
||||
|
@ -4066,9 +4066,9 @@ public class Renderer {
|
|||
}
|
||||
}
|
||||
|
||||
public int getCombinedLight(BlockPos pos) {
|
||||
public int getCombinedLight(LocalPos pos) {
|
||||
if(pos.getY() < -World.MAX_SIZE_Y) {
|
||||
pos = new BlockPos(pos.getX(), -World.MAX_SIZE_Y, pos.getZ());
|
||||
pos = new LocalPos(pos.getX(), -World.MAX_SIZE_Y, pos.getZ());
|
||||
}
|
||||
|
||||
if(!World.isValid(pos) || this.gm.world == null) {
|
||||
|
@ -4127,7 +4127,7 @@ public class Renderer {
|
|||
// }
|
||||
// }
|
||||
|
||||
private int getRawBlockLight(BlockPos pos, int component) {
|
||||
private int getRawBlockLight(LocalPos pos, int component) {
|
||||
Block block = this.gm.world.getState(pos).getBlock();
|
||||
int light = ((block.getLight() >> ((2 - component) * 8)) & 0xff) / 16;
|
||||
int opacity = block.getLightOpacity();
|
||||
|
@ -4148,7 +4148,7 @@ public class Renderer {
|
|||
}
|
||||
else {
|
||||
for(Facing side : Facing.values()) {
|
||||
BlockPos bpos = pos.offset(side);
|
||||
LocalPos bpos = pos.offset(side);
|
||||
int blight = this.getLightFor(bpos, component) - opacity;
|
||||
|
||||
if(blight > light) {
|
||||
|
@ -4164,11 +4164,11 @@ public class Renderer {
|
|||
}
|
||||
}
|
||||
|
||||
private int getLightFor(BlockPos pos, int component) {
|
||||
private int getLightFor(LocalPos pos, int component) {
|
||||
return ((this.getLight(pos) >> ((2 - component) * 8)) & 0xff) / 16;
|
||||
}
|
||||
|
||||
private void setBlockLight(BlockPos pos, int component, int value) {
|
||||
private void setBlockLight(LocalPos pos, int component, int value) {
|
||||
if(World.isValid(pos)) {
|
||||
ChunkClient chunk = this.gm.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
|
||||
int light = chunk.getLight(pos);
|
||||
|
@ -4180,7 +4180,7 @@ public class Renderer {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean checkBlockLight(BlockPos pos) {
|
||||
public boolean checkBlockLight(LocalPos pos) {
|
||||
if(!this.gm.world.isAreaLoaded(pos, 17, false))
|
||||
return false;
|
||||
for(int component = 0; component < 3; component++) {
|
||||
|
@ -4204,7 +4204,7 @@ public class Renderer {
|
|||
int y = (p >> 6 & 63) - 32 + by;
|
||||
int z = (p >> 12 & 63) - 32 + bz;
|
||||
int s = p >> 18 & 15;
|
||||
BlockPos blk = new BlockPos(x, y, z);
|
||||
LocalPos blk = new LocalPos(x, y, z);
|
||||
int l = this.getLightFor(blk, component);
|
||||
|
||||
if(l == s) {
|
||||
|
@ -4216,7 +4216,7 @@ public class Renderer {
|
|||
int dz = ExtMath.absi(z - bz);
|
||||
|
||||
if(dx + dy + dz < 17) {
|
||||
BlockPos.MutableBlockPos bpos = new BlockPos.MutableBlockPos();
|
||||
MutablePos bpos = new MutablePos();
|
||||
|
||||
for(Facing dir : Facing.values()) {
|
||||
int ox = x + dir.getFrontOffsetX();
|
||||
|
@ -4243,7 +4243,7 @@ public class Renderer {
|
|||
int x = (p & 63) - 32 + bx;
|
||||
int y = (p >> 6 & 63) - 32 + by;
|
||||
int z = (p >> 12 & 63) - 32 + bz;
|
||||
BlockPos blk = new BlockPos(x, y, z);
|
||||
LocalPos blk = new LocalPos(x, y, z);
|
||||
int l = this.getLightFor(blk, component);
|
||||
int r = this.getRawBlockLight(blk, component);
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ public class ShaderContext {
|
|||
}
|
||||
|
||||
public ShaderContext vec(String name, Vec3 vec) {
|
||||
GL20.glUniform3f(GL20.glGetUniformLocation(this.program, name), (float)vec.xCoord, (float)vec.yCoord, (float)vec.zCoord);
|
||||
GL20.glUniform3f(GL20.glGetUniformLocation(this.program, name), (float)vec.x, (float)vec.y, (float)vec.z);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package client.renderer;
|
|||
|
||||
import client.renderer.chunk.RenderChunk;
|
||||
import client.Client;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.ExtMath;
|
||||
|
||||
public class ViewFrustum
|
||||
|
@ -39,7 +39,7 @@ public class ViewFrustum
|
|||
for (int i1 = 0; i1 < this.countChunksZ; ++i1)
|
||||
{
|
||||
int j1 = (i1 * this.countChunksY + l) * this.countChunksX + k;
|
||||
BlockPos blockpos = new BlockPos(k * 16, l * 16, i1 * 16);
|
||||
LocalPos blockpos = new LocalPos(k * 16, l * 16, i1 * 16);
|
||||
this.renderChunks[j1] = new RenderChunk(this.gm, this.renderGlobal, blockpos, j++);
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class ViewFrustum
|
|||
{
|
||||
int i2 = this.func_178157_a(n, k, l1);
|
||||
RenderChunk renderchunk = this.renderChunks[(j1 * this.countChunksY + l1) * this.countChunksX + l];
|
||||
BlockPos blockpos = new BlockPos(i1, i2, k1);
|
||||
LocalPos blockpos = new LocalPos(i1, i2, k1);
|
||||
|
||||
if (!blockpos.equals(renderchunk.getPosition()))
|
||||
{
|
||||
|
@ -149,7 +149,7 @@ public class ViewFrustum
|
|||
}
|
||||
}
|
||||
|
||||
protected RenderChunk getRenderChunk(BlockPos pos)
|
||||
protected RenderChunk getRenderChunk(LocalPos pos)
|
||||
{
|
||||
int x = bucketInt(pos.getX());
|
||||
int y = bucketInt(pos.getY());
|
||||
|
|
|
@ -24,9 +24,10 @@ import common.collect.Maps;
|
|||
import common.collect.Sets;
|
||||
import common.init.Blocks;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Facing;
|
||||
import common.util.MutablePos;
|
||||
import common.world.State;
|
||||
|
||||
public class RenderChunk
|
||||
|
@ -34,7 +35,7 @@ public class RenderChunk
|
|||
private Client gm;
|
||||
private final Renderer renderGlobal;
|
||||
public static int renderChunksUpdated;
|
||||
private BlockPos position;
|
||||
private LocalPos position;
|
||||
public CompiledChunk compiledChunk = CompiledChunk.DUMMY;
|
||||
private final ReentrantLock lockCompileTask = new ReentrantLock();
|
||||
private final ReentrantLock lockCompiledChunk = new ReentrantLock();
|
||||
|
@ -46,9 +47,9 @@ public class RenderChunk
|
|||
public BoundingBox boundingBox;
|
||||
private int frameIndex = -1;
|
||||
private boolean needsUpdate = true;
|
||||
private EnumMap<Facing, BlockPos> mapEnumFacing = Maps.newEnumMap(Facing.class);
|
||||
private EnumMap<Facing, LocalPos> mapEnumFacing = Maps.newEnumMap(Facing.class);
|
||||
|
||||
public RenderChunk(Client worldIn, Renderer renderGlobalIn, BlockPos blockPosIn, int indexIn)
|
||||
public RenderChunk(Client worldIn, Renderer renderGlobalIn, LocalPos blockPosIn, int indexIn)
|
||||
{
|
||||
this.gm = worldIn;
|
||||
this.renderGlobal = renderGlobalIn;
|
||||
|
@ -80,7 +81,7 @@ public class RenderChunk
|
|||
return this.vertexBuffer;
|
||||
}
|
||||
|
||||
public void setPosition(BlockPos pos)
|
||||
public void setPosition(LocalPos pos)
|
||||
{
|
||||
this.stopCompileTask();
|
||||
this.position = pos;
|
||||
|
@ -98,8 +99,8 @@ public class RenderChunk
|
|||
{
|
||||
CompiledChunk compiledchunk = new CompiledChunk();
|
||||
int i = 1;
|
||||
BlockPos blockpos = this.position;
|
||||
BlockPos blockpos1 = blockpos.add(15, 15, 15);
|
||||
LocalPos blockpos = this.position;
|
||||
LocalPos blockpos1 = blockpos.add(15, 15, 15);
|
||||
generator.getLock().lock();
|
||||
RegionRenderCache iblockaccess;
|
||||
|
||||
|
@ -127,7 +128,7 @@ public class RenderChunk
|
|||
boolean aboolean = false;
|
||||
Renderer renderer = this.gm.renderer;
|
||||
|
||||
for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(blockpos, blockpos1))
|
||||
for (MutablePos blockpos$mutableblockpos : MutablePos.mutableArea(blockpos, blockpos1))
|
||||
{
|
||||
State iblockstate = iblockaccess.getState(blockpos$mutableblockpos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
@ -139,7 +140,7 @@ public class RenderChunk
|
|||
|
||||
if (block instanceof ITileEntityProvider)
|
||||
{
|
||||
TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos));
|
||||
TileEntity tileentity = iblockaccess.getTileEntity(new LocalPos(blockpos$mutableblockpos));
|
||||
ElementRenderer<TileEntity> tileentityspecialrenderer = SpecialRenderer.instance.<TileEntity>getRenderer(tileentity);
|
||||
|
||||
if (tileentity != null && tileentityspecialrenderer != null)
|
||||
|
@ -239,7 +240,7 @@ public class RenderChunk
|
|||
return chunkcompiletaskgenerator;
|
||||
}
|
||||
|
||||
private void preRenderBlocks(RenderBuffer worldRendererIn, BlockPos pos)
|
||||
private void preRenderBlocks(RenderBuffer worldRendererIn, LocalPos pos)
|
||||
{
|
||||
worldRendererIn.begin(GL15.GL_QUADS, DefaultVertexFormats.BLOCK);
|
||||
worldRendererIn.setTranslation((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ()));
|
||||
|
@ -295,7 +296,7 @@ public class RenderChunk
|
|||
this.vertexBuffer.deleteGlBuffers();
|
||||
}
|
||||
|
||||
public BlockPos getPosition()
|
||||
public LocalPos getPosition()
|
||||
{
|
||||
return this.position;
|
||||
}
|
||||
|
@ -310,8 +311,8 @@ public class RenderChunk
|
|||
return this.needsUpdate;
|
||||
}
|
||||
|
||||
public BlockPos getBlockPosOffset16(Facing p_181701_1_)
|
||||
public LocalPos getBlockPosOffset16(Facing p_181701_1_)
|
||||
{
|
||||
return (BlockPos)this.mapEnumFacing.get(p_181701_1_);
|
||||
return (LocalPos)this.mapEnumFacing.get(p_181701_1_);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.LinkedList;
|
|||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.Facing;
|
||||
|
||||
public class VisGraph
|
||||
|
@ -26,13 +26,13 @@ public class VisGraph
|
|||
}
|
||||
}
|
||||
|
||||
public void func_178606_a(BlockPos pos)
|
||||
public void func_178606_a(LocalPos pos)
|
||||
{
|
||||
this.field_178612_d.set(getIndex(pos), true);
|
||||
--this.field_178611_f;
|
||||
}
|
||||
|
||||
private static int getIndex(BlockPos pos)
|
||||
private static int getIndex(LocalPos pos)
|
||||
{
|
||||
return getIndex(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class VisGraph
|
|||
return setvisibility;
|
||||
}
|
||||
|
||||
public Set<Facing> func_178609_b(BlockPos pos)
|
||||
public Set<Facing> func_178609_b(LocalPos pos)
|
||||
{
|
||||
return this.func_178604_a(getIndex(pos));
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import org.lwjgl.opengl.GL15;
|
|||
import client.Client;
|
||||
import client.renderer.texture.TextureMap;
|
||||
import common.entity.Entity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.world.State;
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ public class RenderBlockEntity extends Render<Entity>
|
|||
GL15.glTranslatef((float)x, (float)y + 0.5F, (float)z);
|
||||
this.bindEntityTexture(entity);
|
||||
GL15.glTranslatef(-0.5F, -0.5F, 0.5F);
|
||||
Client.CLIENT.renderer.renderBlockEntity(this.state, new BlockPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ));
|
||||
Client.CLIENT.renderer.renderBlockEntity(this.state, new LocalPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ));
|
||||
GL15.glTranslatef(0.0F, 0.0F, 1.0F);
|
||||
GL15.glPopMatrix();
|
||||
super.doRender(entity, x, y, z, partialTicks);
|
||||
|
|
|
@ -7,7 +7,7 @@ import client.renderer.texture.TextureMap;
|
|||
import common.block.Block;
|
||||
import common.entity.item.EntityFalling;
|
||||
import common.init.Blocks;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -20,7 +20,7 @@ public class RenderFallingBlock extends Render<EntityFalling> {
|
|||
if(entity.getBlock() != null) {
|
||||
State state = entity.getBlock();
|
||||
Block block = state.getBlock();
|
||||
BlockPos pos = new BlockPos(entity);
|
||||
LocalPos pos = new LocalPos(entity);
|
||||
World world = entity.getWorldObj();
|
||||
|
||||
if(state != world.getState(pos) && block != Blocks.air && !block.getMaterial().isLiquid()) {
|
||||
|
@ -29,7 +29,7 @@ public class RenderFallingBlock extends Render<EntityFalling> {
|
|||
GL15.glTranslatef((float)x, (float)y + 0.5F, (float)z);
|
||||
this.bindEntityTexture(entity);
|
||||
GL15.glTranslatef(-0.5F, -0.5F, 0.5F);
|
||||
Client.CLIENT.renderer.renderBlockEntity(state, new BlockPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ));
|
||||
Client.CLIENT.renderer.renderBlockEntity(state, new LocalPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ));
|
||||
GL15.glTranslatef(0.0F, 0.0F, 1.0F);
|
||||
GL15.glPopMatrix();
|
||||
super.doRender(entity, x, y, z, partialTicks);
|
||||
|
|
|
@ -57,13 +57,13 @@ public class RenderFish extends Render<EntityHook>
|
|||
float f7 = entity.angler.getSwingProgress(partialTicks);
|
||||
float f8 = ExtMath.sin(ExtMath.sqrtf(f7) * (float)Math.PI);
|
||||
Vec3 vec3 = new Vec3(-0.36D, 0.03D, 0.35D);
|
||||
vec3 = vec3.rotatePitch(-(entity.angler.prevPitch + (entity.angler.rotPitch - entity.angler.prevPitch) * partialTicks) * (float)Math.PI / 180.0F);
|
||||
vec3 = vec3.rotateYaw(-(entity.angler.prevYaw + (entity.angler.rotYaw - entity.angler.prevYaw) * partialTicks) * (float)Math.PI / 180.0F);
|
||||
vec3 = vec3.rotateYaw(f8 * 0.5F);
|
||||
vec3 = vec3.rotatePitch(-f8 * 0.7F);
|
||||
double d0 = entity.angler.prevX + (entity.angler.posX - entity.angler.prevX) * (double)partialTicks + vec3.xCoord;
|
||||
double d1 = entity.angler.prevY + (entity.angler.posY - entity.angler.prevY) * (double)partialTicks + vec3.yCoord;
|
||||
double d2 = entity.angler.prevZ + (entity.angler.posZ - entity.angler.prevZ) * (double)partialTicks + vec3.zCoord;
|
||||
vec3 = vec3.pitch(-(entity.angler.prevPitch + (entity.angler.rotPitch - entity.angler.prevPitch) * partialTicks) * (float)Math.PI / 180.0F);
|
||||
vec3 = vec3.yaw(-(entity.angler.prevYaw + (entity.angler.rotYaw - entity.angler.prevYaw) * partialTicks) * (float)Math.PI / 180.0F);
|
||||
vec3 = vec3.yaw(f8 * 0.5F);
|
||||
vec3 = vec3.pitch(-f8 * 0.7F);
|
||||
double d0 = entity.angler.prevX + (entity.angler.posX - entity.angler.prevX) * (double)partialTicks + vec3.x;
|
||||
double d1 = entity.angler.prevY + (entity.angler.posY - entity.angler.prevY) * (double)partialTicks + vec3.y;
|
||||
double d2 = entity.angler.prevZ + (entity.angler.posZ - entity.angler.prevZ) * (double)partialTicks + vec3.z;
|
||||
double d3 = (double)entity.angler.getEyeHeight();
|
||||
|
||||
if (this.manager.gm != null && this.manager.gm.thirdPersonView > 0 || entity.angler != Client.CLIENT.player || this.manager.gm != null && this.manager.gm.showPlayerFirstPerson)
|
||||
|
|
|
@ -19,7 +19,7 @@ import common.collect.Maps;
|
|||
import common.entity.Entity;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.SpeciesRegistry.ModelType;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Vec3;
|
||||
import common.world.World;
|
||||
|
@ -120,7 +120,7 @@ public class RenderManager {
|
|||
}
|
||||
|
||||
public static int getBrightnessForRender(Entity entity) {
|
||||
BlockPos pos = new BlockPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ);
|
||||
LocalPos pos = new LocalPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ);
|
||||
return entity.worldObj.isBlockLoaded(pos) ? entity.worldObj.getCombinedBrightness(pos) : 0;
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ public class RenderManager {
|
|||
Vec3 vec3 = entityIn.getLook(partialTicks);
|
||||
worldrenderer.begin(GL15.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
|
||||
worldrenderer.pos(x, y + (double)entityIn.getEyeHeight(), z).color(0, 0, 255, 255).endVertex();
|
||||
worldrenderer.pos(x + vec3.xCoord * 2.0D, y + (double)entityIn.getEyeHeight() + vec3.yCoord * 2.0D, z + vec3.zCoord * 2.0D).color(0, 0, 255, 255).endVertex();
|
||||
worldrenderer.pos(x + vec3.x * 2.0D, y + (double)entityIn.getEyeHeight() + vec3.y * 2.0D, z + vec3.z * 2.0D).color(0, 0, 255, 255).endVertex();
|
||||
Tessellator.draw();
|
||||
GlState.enableTexture2D();
|
||||
GlState.enableLighting();
|
||||
|
|
|
@ -9,7 +9,7 @@ import client.renderer.model.ModelMinecart;
|
|||
import client.renderer.texture.TextureMap;
|
||||
import common.entity.item.EntityCart;
|
||||
import common.init.Blocks;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Vec3;
|
||||
import common.world.State;
|
||||
|
@ -63,16 +63,16 @@ public class RenderMinecart<T extends EntityCart> extends Render<T>
|
|||
vec32 = vec3;
|
||||
}
|
||||
|
||||
x += vec3.xCoord - d0;
|
||||
y += (vec31.yCoord + vec32.yCoord) / 2.0D - d1;
|
||||
z += vec3.zCoord - d2;
|
||||
Vec3 vec33 = vec32.addVector(-vec31.xCoord, -vec31.yCoord, -vec31.zCoord);
|
||||
x += vec3.x - d0;
|
||||
y += (vec31.y + vec32.y) / 2.0D - d1;
|
||||
z += vec3.z - d2;
|
||||
Vec3 vec33 = vec32.add(-vec31.x, -vec31.y, -vec31.z);
|
||||
|
||||
if (vec33.lengthVector() != 0.0D)
|
||||
if (vec33.length() != 0.0D)
|
||||
{
|
||||
vec33 = vec33.normalize();
|
||||
entityYaw = (float)(Math.atan2(vec33.zCoord, vec33.xCoord) * 180.0D / Math.PI);
|
||||
f3 = (float)(Math.atan(vec33.yCoord) * 73.0D);
|
||||
entityYaw = (float)(Math.atan2(vec33.z, vec33.x) * 180.0D / Math.PI);
|
||||
f3 = (float)(Math.atan(vec33.y) * 73.0D);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ public class RenderMinecart<T extends EntityCart> extends Render<T>
|
|||
protected void func_180560_a(T minecart, float partialTicks, State state)
|
||||
{
|
||||
GL15.glPushMatrix();
|
||||
Client.CLIENT.renderer.renderBlockEntity(state, new BlockPos(minecart.posX, minecart.posY + (double)minecart.getEyeHeight(), minecart.posZ));
|
||||
Client.CLIENT.renderer.renderBlockEntity(state, new LocalPos(minecart.posX, minecart.posY + (double)minecart.getEyeHeight(), minecart.posZ));
|
||||
GL15.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import client.renderer.texture.TextureMap;
|
|||
import common.block.Block;
|
||||
import common.entity.item.EntityTnt;
|
||||
import common.init.BlockRegistry;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.ExtMath;
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class RenderTntPrimed extends Render<EntityTnt>
|
|||
this.bindEntityTexture(entity);
|
||||
GL15.glTranslatef(-0.5F, -0.5F, 0.5F);
|
||||
Block tnt = BlockRegistry.byName("tnt" + (entity.explosionSize <= 0 || entity.explosionSize >= 8 ? "" : "_" + entity.explosionSize));
|
||||
renderer.renderBlockEntity(tnt.getState(), new BlockPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ));
|
||||
renderer.renderBlockEntity(tnt.getState(), new LocalPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ));
|
||||
GL15.glTranslatef(0.0F, 0.0F, 1.0F);
|
||||
|
||||
if (entity.fuse / 5 % 2 == 0)
|
||||
|
|
|
@ -2,8 +2,6 @@ package client.renderer.layers;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL15;
|
||||
|
||||
import client.Client;
|
||||
import client.renderer.GlState;
|
||||
import client.renderer.entity.RendererLivingEntity;
|
||||
|
@ -12,7 +10,6 @@ import common.collect.Lists;
|
|||
import common.enchantment.Enchantment;
|
||||
import common.enchantment.EnchantmentHelper;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.item.ItemStack;
|
||||
import common.item.material.ItemArmor;
|
||||
import common.util.Equipment;
|
||||
|
|
|
@ -47,12 +47,12 @@ public class TexturedQuad
|
|||
|
||||
public void addTo(RenderBuffer renderer, float scale)
|
||||
{
|
||||
Vec3 norma = this.vertices[1].pos.subtractReverse(this.vertices[0].pos);
|
||||
Vec3 normb = this.vertices[1].pos.subtractReverse(this.vertices[2].pos);
|
||||
Vec3 norm = normb.crossProduct(norma).normalize();
|
||||
float nx = (float)norm.xCoord;
|
||||
float ny = (float)norm.yCoord;
|
||||
float nz = (float)norm.zCoord;
|
||||
Vec3 norma = this.vertices[1].pos.subtractRev(this.vertices[0].pos);
|
||||
Vec3 normb = this.vertices[1].pos.subtractRev(this.vertices[2].pos);
|
||||
Vec3 norm = normb.cross(norma).normalize();
|
||||
float nx = (float)norm.x;
|
||||
float ny = (float)norm.y;
|
||||
float nz = (float)norm.z;
|
||||
// if (this.invNorm)
|
||||
// {
|
||||
// nx = -nx;
|
||||
|
@ -63,7 +63,7 @@ public class TexturedQuad
|
|||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
PositionTextureVertex vertex = this.vertices[i];
|
||||
renderer.pos(vertex.pos.xCoord * (double)scale, vertex.pos.yCoord * (double)scale, vertex.pos.zCoord * (double)scale)
|
||||
renderer.pos(vertex.pos.x * (double)scale, vertex.pos.y * (double)scale, vertex.pos.z * (double)scale)
|
||||
.tex((double)vertex.texX, (double)vertex.texY).normal(nx, ny, nz).endVertex();
|
||||
}
|
||||
// Tessellator.getInstance();
|
||||
|
|
|
@ -7,9 +7,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import client.init.RenderRegistry;
|
||||
|
@ -193,7 +190,7 @@ public class TextureMap extends Texture
|
|||
return textureatlassprite;
|
||||
}
|
||||
|
||||
public void update(boolean mips)
|
||||
public void update()
|
||||
{
|
||||
GlState.bindTexture(this.getGlTextureId());
|
||||
|
||||
|
@ -201,9 +198,6 @@ public class TextureMap extends Texture
|
|||
{
|
||||
textureatlassprite.updateAnimation();
|
||||
}
|
||||
|
||||
if(mips)
|
||||
GL30.glGenerateMipmap(GL15.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
private Sprite registerSprite(String location)
|
||||
|
|
|
@ -22,8 +22,8 @@ public class TextureUtil
|
|||
public static final DynamicTexture MISSING = new DynamicTexture(16, 16);
|
||||
public static final int[] MISSING_DATA = MISSING.getData();
|
||||
|
||||
public static void setParams(boolean mips, boolean linear) {
|
||||
GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_MIN_FILTER, mips ? (linear ? GL15.GL_NEAREST_MIPMAP_LINEAR : GL15.GL_NEAREST_MIPMAP_NEAREST) : GL15.GL_NEAREST);
|
||||
public static void setParams() {
|
||||
GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_MIN_FILTER, GL15.GL_NEAREST);
|
||||
GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_MAG_FILTER, GL15.GL_NEAREST);
|
||||
GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_WRAP_S, GL15.GL_REPEAT);
|
||||
GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_WRAP_T, GL15.GL_REPEAT);
|
||||
|
@ -33,7 +33,7 @@ public class TextureUtil
|
|||
{
|
||||
int i = 4194304 / w;
|
||||
if(params)
|
||||
setParams(false, false);
|
||||
setParams();
|
||||
int l;
|
||||
|
||||
for (int j = 0; j < w * h; j += w * l)
|
||||
|
@ -56,7 +56,7 @@ public class TextureUtil
|
|||
int h = img.getHeight();
|
||||
int k = 4194304 / w;
|
||||
int[] data = new int[k * w];
|
||||
setParams(false, false);
|
||||
setParams();
|
||||
|
||||
for (int l = 0; l < w * h; l += w * k)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ import common.block.Block;
|
|||
import common.block.tech.BlockDisplay;
|
||||
import common.collect.Maps;
|
||||
import common.tileentity.TileEntityDisplay;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
|
||||
|
@ -26,7 +26,7 @@ public class DisplayRenderer extends ElementRenderer<TileEntityDisplay> {
|
|||
|
||||
private static final Map<String, TimedTexture> DISPLAYS = Maps.<String, TimedTexture>newHashMap();
|
||||
|
||||
private static String getTextureLocation(BlockPos pos) {
|
||||
private static String getTextureLocation(LocalPos pos) {
|
||||
return "display/" + pos.getX() + "," + pos.getY() + "," + pos.getZ();
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import common.tileentity.TileEntity;
|
|||
import common.tileentity.TileEntityDisplay;
|
||||
import common.tileentity.TileEntityItemPipe;
|
||||
import common.tileentity.TileEntitySign;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.world.World;
|
||||
|
||||
public class SpecialRenderer {
|
||||
|
@ -60,7 +60,7 @@ public class SpecialRenderer {
|
|||
int sky = light / 65536;
|
||||
GL15.glMultiTexCoord2f(GL15.GL_TEXTURE1, (float)block / 1.0F, (float)sky / 1.0F);
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
BlockPos pos = tile.getPos();
|
||||
LocalPos pos = tile.getPos();
|
||||
this.render(tile, (double)pos.getX() - entityX, (double)pos.getY() - entityY, (double)pos.getZ() - entityZ, partial);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import common.packet.CPacketBreak;
|
|||
import common.packet.CPacketClick;
|
||||
import common.packet.CPacketPlace;
|
||||
import common.sound.PositionedSound;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Vec3;
|
||||
import common.world.State;
|
||||
|
@ -25,7 +25,7 @@ public class PlayerController {
|
|||
private final Client gm;
|
||||
private final ClientPlayer handler;
|
||||
|
||||
private BlockPos position = new BlockPos(-1, -World.MAX_SIZE_Y - 1, -1);
|
||||
private LocalPos position = new LocalPos(-1, -World.MAX_SIZE_Y - 1, -1);
|
||||
private ItemStack stack;
|
||||
private float damage;
|
||||
private float stepCounter;
|
||||
|
@ -41,7 +41,7 @@ public class PlayerController {
|
|||
this.handler = handler;
|
||||
}
|
||||
|
||||
public boolean destroyBlock(BlockPos pos, Facing side) {
|
||||
public boolean destroyBlock(LocalPos pos, Facing side) {
|
||||
World world = this.gm.world;
|
||||
State state = world.getState(pos);
|
||||
Block block = state.getBlock();
|
||||
|
@ -57,7 +57,7 @@ public class PlayerController {
|
|||
block.onBroken(world, pos, state);
|
||||
}
|
||||
|
||||
this.position = new BlockPos(this.position.getX(), -1, this.position.getZ());
|
||||
this.position = new LocalPos(this.position.getX(), -1, this.position.getZ());
|
||||
|
||||
ItemStack stack = this.gm.player.getHeldItem();
|
||||
|
||||
|
@ -73,7 +73,7 @@ public class PlayerController {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean clickBlock(BlockPos pos, Facing face) {
|
||||
public boolean clickBlock(LocalPos pos, Facing face) {
|
||||
if(!World.isValidXZ(pos)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public class PlayerController {
|
|||
this.interacting = false;
|
||||
}
|
||||
|
||||
public boolean damageBlock(BlockPos pos, Facing face) {
|
||||
public boolean damageBlock(LocalPos pos, Facing face) {
|
||||
if(this.interacting)
|
||||
return false;
|
||||
this.syncItem();
|
||||
|
@ -183,7 +183,7 @@ public class PlayerController {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isHitting(BlockPos pos) {
|
||||
private boolean isHitting(LocalPos pos) {
|
||||
ItemStack stack = this.gm.player.getHeldItem();
|
||||
boolean flag = this.stack == null && stack == null;
|
||||
|
||||
|
@ -204,11 +204,11 @@ public class PlayerController {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean clickRight(EntityNPC player, World world, ItemStack stack, BlockPos pos, Facing side, Vec3 hit) {
|
||||
public boolean clickRight(EntityNPC player, World world, ItemStack stack, LocalPos pos, Facing side, Vec3 hit) {
|
||||
this.syncItem();
|
||||
float f = (float)(hit.xCoord - (double)pos.getX());
|
||||
float f1 = (float)(hit.yCoord - (double)pos.getY());
|
||||
float f2 = (float)(hit.zCoord - (double)pos.getZ());
|
||||
float f = (float)(hit.x - (double)pos.getX());
|
||||
float f1 = (float)(hit.y - (double)pos.getY());
|
||||
float f2 = (float)(hit.z - (double)pos.getZ());
|
||||
boolean flag = false;
|
||||
|
||||
if(!World.isValidXZ(pos)) {
|
||||
|
@ -301,7 +301,7 @@ public class PlayerController {
|
|||
|
||||
public void stopUsing(EntityNPC player) {
|
||||
this.syncItem();
|
||||
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, Facing.DOWN));
|
||||
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.RELEASE_USE_ITEM, LocalPos.ORIGIN, Facing.DOWN));
|
||||
player.stopUsingItem();
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,7 @@ public class PlayerController {
|
|||
this.itemUseCooldown = 0;
|
||||
}
|
||||
|
||||
public float getDamage(BlockPos pos) {
|
||||
public float getDamage(LocalPos pos) {
|
||||
return this.hitting && pos.equals(this.position) ? this.damage : 0.0f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,18 +2,17 @@ package client.world;
|
|||
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import client.renderer.Renderer;
|
||||
import common.block.Block;
|
||||
import common.block.ITileEntityProvider;
|
||||
import common.init.Blocks;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.world.BlockArray;
|
||||
import common.world.Chunk;
|
||||
import common.world.World;
|
||||
|
||||
public class ChunkClient extends Chunk {
|
||||
private final ConcurrentLinkedQueue<BlockPos> tileQueue = new ConcurrentLinkedQueue<BlockPos>();
|
||||
private final ConcurrentLinkedQueue<LocalPos> tileQueue = new ConcurrentLinkedQueue<LocalPos>();
|
||||
private final float[] temperatures = new float[256];
|
||||
private final float[] offsets = new float[256];
|
||||
|
||||
|
@ -124,13 +123,13 @@ public class ChunkClient extends Chunk {
|
|||
return false;
|
||||
}
|
||||
|
||||
public float getTemperature(BlockPos pos) {
|
||||
public float getTemperature(LocalPos pos) {
|
||||
int x = pos.getX() & 15;
|
||||
int z = pos.getZ() & 15;
|
||||
return this.temperatures[z << 4 | x];
|
||||
}
|
||||
|
||||
public float getOffset(BlockPos pos) {
|
||||
public float getOffset(LocalPos pos) {
|
||||
int x = pos.getX() & 15;
|
||||
int z = pos.getZ() & 15;
|
||||
return this.offsets[z << 4 | x];
|
||||
|
@ -138,7 +137,7 @@ public class ChunkClient extends Chunk {
|
|||
|
||||
public void spawnTiles() {
|
||||
while(!this.tileQueue.isEmpty()) {
|
||||
BlockPos pos = this.tileQueue.poll();
|
||||
LocalPos pos = this.tileQueue.poll();
|
||||
if(this.getTileEntity(pos, TileEntity.CreateMode.CHECK) == null && this.getBlock(pos) instanceof ITileEntityProvider) {
|
||||
TileEntity tile = this.createNewTileEntity(pos);
|
||||
this.world.setTileEntity(pos, tile);
|
||||
|
@ -147,7 +146,7 @@ public class ChunkClient extends Chunk {
|
|||
}
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity(BlockPos pos, TileEntity.CreateMode type) {
|
||||
public TileEntity getTileEntity(LocalPos pos, TileEntity.CreateMode type) {
|
||||
TileEntity tile = this.tiles.get(pos);
|
||||
|
||||
if(tile == null) {
|
||||
|
@ -167,7 +166,7 @@ public class ChunkClient extends Chunk {
|
|||
return tile;
|
||||
}
|
||||
|
||||
public int getLight(BlockPos pos) {
|
||||
public int getLight(LocalPos pos) {
|
||||
int x = pos.getX() & 15;
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ() & 15;
|
||||
|
@ -175,7 +174,7 @@ public class ChunkClient extends Chunk {
|
|||
return stor == null ? 0 : stor.getLight(x, y & 15, z);
|
||||
}
|
||||
|
||||
public void setLight(BlockPos pos, int value) {
|
||||
public void setLight(LocalPos pos, int value) {
|
||||
int x = pos.getX() & 15;
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ() & 15;
|
||||
|
|
|
@ -10,7 +10,7 @@ import common.entity.Entity;
|
|||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LocalPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.ExtMath;
|
||||
import common.world.State;
|
||||
|
@ -68,15 +68,15 @@ public class ChunkEmpty extends ChunkClient {
|
|||
return this.liquidY;
|
||||
}
|
||||
|
||||
public Block getBlock(BlockPos pos) {
|
||||
public Block getBlock(LocalPos pos) {
|
||||
return pos.getY() < this.liquidY ? this.dummyBlock : (pos.getY() == this.liquidY ? this.liquidBlock : Blocks.air);
|
||||
}
|
||||
|
||||
public int getLight(BlockPos pos) {
|
||||
public int getLight(LocalPos pos) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setLight(BlockPos pos, int value) {
|
||||
public void setLight(LocalPos pos, int value) {
|
||||
}
|
||||
|
||||
public void addEntity(Entity entity) {
|
||||
|
@ -85,14 +85,14 @@ public class ChunkEmpty extends ChunkClient {
|
|||
public void removeEntity(Entity entity) {
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity(BlockPos pos, TileEntity.CreateMode type) {
|
||||
public TileEntity getTileEntity(LocalPos pos, TileEntity.CreateMode type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addTileEntity(BlockPos pos, TileEntity tile) {
|
||||
public void addTileEntity(LocalPos pos, TileEntity tile) {
|
||||
}
|
||||
|
||||
public void removeTileEntity(BlockPos pos) {
|
||||
public void removeTileEntity(LocalPos pos) {
|
||||
}
|
||||
|
||||
public void getEntities(Entity exclude, BoundingBox bb, List<Entity> list, Predicate<? super Entity> pred) {
|
||||
|
@ -109,7 +109,7 @@ public class ChunkEmpty extends ChunkClient {
|
|||
return top < 0 || bottom > this.liquidY;
|
||||
}
|
||||
|
||||
public State getState(BlockPos pos) {
|
||||
public State getState(LocalPos pos) {
|
||||
if(this.debug) {
|
||||
State state = pos.getY() == 1 ? getDebug(pos.getX(), pos.getZ()) : null;
|
||||
return state == null ? Blocks.air.getState() : state;
|
||||
|
@ -117,12 +117,12 @@ public class ChunkEmpty extends ChunkClient {
|
|||
return pos.getY() < this.liquidY ? this.dummy : (pos.getY() == this.liquidY ? this.liquid : Blocks.air.getState());
|
||||
}
|
||||
|
||||
public State setState(BlockPos pos, State state, boolean updateLight) {
|
||||
public State setState(LocalPos pos, State state, boolean updateLight) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public BlockPos getPrecipitation(BlockPos pos) {
|
||||
return new BlockPos(pos.getX(), this.liquidY + 1, pos.getZ());
|
||||
public LocalPos getPrecipitation(LocalPos pos) {
|
||||
return new LocalPos(pos.getX(), this.liquidY + 1, pos.getZ());
|
||||
}
|
||||
|
||||
public void spawnTiles() {
|
||||
|
@ -134,11 +134,11 @@ public class ChunkEmpty extends ChunkClient {
|
|||
public void setData(byte[] data, int[] extend, boolean biomes) {
|
||||
}
|
||||
|
||||
public float getTemperature(BlockPos pos) {
|
||||
public float getTemperature(LocalPos pos) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public float getOffset(BlockPos pos) {
|
||||
public float getOffset(LocalPos pos) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue