1
0
Fork 0

improve visuals

This commit is contained in:
Sen 2025-08-30 09:07:15 +02:00
parent b25dd6161a
commit e3e5fbd7fd
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
15 changed files with 31 additions and 64 deletions

View file

@ -3874,6 +3874,8 @@ public class Renderer {
int i = 0;
float f = 0.0F;
int n = 0;
int a = 0;
int s = 0;
for (int j = 0; j < 4; ++j)
{
@ -3893,14 +3895,16 @@ public class Renderer {
if (!material.isNonBlock()) // material != block
{
if (material == Blocks.air)
if (!material.canConnectNonBlock())
{
++a;
f += 4;
++i;
}
}
else
{
++s;
f += 1.0F / 9.0f;
i += 10;
@ -3909,6 +3913,6 @@ public class Renderer {
}
}
return n == 4 ? 1.0f : 1.0F - f / (float)i;
return n == 4 ? 1.0f : (s + a == 4 && a > 1 ? 0.0f : 1.0F - f / (float)i);
}
}

View file

@ -57,7 +57,7 @@ public enum Shader {
context.integer("n_lights", 0);
context.color3("specular", Client.CLIENT.specularColors && !Client.CLIENT.setGamma && !Client.CLIENT.xrayActive ? 0xffffff : 0x000000);
context.bool("shade", Client.CLIENT.flatShading);
context.bool("shade", Client.CLIENT.flatShading || Client.CLIENT.setGamma || Client.CLIENT.xrayActive);
GlState.setActiveTexture(GL46.GL_TEXTURE0);
// glBindBufferBase(GL_UNIFORM_BUFFER, 0, world->light_buf);

View file

@ -31,8 +31,6 @@ import common.util.Vec3i;
public class RenderItem
{
private static final String RES_ITEM_GLINT = "textures/glint.png";
private final ItemModelMesher mesher;
private final TextureManager manager;
private final LayerArmor armor = new LayerArmor(null, 12, 12) {
@ -99,11 +97,6 @@ public class RenderItem
{
GL46.glTranslatef(-0.5F, -0.5F, -0.5F);
this.renderModel(model, stack);
if (stack.getItem().isGleaming(stack))
{
this.renderEffect(model);
}
}
GL46.glPopMatrix();
@ -171,36 +164,6 @@ public class RenderItem
}
}
private void renderEffect(IBakedModel model)
{
GlState.depthMask(false);
GlState.depthFunc(GL46.GL_EQUAL);
GlState.disableLighting();
GlState.blendFunc(GL46.GL_SRC_COLOR, GL46.GL_ONE);
this.manager.bindTexture(RES_ITEM_GLINT);
GL46.glMatrixMode(GL46.GL_TEXTURE);
GL46.glPushMatrix();
GL46.glScalef(8.0F, 8.0F, 8.0F);
float f = (float)(System.currentTimeMillis() % 3000L) / 3000.0F / 8.0F;
GL46.glTranslatef(f, 0.0F, 0.0F);
GL46.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
this.renderModel(model, -8372020);
GL46.glPopMatrix();
GL46.glPushMatrix();
GL46.glScalef(8.0F, 8.0F, 8.0F);
float f1 = (float)(System.currentTimeMillis() % 4873L) / 4873.0F / 8.0F;
GL46.glTranslatef(-f1, 0.0F, 0.0F);
GL46.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
this.renderModel(model, -8372020);
GL46.glPopMatrix();
GL46.glMatrixMode(GL46.GL_MODELVIEW);
GlState.blendFunc(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA);
GlState.enableLighting();
GlState.depthFunc(GL46.GL_LEQUAL);
GlState.depthMask(true);
this.manager.bindTexture(TextureMap.BLOCKS);
}
private void putQuadNormal(RenderBuffer renderer, BakedQuad quad)
{
Vec3i vec3i = quad.getFace().getDirectionVec();

View file

@ -22,7 +22,7 @@ uniform bool shade;
void main() {
vec3 nvertex = vec3(model * vec4(pos, 1.0));
vertex = vec3(float(chunk_x) + pos.x, float(chunk_y) + pos.y, float(chunk_z) + pos.z);
shading = shade ? (norm.x != 0.0 ? 0.6 : (norm.z != 0.0 ? 0.8 : (norm.y < 0.0 ? 0.5 : 1.0))) : 1.0;
shading = shade ? (norm.x != 0.0 ? 0.6 : (norm.z != 0.0 ? 0.8 : (norm.y > 0.0 ? 0.5 : 1.0))) : 1.0;
normal = mat3(transpose(inverse(model))) * norm.xyz;
shine = norm.a * 32.0;
tex_coord = coord;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 992 B

View file

@ -648,10 +648,6 @@ public class Block {
return true;
}
public boolean isNonBlock() {
return false;
}
public boolean isPassable(IBlockAccess world, BlockPos pos) {
return !this.material.blocksMovement();
}
@ -1100,4 +1096,14 @@ public class Block {
public String getInfo(World world, BlockPos pos, State state, EntityNPC player) {
return null;
}
@Clientside
public boolean isNonBlock() {
return false;
}
@Clientside
public boolean canConnectNonBlock() {
return true;
}
}

View file

@ -2,6 +2,7 @@ package common.block;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.Clientside;
import common.world.State;
import common.world.World;
@ -36,4 +37,9 @@ public final class BlockAir extends Block {
protected boolean hasRegisteredItem() {
return false;
}
@Clientside
public boolean canConnectNonBlock() {
return false;
}
}

View file

@ -8,6 +8,7 @@ import common.model.Model;
import common.rng.Random;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.Clientside;
import common.util.Facing;
import common.world.State;
import common.world.World;
@ -87,6 +88,11 @@ public class BlockBush extends Block
{
return false;
}
@Clientside
public boolean canConnectNonBlock() {
return false;
}
public static Model makeCrossModel(Model model) {
return model

View file

@ -283,7 +283,7 @@ public abstract class ItemRegistry {
register("melon_seed", new ItemSeeds(Blocks.melon_stem, Blocks.farmland).setDisplay("Melonenkerne").setMaxAmount(StackSize.XL));
register("whip", (new ItemWhip()).setDisplay("Peitsche"));
register("charge_crystal", (new Item()).setDisplay("Energiekristall").setTab(CheatTab.MATERIALS).setColor(Color.DARK_MAGENTA).setGleaming().setFuelAmount(120000));
register("charge_crystal", (new Item()).setDisplay("Energiekristall").setTab(CheatTab.MATERIALS).setColor(Color.DARK_MAGENTA).setFuelAmount(120000));
for(Enchantment ench : Enchantment.values()) {
register("enchanted_book_" + ench.getName(), (new ItemEnchantedBook(ench, 1)).setUnstackable().setDisplay("Verzaubertes Buch mit " + ench.getFormattedName(1)).setTab(CheatTab.ENCHANTMENTS));
int max = ench.getMaxLevel();

View file

@ -36,7 +36,6 @@ public class Item {
private int fuelAmount = 0;
private int explosive = 0;
private boolean magnetic = false;
private boolean gleaming = false;
private boolean fragile = false;
public Item() {
@ -108,11 +107,6 @@ public class Item {
return this;
}
public final Item setGleaming() {
this.gleaming = true;
return this;
}
public final Item setFragile() {
this.fragile = true;
return this;
@ -181,11 +175,6 @@ public class Item {
return this.magnetic;
}
@Clientside
public final boolean isGleaming(ItemStack stack) {
return this.gleaming || stack.isItemEnchanted();
}
public final boolean isFragile() {
return this.fragile;
}

View file

@ -16,8 +16,6 @@ public class ItemAppleGold extends ItemFood
super(amount, false);
this.powered = powered;
this.setColor(powered ? Color.MAGENTA : Color.NEON);
if(this.powered)
this.setGleaming();
}
protected void onFoodEaten(ItemStack stack, World worldIn, EntityNPC player)

View file

@ -77,8 +77,6 @@ public class ItemPotion extends Item
this.setColor(Color.ORK);
this.setDisplay(getDisplay(this));
this.setFragile();
if(this.effect != null)
this.setGleaming();
POTIONS.add(this);
}

View file

@ -26,7 +26,6 @@ public class ItemEnchantedBook extends Item
public ItemEnchantedBook(Enchantment enchantment, int level) {
this.setColor(Color.YELLOW);
this.setGleaming();
this.setFuelAmount(80);
this.enchantment = enchantment;
this.level = level;

View file

@ -12,7 +12,6 @@ public class ItemEditor extends Item {
public ItemEditor() {
this.setUnstackable();
this.setTab(CheatTab.TOOLS);
this.setGleaming();
}
public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, BlockPos block) {

View file

@ -21,7 +21,6 @@ public abstract class ItemWand extends Item {
public ItemWand() {
this.setUnstackable();
this.setTab(CheatTab.TOOLS);
this.setGleaming();
}
public final boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, BlockPos block) {