Fixed torches not having a bottom texture
parent
435294533a
commit
21cf7a6aeb
|
@ -148,6 +148,15 @@ After:<br>
|
|||
|
||||
</details>
|
||||
|
||||
<details><summary>Fixes torches (and redstone torches) not having a bottom texture</summary>
|
||||
|
||||
Before:
|
||||
![torches without a bottom texture](https://i.imgur.com/pueAKg3.png)
|
||||
|
||||
After:
|
||||
![torches with a bottom texture](https://i.imgur.com/pBmy6UX.png)
|
||||
|
||||
</details>
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ public class WyHelper {
|
|||
public static float clamp(float val, float min, float max) {
|
||||
return val < min ? min : Math.min(val, max);
|
||||
}
|
||||
|
||||
|
||||
public static void cheatCommand(Player player) {
|
||||
Random rand = new Random();
|
||||
// player.level.playSound(player, "random.break", 1, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
|
||||
|
||||
// player.dropItem(new ItemInstance(ItemType.minecart, 1), false);
|
||||
// player.dropItem(new ItemInstance(Tile.GLASS, 1), false);
|
||||
|
||||
// player.dropItem(new ItemInstance(ItemType.bow, 1), false);
|
||||
// player.dropItem(new ItemInstance(ItemType.arrow, 64), false);
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
package xyz.pixelatedw.betterbeta.mixin;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
import net.minecraft.client.render.TileRenderer;
|
||||
import net.minecraft.tile.Tile;
|
||||
|
||||
@Mixin(TileRenderer.class)
|
||||
public class TileRendererMixin {
|
||||
|
||||
@Shadow
|
||||
private int field_83;
|
||||
|
||||
@Inject(method = "method_45", at = @At("HEAD"), cancellable = true)
|
||||
public void torchRenderer(Tile arg, double x, double y, double z, double w, double h, CallbackInfo ci) {
|
||||
Tessellator tess = Tessellator.INSTANCE;
|
||||
int tex = arg.getTextureForSide(0);
|
||||
if (this.field_83 >= 0) {
|
||||
tex = this.field_83;
|
||||
}
|
||||
|
||||
int var14 = (tex & 15) << 4;
|
||||
int var15 = tex & 240;
|
||||
float u = var14 / 256.0F;
|
||||
float u2 = (var14 + 15.99F) / 256.0F;
|
||||
float v = var15 / 256.0F;
|
||||
float v2 = (var15 + 15.99F) / 256.0F;
|
||||
double var20 = u + 0.02734375D;
|
||||
double var22 = v + 0.0234375D;
|
||||
double var24 = u + 0.03515625D;
|
||||
double var26 = v + 0.03125D;
|
||||
x += 0.5D;
|
||||
z += 0.5D;
|
||||
double var28 = x - 0.5D;
|
||||
double var30 = x + 0.5D;
|
||||
double var32 = z - 0.5D;
|
||||
double var34 = z + 0.5D;
|
||||
double var36 = 0.0625D;
|
||||
double var38 = 0.625D;
|
||||
|
||||
tess.vertex(x + w * (1.0D - var38) - var36, y + var38, z + h * (1.0D - var38) - var36, var20, var22);
|
||||
tess.vertex(x + w * (1.0D - var38) - var36, y + var38, z + h * (1.0D - var38) + var36, var20, var26);
|
||||
tess.vertex(x + w * (1.0D - var38) + var36, y + var38, z + h * (1.0D - var38) + var36, var24, var26);
|
||||
tess.vertex(x + w * (1.0D - var38) + var36, y + var38, z + h * (1.0D - var38) - var36, var24, var22);
|
||||
|
||||
tess.vertex(x - var36, y + 1.0D, var32, u, v);
|
||||
tess.vertex(x - var36 + w, y + 0.0D, var32 + h, u, v2);
|
||||
tess.vertex(x - var36 + w, y + 0.0D, var34 + h, u2, v2);
|
||||
tess.vertex(x - var36, y + 1.0D, var34, u2, v);
|
||||
|
||||
tess.vertex(x + var36, y + 1.0D, var34, u, v);
|
||||
tess.vertex(x + w + var36, y + 0.0D, var34 + h, u, v2);
|
||||
tess.vertex(x + w + var36, y + 0.0D, var32 + h, u2, v2);
|
||||
tess.vertex(x + var36, y + 1.0D, var32, u2, v);
|
||||
|
||||
tess.vertex(var28, y + 1.0D, z + var36, u, v);
|
||||
tess.vertex(var28 + w, y + 0.0D, z + var36 + h, u, v2);
|
||||
tess.vertex(var30 + w, y + 0.0D, z + var36 + h, u2, v2);
|
||||
tess.vertex(var30, y + 1.0D, z + var36, u2, v);
|
||||
|
||||
tess.vertex(var30, y + 1.0D, z - var36, u, v);
|
||||
tess.vertex(var30 + w, y + 0.0D, z - var36 + h, u, v2);
|
||||
tess.vertex(var28 + w, y + 0.0D, z - var36 + h, u2, v2);
|
||||
tess.vertex(var28, y + 1.0D, z - var36, u2, v);
|
||||
|
||||
double u3 = u + 0.02734375D;
|
||||
double v3 = v + 0.0434375D;
|
||||
double u4 = u + 0.03515625D;
|
||||
double v4 = v + 0.05125D;
|
||||
double w2 = 0.0625D;
|
||||
|
||||
tess.vertex(x + w * 1.0D - w2, y, z + h * 1.0D + w2, u3, v3);
|
||||
tess.vertex(x + w * 1.0D - w2, y, z + h * 1.0D - w2, u3, v4);
|
||||
tess.vertex(x + w * 1.0D + w2, y, z + h * 1.0D - w2, u4, v4);
|
||||
tess.vertex(x + w * 1.0D + w2, y, z + h * 1.0D + w2, u4, v3);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
|
@ -21,7 +21,8 @@
|
|||
"MinecraftMixin",
|
||||
"MinecartMixin",
|
||||
"LivingEntityRendererMixin",
|
||||
"FishHookMixin"
|
||||
"FishHookMixin",
|
||||
"TileRendererMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
Loading…
Reference in New Issue