This commit is contained in:
retuci0 committed 2026-01-04 11:40:06 +01:00
1 parent 94a9b1dade
commit dc2429918e
49 files changed
+1027 -200

No files matched your search

+10 -13
View File
@@ -1,29 +1,26 @@
# v2.1 (roto)
# v2.2
## novedades
- actualizado a la 1.21.11 (maomeno)
- elementos del hud con imágenes
### adiciones
- categorías de módulos: ahora puedes buscar "cámara", "jugador", "mundo", "renderizado", "red", "cliente" o "misc" para que se filtren los módulos de esas categorías, respectivamente
- elementos del hud de dinosaurios (autismaxxing), echest (items del echest) y totems (totems restantes en el inventario)
#### módulos nuevos:
- muletas: hace te no te caigas (de bloques), como cuando estás agachado, pero sin agacharte
- conejo: haz el elytra-bounce más fácilmente
### arreglos / mejoras
- ahora ya puedes escribir espacios en la barra de búsqueda
- ahora se ignoran las tildes al buscar en la barra de búsqueda
- aviso de baja dur. ya no te avisa al reparar objetos dañados por debajo del límite
- creo que cielo custom ya funciona por completo (las fases lunares)
- ya no te puedes mover con una interfaz abierta en modo cámara libre
- minar sin interrupción ya va
- destello de enchants ya funciona
- ahora no siempre se verá a traves de paredes al renderizar (ej.: superposición de luz)
- el renderizado de líneas ya se adapta bien a la posición de la cámara
- la superposición de daño ya funciona
## problemas reconocidos
- muchos, pero repórtalos en la página de problemas si quieres para que queden bien registrados
- de esta actualización:
- superposición de daño no funciona porque no lo he podido actualizar porque han cambiado cosas relacionadas a la renderización
- la renderización de líneas (no rellenos) está rota, por el mismo motivo
- por el mismo motivo, destello de enchants no funciona
- minar sin interrupción no funciona
+1
View File
@@ -6,6 +6,7 @@ No Telemetry: https://modrinth.com/mod/no-telemetry
Trouser Streak: https://github.com/etianl/Trouser-Streak
No More Purple: https://github.com/Pepperoni-Jabroni/NoMorePurple/
bypass-resource-pack: https://github.com/emilyy-dev/bypass-resource-pack
elytra-recast: https://github.com/InLieuOfLuna/elytra-recast/
probablemente más pero como tengo demencia se me olvida
si quieres que te acredite o quite tu código de mi mod, mándame un mensaje en discord (username: retucio) y sin problemas :)
+1 -1
View File
@@ -8,6 +8,6 @@ loom_version=1.13-SNAPSHOT
fabric_api_version=0.140.2+1.21.11
mod_version=2.1
mod_version=2.2
maven_group=me.retucio
archives_base_name=camtweaks
@@ -32,6 +32,9 @@ public class ClientConfig {
// id del elemento del hud -> true: visible / false: no visible
public Map<String, Boolean> hudVisibilities = new HashMap<>();
// id del elemento del hud -> ruta de la imagen (NEW)
public Map<String, String> hudImagePaths = new HashMap<>();
// posición de la barra de búsqueda (x, y)
public int[] searchBarPosition = new int[]{340, 16};
@@ -122,6 +122,17 @@ public class ConfigManager {
save();
}
public static void setHudImagePath(String id, String imagePath) {
ensureConfig();
config.hudImagePaths.put(id, imagePath);
save();
}
public static String getHudImagePath(String id) {
ensureConfig();
return config.hudImagePaths.getOrDefault(id, "");
}
public static void setSearchBarPosition(int x, int y) {
ensureConfig();
config.searchBarPosition = new int[] {x, y};
@@ -10,29 +10,36 @@ import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.Vec3d;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import static me.retucio.camtweaks.CameraTweaks.mc;
@Mixin(ClientPlayerEntity.class)
public abstract class ClientPlayerEntityMixin {
@Shadow
private static HitResult checkCrosshairTargetRange(HitResult hitResult, Vec3d cameraPos, double range) {
return null;
}
@ModifyExpressionValue(method = "tickNausea", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;", opcode = Opcodes.GETFIELD))
private Screen allowScreensInPortals(Screen original) {
if (ModuleManager.INSTANCE.getModuleByClass(PortalGUI.class).isEnabled()) return null;
return original;
}
@ModifyReturnValue(method = "getCrosshairTarget(FLnet/minecraft/entity/Entity;)Lnet/minecraft/util/hit/HitResult;", at = @At("RETURN"))
private static HitResult onGetCrosshairTarget(HitResult original, @Local HitResult hitResult) {
// no va??
@ModifyReturnValue(method = "getCrosshairTarget(Lnet/minecraft/entity/Entity;DDF)Lnet/minecraft/util/hit/HitResult;", at = @At("RETURN"))
private static HitResult onUpdateTargetedEntity(HitResult original, @Local HitResult hitResult, @Local(ordinal = 0) Vec3d vec3d) {
NoMiningInterruptions nmi = ModuleManager.INSTANCE.getModuleByClass(NoMiningInterruptions.class);
if (original instanceof EntityHitResult ehr) {
if (nmi.shouldIgnoreEntity(ehr.getEntity())
&& hitResult.getType() == HitResult.Type.BLOCK) {
return hitResult;
}
}
return original;
if (!(original instanceof EntityHitResult ehr)) return original;
if (!nmi.shouldIgnoreEntity((ehr.getEntity()))) return original;
return checkCrosshairTargetRange(hitResult, vec3d, mc.player.getEntityInteractionRange());
}
}
@@ -0,0 +1,50 @@
package me.retucio.camtweaks.mixin;
import me.retucio.camtweaks.module.ModuleManager;
import me.retucio.camtweaks.module.modules.player.ElytraBounce;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import static me.retucio.camtweaks.CameraTweaks.mc;
@Mixin(LivingEntity.class)
public abstract class LivingEntityMixin {
@Unique private boolean prevElytra = false;
@Unique private boolean awaitingElytra = false;
@Shadow
public abstract boolean isGliding();
@SuppressWarnings("ConstantConditions")
@Inject(method = "tickMovement", at = @At("TAIL"))
public void recastIfLanded(CallbackInfo ci) {
ElytraBounce bounce = ModuleManager.INSTANCE.getModuleByClass(ElytraBounce.class);
if (!((Object) this instanceof ClientPlayerEntity)
|| mc.player == null
|| bounce == null)
return;
boolean elytra = isGliding();
if (awaitingElytra) {
if (elytra) awaitingElytra = false;
} else if (!elytra && prevElytra) {
mc.getSoundManager().stopSounds(SoundEvents.ITEM_ELYTRA_FLYING.id(), SoundCategory.PLAYERS);
bounce.bounce();
awaitingElytra = bounce.canUseElytra();
}
prevElytra = elytra;
}
}
@@ -4,6 +4,7 @@ import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(KeyBinding.class)
public interface KeyBindingAccessor {
@@ -0,0 +1,14 @@
package me.retucio.camtweaks.mixin.accessor;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.texture.NativeImageBackedTexture;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(OverlayTexture.class)
public interface OverlayTextureAccessor {
@Mutable @Accessor("texture")
void setTexture(NativeImageBackedTexture texture);
}
@@ -43,6 +43,7 @@ public class ModuleManager {
modules.add(new ColoredSigns());
modules.add(new CritsPlus());
modules.add(new DamageOverlay());
modules.add(new ElytraBounce());
modules.add(new FakePlayer());
modules.add(new FastUse());
modules.add(new Freecam());
@@ -212,6 +212,8 @@ public class Freecam extends Module {
@SubscribeEvent
public void onKey(KeyEvent event) {
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_F3)) return;
if (mc.currentScreen != null) return;
KeyInput key = new KeyInput(event.getKey(), event.getScancode(), 0);
boolean shouldCancel = true;
@@ -242,6 +244,9 @@ public class Freecam extends Module {
@SubscribeEvent
public void onMouseClick(MouseClickEvent event) { // por si el restrasado del usuario usa el ratón para moverse
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_F3)) return;
if (mc.currentScreen != null) return;
Click click = new Click(0, 0, new MouseInput(event.getButton(), 0));
boolean shouldCancel = true;
@@ -1,11 +1,13 @@
package me.retucio.camtweaks.module.modules.client;
import me.retucio.camtweaks.CameraTweaks;
import me.retucio.camtweaks.module.Category;
import me.retucio.camtweaks.module.Module;
import me.retucio.camtweaks.module.settings.*;
import me.retucio.camtweaks.ui.hud.HudElement;
import me.retucio.camtweaks.ui.hud.HudRenderer;
import me.retucio.camtweaks.ui.hud.HudEditorScreen;
import me.retucio.camtweaks.ui.hud.elements.DynoElement;
import org.lwjgl.glfw.GLFW;
import java.awt.*;
@@ -32,6 +34,8 @@ public class HUD extends Module {
public EnumSetting<TimeFormat> timeFormat = addSetting(new EnumSetting<>("formato de la hora", "12h o 24h", TimeFormat.class, TimeFormat.TWENTY_FOUR_HOUR));
public StringSetting customText = addSetting(new StringSetting("texto custom", "marca de agua (dejar vacío para quitar)", "adolf jitler inshtagram feishbuc twiter", 40));
public EnumSetting<CoordsMode> coordsMode = addSetting(new EnumSetting<>("modo de coordenadas", "qué coordenadas mostrar", CoordsMode.class, CoordsMode.OVERWORLD));
public EnumSetting<Dynosaurs> dyno = addSetting(new EnumSetting<>("dinosaurio", "qué dinosaurio mostrar",
Dynosaurs.class, Dynosaurs.SPINOSAURUS));
public HUD() {
super("HUD",
@@ -39,6 +43,11 @@ public class HUD extends Module {
Category.CLIENT,
GLFW.GLFW_KEY_F12
);
dyno.onUpdate(v -> {
DynoElement element = (DynoElement) HudRenderer.getElement(DynoElement.class);
if (element != null) element.reloadTexture();
});
}
public enum TimeFormat {
@@ -59,4 +68,18 @@ public class HUD extends Module {
CoordsMode(String name) { this.name = name; }
@Override public String toString() { return name; }
}
public enum Dynosaurs {
ANKYLOSAURUS("anquilosaurio"),
PTERODACTYL("ptetodáctilo"),
SPINOSAURUS("espinosaurio"),
TREX("t-rex"),
TRICERATOPS("tricerátops"),
VELOCIRRAPTOR("velocirráptor");
private final String name;
Dynosaurs(String name) { this.name = name; }
@Override public String toString() { return name; }
public String toRealString() { return super.toString(); }
}
}
@@ -17,7 +17,9 @@ import net.minecraft.client.network.PlayerListEntry;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.world.dimension.DimensionType;
import java.awt.*;
@@ -243,18 +245,19 @@ public class LogoutSpots extends Module {
public void renderBox(MatrixStack matrices) {
if (fullHeight.isEnabled()) {
if (outlines.isEnabled())
RenderUtil.drawOutlineBox(matrices, new Box(x, y, z, x + xWidth, y + height, z + zWidth), outlineColor.getColor(), lineWidth.getFloatValue());
RenderUtil.drawOutlineBox(matrices, new Box(x, y, z, x + xWidth, y + height, z + zWidth), outlineColor.getColor(), lineWidth.getFloatValue(), true);
if (filling.isEnabled())
RenderUtil.drawFilledBox(matrices, new Box(x, y, z, x + xWidth, y + height, z + zWidth), fillingColor.getColor());
RenderUtil.drawFilledBox(matrices, new Box(x, y, z, x + xWidth, y + height, z + zWidth), fillingColor.getColor(), true);
} else {
if (outlines.isEnabled()) {
Box bottomBox = new Box(x, y, z, x + xWidth, y + 0.01, z + zWidth);
RenderUtil.drawOutlineBox(matrices, bottomBox, outlineColor.getColor(), lineWidth.getFloatValue());
RenderUtil.drawBlockFaceOutlines(matrices,
BlockPos.ofFloored(x + halfWidth, y, z + halfWidth),
Direction.UP, outlineColor.getColor(), lineWidth.getFloatValue(), true);
}
if (filling.isEnabled()) {
RenderUtil.drawBlockFaceFilled(matrices,
net.minecraft.util.math.BlockPos.ofFloored(x + halfWidth, y, z + halfWidth),
net.minecraft.util.math.Direction.UP, fillingColor.getColor(), 0.001f);
BlockPos.ofFloored(x + halfWidth, y, z + halfWidth),
Direction.UP, fillingColor.getColor(), 0.001f, true);
}
}
}
@@ -0,0 +1,57 @@
package me.retucio.camtweaks.module.modules.player;
import me.retucio.camtweaks.module.Category;
import me.retucio.camtweaks.module.Module;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket;
// https://github.com/InLieuOfLuna/elytra-recast/
public class ElytraBounce extends Module {
public ElytraBounce() {
super("conejo", "haz el elytra-bounce manteniendo el espacio", Category.PLAYER);
}
public boolean bounce() {
if (canUseElytra() && canBounce()) {
if (mc.getNetworkHandler() != null)
mc.getNetworkHandler().sendPacket(new ClientCommandC2SPacket(
mc.player,
ClientCommandC2SPacket
.Mode.START_FALL_FLYING)
);
return true;
} else {
return false;
}
}
public boolean canUseElytra() {
if (mc.player.input.playerInput.jump()
&& !mc.player.getAbilities().flying
&& !mc.player.hasVehicle()
&& !mc.player.isClimbing()) {
ItemStack stack = mc.player.getEquippedStack(EquipmentSlot.CHEST);
return stack.isOf(Items.ELYTRA) && LivingEntity.canGlideWith(stack, EquipmentSlot.CHEST);
} else {
return false;
}
}
public boolean canBounce() {
if (!mc.player.isTouchingWater() && !mc.player.hasStatusEffect(StatusEffects.LEVITATION)) {
ItemStack stack = mc.player.getEquippedStack(EquipmentSlot.CHEST);
if (stack.isOf(Items.ELYTRA) && LivingEntity.canGlideWith(stack, EquipmentSlot.CHEST)) {
mc.player.startGliding();
return true;
} else
return false;
} else
return false;
}
}
@@ -2,9 +2,12 @@ package me.retucio.camtweaks.module.modules.player;
import me.retucio.camtweaks.module.Category;
import me.retucio.camtweaks.module.Module;
import me.retucio.camtweaks.module.settings.NumberSetting;
public class Headhitters extends Module {
public NumberSetting delay = addSetting(new NumberSetting("delay", "delay de saltos", 0, 0, 20, 1));
public Headhitters() {
super("headhitters",
"mantén pulsado el espacio para hacer headhitting sin tener que espamearlo",
@@ -14,6 +17,6 @@ public class Headhitters extends Module {
@Override
public void onTick() {
if (mc.player == null) return;
mc.player.jumpingCooldown = 0;
mc.player.jumpingCooldown = delay.getIntValue();
}
}
@@ -8,10 +8,13 @@ import me.retucio.camtweaks.module.settings.BooleanSetting;
import me.retucio.camtweaks.module.settings.ColorSetting;
import me.retucio.camtweaks.module.settings.ListSetting;
import me.retucio.camtweaks.module.settings.NumberSetting;
import me.retucio.camtweaks.util.ChatUtil;
import me.retucio.camtweaks.util.Colors;
import me.retucio.camtweaks.util.Lists;
import me.retucio.camtweaks.util.render.RenderUtil;
import net.minecraft.block.Block;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraft.util.shape.VoxelShape;
@@ -63,14 +66,16 @@ public class BlockESP extends Module {
getVoxelShape(pos),
pos,
outlineColor.getColor(),
lineWidth.getFloatValue());
lineWidth.getFloatValue(),
false);
}
if (fillings.isEnabled()) {
RenderUtil.drawVoxelShapeFilled(
event.getMatrices(),
getVoxelShape(pos),
pos,
fillingColor.getColor());
fillingColor.getColor(),
false);
}
}
}
@@ -68,8 +68,8 @@ public class BreakingProgress extends Module {
centerX + shrunkX, centerY + shrunkZ, centerZ + shrunkZ
);
if (outlines.isEnabled()) RenderUtil.drawOutlineBox(event.getMatrices(), scaledBox, outlineColor.getColor(), lineWidth.getFloatValue());
if (fillings.isEnabled()) RenderUtil.drawFilledBox(event.getMatrices(), scaledBox, fillingColor.getColor());
if (outlines.isEnabled()) RenderUtil.drawOutlineBox(event.getMatrices(), scaledBox, outlineColor.getColor(), lineWidth.getFloatValue(), false);
if (fillings.isEnabled()) RenderUtil.drawFilledBox(event.getMatrices(), scaledBox, fillingColor.getColor(), false);
}
public enum BreakMode {
@@ -1,8 +1,10 @@
package me.retucio.camtweaks.module.modules.render;
import me.retucio.camtweaks.mixin.accessor.OverlayTextureAccessor;
import me.retucio.camtweaks.module.Category;
import me.retucio.camtweaks.module.Module;
import me.retucio.camtweaks.module.settings.ColorSetting;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.texture.NativeImageBackedTexture;
@@ -70,12 +72,11 @@ public class DamageOverlay extends Module {
// resubir las texturas
private void uploadTexture() {
// GpuTextureView overlayTex = RenderSystem.getDevice().getShaderTexture(33985);
// RenderSystem.setShaderTexture(33985, overlayTex);
//
// texture.upload();
//
// GpuTextureView mainTex = RenderSystem.getShaderTexture(33984);
// RenderSystem.setShaderTexture(33984, mainTex);
if (mc.gameRenderer == null) return;
((OverlayTextureAccessor) mc.gameRenderer.getOverlayTexture())
.setTexture(this.texture);
texture.upload();
}
}
@@ -8,6 +8,9 @@ import me.retucio.camtweaks.module.settings.BooleanSetting;
import me.retucio.camtweaks.module.settings.ColorSetting;
import me.retucio.camtweaks.module.settings.NumberSetting;
import me.retucio.camtweaks.util.render.RenderUtil;
import net.minecraft.block.*;
import net.minecraft.block.Blocks;
import net.minecraft.entity.EntityType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.LightType;
@@ -52,8 +55,8 @@ public class LightOverlay extends Module {
}
for (BlockPos block : blocks) {
if (mc.world.getBlockState(block).isAir() || !mc.world.getBlockState(block.up()).isAir()) continue;
if (!mc.world.isTopSolid(block, mc.player) || !mc.world.getBlockState(block).isOpaque()) continue;
if (mc.world.getBlockState(block).isAir() || !canSpawnOn(block)) continue;
if (!mc.world.getBlockState(block).isOpaque()) continue;
int light = mc.world.getLightLevel(LightType.BLOCK, block.up());
Color color = light == 0 ? darknessColor.getColor()
@@ -63,7 +66,7 @@ public class LightOverlay extends Module {
(lightColor.getB() / 15) * light,
lightColor.getA());
RenderUtil.drawBlockFaceFilled(event.getMatrices(), block, Direction.UP, color, 0.001f);
RenderUtil.drawBlockFaceFilled(event.getMatrices(), block, Direction.UP, color, 0.001f, true);
}
}
@@ -85,9 +88,8 @@ public class LightOverlay extends Module {
for (int z = minZ; z <= maxZ; z++) {
for (int y = minY; y <= maxY; y++) {
BlockPos current = new BlockPos(x, y, z);
BlockPos above = current.up();
if (!mc.world.isAir(current) && (mc.world.isAir(above) || (mc.world.isWater(above) && onWater.isEnabled())))
if (!mc.world.isAir(current) && canSpawnOn(current))
results.add(current);
}
}
@@ -95,4 +97,47 @@ public class LightOverlay extends Module {
return results;
}
private boolean canSpawnOn(BlockPos pos) {
BlockState aboveState = mc.world.getBlockState(pos.up());
Block aboveBlock = aboveState.getBlock();
if (aboveState.isAir()) return true;
if (aboveBlock == Blocks.WATER && onWater.isEnabled()) return true;
if (aboveBlock instanceof PlantBlock) return true;
if (!aboveState.isOpaque() && !aboveState.isFullCube(mc.world, pos.up())) {
if (aboveBlock instanceof SlabBlock
|| aboveBlock instanceof StairsBlock
|| aboveBlock instanceof ButtonBlock
|| aboveBlock instanceof CarpetBlock
|| aboveBlock instanceof PressurePlateBlock
|| aboveBlock instanceof PaneBlock
|| aboveBlock instanceof TrapdoorBlock
|| aboveBlock instanceof FenceBlock
|| aboveBlock instanceof WallBlock
|| aboveBlock instanceof AnvilBlock
|| aboveBlock instanceof BedBlock) {
return false;
}
if (aboveBlock == Blocks.CHEST ||
aboveBlock == Blocks.ENDER_CHEST ||
aboveBlock == Blocks.BARREL ||
aboveBlock == Blocks.TRAPPED_CHEST) {
return false;
}
return aboveBlock != Blocks.ENCHANTING_TABLE
&& aboveBlock != Blocks.GRINDSTONE
&& aboveBlock != Blocks.STONECUTTER
&& aboveBlock != Blocks.LOOM
&& aboveBlock != Blocks.COMPOSTER
&& aboveBlock != Blocks.CAKE;
}
return true;
}
}
@@ -4,6 +4,7 @@ import me.retucio.camtweaks.module.Category;
import me.retucio.camtweaks.module.Module;
import me.retucio.camtweaks.module.settings.BooleanSetting;
import me.retucio.camtweaks.module.settings.ListSetting;
import me.retucio.camtweaks.util.ChatUtil;
import me.retucio.camtweaks.util.Lists;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
@@ -22,14 +23,13 @@ public class NoMiningInterruptions extends Module {
}
public boolean shouldIgnoreEntity(Entity entity) {
if (entity == null || !this.isEnabled() || mc.player == null) return false;
if (entity == null || !isEnabled() || mc.player == null) return false;
boolean pickaxe = true;
if (withPickaxeOnly.isEnabled())
return (mc.player.getMainHandStack().isIn(ItemTags.PICKAXES)
pickaxe = (mc.player.getMainHandStack().isIn(ItemTags.PICKAXES)
|| mc.player.getOffHandStack().isIn(ItemTags.PICKAXES));
return entities.isEnabled(entity.getType());
return entities.isEnabled(entity.getType()) && pickaxe;
}
}
@@ -112,8 +112,8 @@ public class HudEditorScreen extends Screen {
int newX = mouseX - dragOffsetX;
int newY = mouseY - dragOffsetY;
newX = Math.max(1, Math.min(newX, width - selected.getWidth() - 1));
newY = Math.max(1, Math.min(newY, height - selected.getHeight() - 1));
newX = Math.max(1, Math.min(newX, width - selected.getW() - 1));
newY = Math.max(1, Math.min(newY, height - selected.getH() - 1));
selected.setPosition(newX, newY);
return true;
@@ -1,81 +1,38 @@
package me.retucio.camtweaks.ui.hud;
import me.retucio.camtweaks.module.modules.client.HUD;
import me.retucio.camtweaks.util.Colors;
import me.retucio.camtweaks.ui.widgets.Widget;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text;
import java.util.List;
public abstract class HudElement {
protected static final MinecraftClient mc = MinecraftClient.getInstance();
public abstract class HudElement extends Widget {
private final String id;
protected boolean visible;
protected int x, y;
protected final int defaultX, defaultY;
protected int width = 85, height = 14;
public HudElement(String id, int defaultX, int defaultY) {
super(defaultX, defaultY, 85, 14);
this.id = id;
this.defaultX = defaultX;
this.defaultY = defaultY;
this.visible = true;
}
public abstract String getText(float delta, HUD hud);
public abstract String getPreviewText();
public void renderInGame(DrawContext ctx, float delta, HUD hud) {
String text = getText(delta, hud);
int color = hud != null ? HudRenderer.getColor(hud).getRGB() : -1;
boolean shadow = hud != null && hud.shadow.isEnabled();
HudRenderer.drawSnappedText(ctx, text, x, y, color, shadow);
}
public void renderInEditor(DrawContext ctx, HUD hud) {
String previewText = getPreviewText();
width = mc.textRenderer.getWidth(previewText);
height = mc.textRenderer.fontHeight;
drawEditorBackground(ctx);
int color = hud != null ? HudRenderer.getColor(hud).getRGB() : -1;
boolean shadow = hud != null && hud.shadow.isEnabled();
HudRenderer.drawSnappedText(ctx, previewText, x, y, color, shadow);
}
public abstract void renderInGame(DrawContext ctx, float delta, HUD hud);
public abstract void renderInEditor(DrawContext ctx, HUD hud);
public abstract List<Text> getTooltip();
private void drawEditorBackground(DrawContext ctx) {
int bg = visible ? Colors.visibleHudElementColor.getRGB() : Colors.disabledHudElementColor.getRGB();
int outline = HudEditorScreen.INSTANCE != null && HudEditorScreen.INSTANCE.isSelected(this)
? Colors.selectedHudElementOutlineColor.getRGB()
: Colors.unselectedHudElementOutlineColor.getRGB();
// fondo
ctx.fill(x - 1, y - 1, x + width + 1, y + height + 1, bg);
// contorno
ctx.fill(x - 1, y - 1, x + width + 1, y, outline);
ctx.fill(x - 1, y + height, x + width + 1, y + height + 1, outline);
ctx.fill(x - 1, y, x, y + height, outline);
ctx.fill(x + width, y, x + width + 1, y + height, outline);
}
public boolean isHovered(int mouseX, int mouseY) {
return mouseX >= x && mouseX <= x + width
&& mouseY >= y && mouseY <= y + height;
return mouseX >= x && mouseX <= x + w
&& mouseY >= y && mouseY <= y + w;
}
// Getters and setters
public String getId() { return id; }
public int getX() { return x; }
public int getY() { return y; }
public int getWidth() { return width; }
public int getHeight() { return height; }
public boolean isVisible() { return visible; }
public void setVisible(boolean visible) { this.visible = visible; }
@@ -37,6 +37,10 @@ public class HudRenderer {
addElement(new TimeElement(), positions, visibilities);
addElement(new PingElement(), positions, visibilities);
addElement(new DynoElement(), positions, visibilities);
addElement(new EchestElement(), positions, visibilities);
addElement(new TotemsElement(), positions, visibilities);
HudEditorScreen.INSTANCE.setElements(elements);
}
@@ -59,6 +63,16 @@ public class HudRenderer {
elements.add(element);
}
public static HudElement getElement(Class<? extends HudElement> clazz) {
for (HudElement element : elements) {
if (element.getClass() == clazz)
return element;
}
return null;
}
public static Color getColor(HUD hud) {
return hud.color.getColor();
}
@@ -0,0 +1,122 @@
package me.retucio.camtweaks.ui.hud;
import me.retucio.camtweaks.CameraTweaks;
import me.retucio.camtweaks.module.modules.client.HUD;
import me.retucio.camtweaks.util.Colors;
import net.minecraft.client.gl.RenderPipelines;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.texture.NativeImageBackedTexture;
import net.minecraft.util.Identifier;
import java.io.InputStream;
import java.util.function.Supplier;
public abstract class ImageHudElement extends HudElement {
protected Identifier textureId;
protected int imageWidth = 64;
protected int imageHeight = 64;
protected boolean textureLoaded = false;
protected NativeImageBackedTexture texture;
public ImageHudElement(String id, int defaultX, int defaultY) {
super(id, defaultX, defaultY);
this.textureId = Identifier.of(CameraTweaks.MOD_ID, "textures/" + id);
this.w = imageWidth;
this.h = imageHeight;
}
protected abstract String getImagePath();
public void reloadTexture() {
textureLoaded = false;
String imagePath = getImagePath();
if (imagePath == null || imagePath.isEmpty()) return;
try {
// cargar
Identifier resourceId = Identifier.of(CameraTweaks.MOD_ID, imagePath);
try (InputStream stream = mc.getResourceManager().getResource(resourceId).get().getInputStream()) {
NativeImage image = NativeImage.read(stream);
// deshacerse de la textura vieja
if (texture != null) texture.close();
if (mc.getTextureManager().getTexture(textureId) != null)
mc.getTextureManager().destroyTexture(textureId);
// crear la textura nueva
Supplier<String> nameSupplier = () -> textureId.toString();
texture = new NativeImageBackedTexture(nameSupplier, image);
this.imageWidth = image.getWidth();
this.imageHeight = image.getHeight();
this.w = imageWidth;
this.h = imageHeight;
mc.getTextureManager().registerTexture(textureId, texture);
textureLoaded = true;
CameraTweaks.LOGGER.info("textura para el elemento del HUD {} cargada", getId());
}
} catch (Exception e) {
CameraTweaks.LOGGER.error("no se pudo cargar la textura para el elemento del HUD {}: {}", getId(), e.getMessage());
}
}
@Override
public void renderInGame(DrawContext ctx, float delta, HUD hud) {
if (!textureLoaded || !isVisible()) return;
ctx.drawTexture(
RenderPipelines.GUI_TEXTURED,
textureId,
x, y,
0, 0,
imageWidth, imageHeight,
imageWidth, imageHeight
);
}
@Override
public void renderInEditor(DrawContext ctx, HUD hud) {
w = imageWidth;
h = imageHeight;
drawEditorBackground(ctx);
if (textureLoaded) {
ctx.drawTexture(
RenderPipelines.GUI_TEXTURED,
textureId,
x, y,
0, 0,
imageWidth, imageHeight,
imageWidth, imageHeight
);
} else {
String placeholder = "imagen: " + getId();
int textWidth = mc.textRenderer.getWidth(placeholder);
int textX = x + Math.max(0, (w - textWidth) / 2);
int textY = y + Math.max(0, (h - mc.textRenderer.fontHeight) / 2);
ctx.drawText(mc.textRenderer, placeholder, textX, textY, -1, true);
}
}
protected void drawEditorBackground(DrawContext ctx) {
int bgColor = visible ? Colors.visibleHudElementColor.getRGB() : Colors.disabledHudElementColor.getRGB();
int outlineColor = HudEditorScreen.INSTANCE != null && HudEditorScreen.INSTANCE.isSelected(this)
? Colors.selectedHudElementOutlineColor.getRGB()
: Colors.unselectedHudElementOutlineColor.getRGB();
// fondo
ctx.fill(x - 1, y - 1, x + w + 1, y + h + 1, bgColor);
// contorno
ctx.fill(x - 1, y - 1, x + w + 1, y, outlineColor);
ctx.fill(x - 1, y + h, x + w + 1, y + h + 1, outlineColor);
ctx.fill(x - 1, y, x, y + h, outlineColor);
ctx.fill(x + w, y, x + w + 1, y + h, outlineColor);
}
}
@@ -0,0 +1,53 @@
package me.retucio.camtweaks.ui.hud;
import me.retucio.camtweaks.module.modules.client.HUD;
import me.retucio.camtweaks.util.Colors;
import net.minecraft.client.gui.DrawContext;
public abstract class TextHudElement extends HudElement {
public TextHudElement(String id, int defaultX, int defaultY) {
super(id, defaultX, defaultY);
}
public abstract String getText(float delta, HUD hud);
public abstract String getPreviewText();
@Override
public void renderInGame(DrawContext ctx, float delta, HUD hud) {
String text = getText(delta, hud);
int color = hud != null ? hud.color.getColor().getRGB() : -1;
boolean shadow = hud != null && hud.shadow.isEnabled();
HudRenderer.drawSnappedText(ctx, text, x, y, color, shadow);
}
@Override
public void renderInEditor(DrawContext ctx, HUD hud) {
String previewText = getPreviewText();
w = mc.textRenderer.getWidth(previewText);
h = mc.textRenderer.fontHeight;
drawEditorBackground(ctx);
int color = hud != null ? hud.color.getColor().getRGB() : -1;
boolean shadow = hud != null && hud.shadow.isEnabled();
HudRenderer.drawSnappedText(ctx, previewText, x, y, color, shadow);
}
protected void drawEditorBackground(DrawContext ctx) {
int bgColor = visible ? Colors.visibleHudElementColor.getRGB() : Colors.disabledHudElementColor.getRGB();
int outlineColor = HudEditorScreen.INSTANCE != null && HudEditorScreen.INSTANCE.isSelected(this)
? Colors.selectedHudElementOutlineColor.getRGB()
: Colors.unselectedHudElementOutlineColor.getRGB();
// fondo
ctx.fill(x - 1, y - 1, x + w + 1, y + h + 1, bgColor);
// contorno
ctx.fill(x - 1, y - 1, x + w + 1, y, outlineColor);
ctx.fill(x - 1, y + h, x + w + 1, y + h + 1, outlineColor);
ctx.fill(x - 1, y, x, y + h, outlineColor);
ctx.fill(x + w, y, x + w + 1, y + h, outlineColor);
}
}
@@ -1,14 +1,18 @@
package me.retucio.camtweaks.ui.hud;
package me.retucio.camtweaks.ui.hud.elements;
import me.retucio.camtweaks.module.ModuleManager;
import me.retucio.camtweaks.module.modules.camera.Freecam;
import me.retucio.camtweaks.module.modules.client.HUD;
import me.retucio.camtweaks.ui.hud.HudElement;
import me.retucio.camtweaks.ui.hud.TextHudElement;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text;
import net.minecraft.util.math.Vec3d;
import java.util.List;
public class CoordsElement extends HudElement {
public class CoordsElement extends TextHudElement {
public CoordsElement() {
super("coords", 2, mc.getWindow().getScaledHeight() - mc.textRenderer.fontHeight);
@@ -5,11 +5,12 @@ import me.retucio.camtweaks.event.events.camtweaks.UpdateSettingEvent;
import me.retucio.camtweaks.module.ModuleManager;
import me.retucio.camtweaks.module.modules.client.HUD;
import me.retucio.camtweaks.ui.hud.HudElement;
import me.retucio.camtweaks.ui.hud.TextHudElement;
import net.minecraft.text.Text;
import java.util.List;
public class CustomTextElement extends HudElement {
public class CustomTextElement extends TextHudElement {
public CustomTextElement() {
super("customText", mc.getWindow().getScaledWidth() / 2 - 40, 2);
@@ -0,0 +1,41 @@
package me.retucio.camtweaks.ui.hud.elements;
import me.retucio.camtweaks.module.ModuleManager;
import me.retucio.camtweaks.module.modules.client.HUD;
import me.retucio.camtweaks.ui.hud.ImageHudElement;
import net.minecraft.text.Text;
import java.util.List;
public class DynoElement extends ImageHudElement {
private HUD.Dynosaurs dyno;
public DynoElement() {
super("dyno",
mc.getWindow().getScaledWidth() - 100,
mc.getWindow().getScaledHeight() - 100);
reloadTexture();
}
@Override
protected String getImagePath() {
HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
if (hud == null) return "textures/dynos/spinosaurus.png";
dyno = hud.dyno.getValue();
return "textures/dynos/" + getDynoFileName(dyno) + ".png";
}
private String getDynoFileName(HUD.Dynosaurs dyno) {
return dyno.toRealString().toLowerCase();
}
@Override
public List<Text> getTooltip() {
return List.of(
Text.literal("dinosaurio: " + dyno),
Text.literal("que viva el autismo joder")
);
}
}
@@ -0,0 +1,127 @@
package me.retucio.camtweaks.ui.hud.elements;
import me.retucio.camtweaks.module.modules.client.HUD;
import me.retucio.camtweaks.ui.hud.ImageHudElement;
import me.retucio.camtweaks.util.Colors;
import me.retucio.camtweaks.util.InventoryUtil;
import net.minecraft.client.gl.RenderPipelines;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import java.util.ArrayList;
import java.util.List;
public class EchestElement extends ImageHudElement {
public EchestElement() {
super("echest", 10, 50);
reloadTexture();
}
@Override
protected String getImagePath() {
return "textures/gui/preview-hud.png";
}
@Override
public void renderInGame(DrawContext ctx, float delta, HUD hud) {
if (!textureLoaded || !isVisible()) return;
ctx.drawTexture(
RenderPipelines.GUI_TEXTURED,
textureId,
x, y,
0, 0,
imageWidth, imageHeight,
imageWidth, imageHeight,
Colors.PURPLE.getRGB()
);
ctx.drawText(
mc.textRenderer,
"echest",
x + w / 2 - mc.textRenderer.getWidth("echest") / 2,
y + mc.textRenderer.fontHeight - 3,
Colors.instructionsTextColor.getRGB(),
false
);
renderItems(ctx, InventoryUtil.getEchestInv());
}
@Override
public void renderInEditor(DrawContext ctx, HUD hud) {
if (!textureLoaded) return;
drawEditorBackground(ctx);
ctx.drawTexture(
RenderPipelines.GUI_TEXTURED,
textureId,
x, y,
0, 0,
imageWidth, imageHeight,
imageWidth, imageHeight,
visible
? Colors.GREEN.getRGB()
: Colors.RED.getRGB()
);
ctx.drawText(
mc.textRenderer,
"echest",
x + w / 2 - mc.textRenderer.getWidth("echest") / 2,
y + mc.textRenderer.fontHeight - 3,
Colors.instructionsTextColor.getRGB(),
false
);
renderItems(ctx, InventoryUtil.getEchestInv());
}
@Override
public List<Text> getTooltip() {
List<Text> tooltip = new ArrayList<>();
tooltip.add(Text.literal("echest"));
tooltip.add(Text.literal("items en tu echest"));
return tooltip;
}
private void renderItems(DrawContext ctx, Inventory inventory) {
if (inventory == null) return;
int drawX = x + 7;
int drawY = y + 17;
int startX = drawX;
int count = 0;
int rows = 0;
for (ItemStack item : inventory) {
if (item.isEmpty()) continue;
ctx.drawItem(item, drawX, drawY);
ctx.drawStackOverlay(mc.textRenderer, item, drawX, drawY);
drawX += 18;
count++;
if (count % 9 == 0) {
drawX = startX;
drawY += 18;
rows++;
if (rows >= 3) break;
}
}
int itemsDrawn = Math.min(count, 27);
int columns = Math.min(itemsDrawn, 9);
int drawnRows = (int) Math.ceil(itemsDrawn / 9.0);
w = Math.max(columns * 18, w);
h = Math.max(drawnRows * 18, h);
}
}
@@ -2,11 +2,13 @@ package me.retucio.camtweaks.ui.hud.elements;
import me.retucio.camtweaks.module.modules.client.HUD;
import me.retucio.camtweaks.ui.hud.HudElement;
import me.retucio.camtweaks.ui.hud.TextHudElement;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text;
import java.util.List;
public class FpsElement extends HudElement {
public class FpsElement extends TextHudElement {
public FpsElement() {
super("fps", 2, 2);
@@ -29,4 +31,9 @@ public class FpsElement extends HudElement {
Text.literal("te muestra los fotogramas por segundo a los que corre el juego")
);
}
@Override
public void render(DrawContext ctx, int mouseX, int mouseY, float delta) {
}
}
@@ -2,12 +2,13 @@ package me.retucio.camtweaks.ui.hud.elements;
import me.retucio.camtweaks.module.modules.client.HUD;
import me.retucio.camtweaks.ui.hud.HudElement;
import me.retucio.camtweaks.ui.hud.TextHudElement;
import net.minecraft.client.network.PlayerListEntry;
import net.minecraft.text.Text;
import java.util.List;
public class PingElement extends HudElement {
public class PingElement extends TextHudElement {
public PingElement() {
super("ping", 2, 2 * (mc.textRenderer.fontHeight + 4));
@@ -2,12 +2,13 @@ package me.retucio.camtweaks.ui.hud.elements;
import me.retucio.camtweaks.module.modules.client.HUD;
import me.retucio.camtweaks.ui.hud.HudElement;
import me.retucio.camtweaks.ui.hud.TextHudElement;
import me.retucio.camtweaks.util.MiscUtil;
import net.minecraft.text.Text;
import java.util.List;
public class TimeElement extends HudElement {
public class TimeElement extends TextHudElement {
public TimeElement() {
super("time", mc.getWindow().getScaledWidth() - 50, mc.getWindow().getScaledHeight() - mc.textRenderer.fontHeight - 2);
@@ -0,0 +1,77 @@
package me.retucio.camtweaks.ui.hud.elements;
import me.retucio.camtweaks.module.modules.client.HUD;
import me.retucio.camtweaks.ui.hud.ImageHudElement;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.text.Text;
import java.util.List;
public class TotemsElement extends ImageHudElement {
public TotemsElement() {
super("totems", 363, 521);
w = 16;
h = 16;
reloadTexture();
}
@Override
protected String getImagePath() {
return "";
}
@Override
public void renderInGame(DrawContext ctx, float delta, HUD hud) {
if (!isVisible()) return;
int count = 0;
if (mc.player != null) {
for (ItemStack stack : mc.player.getInventory()) {
if (stack.getItem() == Items.TOTEM_OF_UNDYING)
count++;
}
}
ItemStack stack = new ItemStack(Items.TOTEM_OF_UNDYING, Math.max(1, count));
ctx.drawItem(stack, x, y);
if (count > 1) {
ctx.drawStackOverlay(mc.textRenderer, stack, x, y);
} else {
String text = String.valueOf(count);
int textX = x + 10;
int textY = y + 9;
ctx.drawText(
mc.textRenderer,
text,
textX,
textY,
-1,
true
);
}
}
@Override
public void renderInEditor(DrawContext ctx, HUD hud) {
int count = 0;
if (mc.player != null) {
for (ItemStack stack : mc.player.getInventory()) {
if (stack.getItem() == Items.TOTEM_OF_UNDYING)
count++;
}
}
drawEditorBackground(ctx);
ctx.drawItem(new ItemStack(Items.TOTEM_OF_UNDYING, count), x, y);
}
@Override
public List<Text> getTooltip() {
return List.of(Text.of("totems disponibles"));
}
}
@@ -2,12 +2,13 @@ package me.retucio.camtweaks.ui.hud.elements;
import me.retucio.camtweaks.module.modules.client.HUD;
import me.retucio.camtweaks.ui.hud.HudElement;
import me.retucio.camtweaks.ui.hud.TextHudElement;
import me.retucio.camtweaks.util.NetworkUtil;
import net.minecraft.text.Text;
import java.util.List;
public class TpsElement extends HudElement {
public class TpsElement extends TextHudElement {
public TpsElement() {
super("tps", 2, mc.textRenderer.fontHeight + 4);
@@ -6,7 +6,7 @@ import net.minecraft.client.gui.DrawContext;
public abstract class Widget {
protected final MinecraftClient mc = MinecraftClient.getInstance();
protected static final MinecraftClient mc = MinecraftClient.getInstance();
protected int x, y, w, h;
@@ -18,7 +18,7 @@ public abstract class Widget {
}
public abstract void render(DrawContext ctx, int mouseX, int mouseY, float delta);
public void render(DrawContext ctx, int mouseX, int mouseY, float delta) {}
// input
@@ -2,21 +2,24 @@ package me.retucio.camtweaks.util;
import me.retucio.camtweaks.CameraTweaks;
import me.retucio.camtweaks.mixin.accessor.KeyBindingAccessor;
import net.minecraft.client.input.KeyInput;
import net.minecraft.client.option.KeyBinding;
import org.lwjgl.glfw.GLFW;
import static me.retucio.camtweaks.CameraTweaks.mc;
// cosas útiles relacionadas a las teclas
public class KeyUtil {
public static boolean isKeyDown(int key) {
return GLFW.glfwGetKey(
CameraTweaks.mc.getWindow().getHandle(),
mc.getWindow().getHandle(),
key) != GLFW.GLFW_RELEASE;
}
public static boolean isKeyDown(KeyBinding key) {
return GLFW.glfwGetKey(
CameraTweaks.mc.getWindow().getHandle(),
mc.getWindow().getHandle(),
((KeyBindingAccessor) key).getBoundKey().getCode()
) != GLFW.GLFW_RELEASE;
}
@@ -26,6 +29,17 @@ public class KeyUtil {
|| isKeyDown(GLFW.GLFW_KEY_RIGHT_SHIFT);
}
public static void pressKey(int key, int action) {
pressKey(key, action, 0, 0);
}
public static void pressKey(int key, int action, int scancode, int modifiers) {
mc.keyboard.onKey(
mc.getWindow().getHandle(),
action,
new KeyInput(key, scancode, modifiers));
}
public static String getKeyName(int key) {
if (key == GLFW.GLFW_KEY_UNKNOWN) return "ninguna";
@@ -35,8 +35,8 @@ public class GlintRenderLayer extends RenderLayer {
addGlintTypes(map, armorEntityGlintColor);
}
public GlintRenderLayer(String name, VertexFormat vertexFormat, VertexFormat.DrawMode drawMode, int expectedBufferSize, boolean hasCrumbling, boolean translucent, Runnable startAction, Runnable endAction) {
super(name, RenderSetup.builder(RenderPipeline.builder().build()).build());
public GlintRenderLayer(String name) {
super(name, RenderSetup.builder(RenderPipelines.GLINT).build());
}
private static List<RenderLayer> newRenderList(Function<String, RenderLayer> func) {
@@ -60,17 +60,8 @@ public class GlintRenderLayer extends RenderLayer {
private static RenderLayer buildGlintRenderLayer(String name) {
final Identifier res = Identifier.of(CameraTweaks.MOD_ID, "textures/misc/glint_" + name.toLowerCase() + ".png");
return RenderLayer.of("glint_" + name, RenderSetup.builder(
RenderPipeline.builder()
.withCull(false)
.withDepthTestFunction(DepthTestFunction.EQUAL_DEPTH_TEST)
.withBlend(BlendFunction.GLINT)
.withLocation(RenderPipelines.GLINT.getLocation())
.withVertexShader(RenderPipelines.GLINT.getVertexShader())
.withFragmentShader(RenderPipelines.GLINT.getFragmentShader())
.withVertexFormat(RenderPipelines.GLINT.getVertexFormat(), RenderPipelines.GLINT.getVertexFormatMode())
.build())
.texture("glint_" + name, res)
return RenderLayer.of("glint_" + name, RenderSetup.builder(RenderPipelines.GLINT)
.texture("Sampler0", res)
.textureTransform(TextureTransform.GLINT_TEXTURING)
.translucent()
.build());
@@ -80,17 +71,8 @@ public class GlintRenderLayer extends RenderLayer {
private static RenderLayer buildEntityGlintRenderLayer(String name) {
final Identifier res = Identifier.of(CameraTweaks.MOD_ID, "textures/misc/glint_" + name.toLowerCase() + ".png");
return RenderLayer.of("entity_glint_" + name, RenderSetup.builder(
RenderPipeline.builder()
.withCull(true)
.withDepthTestFunction(DepthTestFunction.EQUAL_DEPTH_TEST)
.withBlend(BlendFunction.GLINT)
.withLocation(RenderPipelines.GLINT.getLocation())
.withVertexShader(RenderPipelines.GLINT.getVertexShader())
.withFragmentShader(RenderPipelines.GLINT.getFragmentShader())
.withVertexFormat(VertexFormats.POSITION_TEXTURE, VertexFormat.DrawMode.QUADS)
.build())
.texture("entity_glint_" + name, res)
return RenderLayer.of("entity_glint_" + name, RenderSetup.builder(RenderPipelines.GLINT)
.texture("Sampler0", res)
.textureTransform(TextureTransform.ENTITY_GLINT_TEXTURING)
.outputTarget(OutputTarget.ITEM_ENTITY_TARGET)
.translucent()
@@ -101,16 +83,8 @@ public class GlintRenderLayer extends RenderLayer {
private static RenderLayer buildArmorEntityGlintRenderLayer(String name) {
final Identifier res = Identifier.of(CameraTweaks.MOD_ID, "textures/misc/glint_" + name.toLowerCase() + ".png");
return RenderLayer.of("armor_glint_" + name, RenderSetup.builder(
RenderPipeline.builder()
.withCull(false)
.withDepthTestFunction(DepthTestFunction.EQUAL_DEPTH_TEST)
.withLocation(RenderPipelines.GLINT.getLocation())
.withVertexShader(RenderPipelines.GLINT.getVertexShader())
.withFragmentShader(RenderPipelines.GLINT.getFragmentShader())
.withVertexFormat(RenderPipelines.GLINT.getVertexFormat(), RenderPipelines.GLINT.getVertexFormatMode())
.build())
.texture("armor_glint_" + name, res)
return RenderLayer.of("armor_glint_" + name, RenderSetup.builder(RenderPipelines.GLINT)
.texture("Sampler0", res)
.textureTransform(TextureTransform.ARMOR_ENTITY_GLINT_TEXTURING)
.layeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING)
.translucent()
@@ -1,25 +1,42 @@
package me.retucio.camtweaks.util.render;
import me.retucio.camtweaks.CameraTweaks;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.RenderSetup;
import static me.retucio.camtweaks.util.render.Pipelines.GLOBAL_LINES_PIPELINE;
import static me.retucio.camtweaks.util.render.Pipelines.GLOBAL_QUADS_PIPELINE;
import static me.retucio.camtweaks.util.render.Pipelines.*;
public class Layers {
private static final RenderLayer GLOBAL_QUADS;
private static final RenderLayer GLOBAL_LINES;
private static final RenderLayer LINES;
private static final RenderLayer LINES_CULL;
public static RenderLayer getGlobalLines() {
return GLOBAL_LINES;
private static final RenderLayer QUADS;
private static final RenderLayer QUADS_CULL;
public static RenderLayer lines() {
return LINES;
}
public static RenderLayer getGlobalQuads() {
return GLOBAL_QUADS;
public static RenderLayer linesCull() {
return LINES_CULL;
}
public static RenderLayer quads() {
return QUADS;
}
public static RenderLayer quadsCull() {
return QUADS_CULL;
}
static {
GLOBAL_QUADS = RenderLayer.of("global_fill", RenderSetup.builder(GLOBAL_QUADS_PIPELINE).build());
GLOBAL_LINES = RenderLayer.of("global_lines", RenderSetup.builder(GLOBAL_LINES_PIPELINE).build());
LINES = RenderLayer.of(CameraTweaks.MOD_ID + "_lines", RenderSetup.builder(LINES_PIPELINE).build());
LINES_CULL = RenderLayer.of(CameraTweaks.MOD_ID + "_lines_cull", RenderSetup.builder(LINES_CULL_PIPELINE).build());
QUADS = RenderLayer.of(CameraTweaks.MOD_ID + "_quads", RenderSetup.builder(QUADS_PIPELINE).build());
QUADS_CULL = RenderLayer.of(CameraTweaks.MOD_ID + "quads_cull", RenderSetup.builder(QUADS_CULL_PIPELINE).build());
}
}
@@ -12,20 +12,37 @@ import net.minecraft.util.Identifier;
public class Pipelines {
static final RenderPipeline GLOBAL_LINES_PIPELINE = RenderPipeline.builder(RenderPipelines.RENDERTYPE_LINES_SNIPPET)
.withLocation(Identifier.of(CameraTweaks.MOD_ID, "pipeline/global_lines"))
.withVertexFormat(VertexFormats.POSITION_COLOR_NORMAL, VertexFormat.DrawMode.LINES)
static final RenderPipeline LINES_PIPELINE = RenderPipeline.builder(RenderPipelines.RENDERTYPE_LINES_SNIPPET)
.withLocation(Identifier.of(CameraTweaks.MOD_ID, "pipeline/lines"))
.withVertexFormat(VertexFormats.POSITION_COLOR_NORMAL_LINE_WIDTH, VertexFormat.DrawMode.LINES)
.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
.withDepthWrite(false)
.withCull(false)
.build();
static final RenderPipeline GLOBAL_QUADS_PIPELINE = RenderPipeline.builder(RenderPipelines.POSITION_COLOR_SNIPPET)
.withLocation("pipeline/global_fill_pipeline")
static final RenderPipeline LINES_CULL_PIPELINE = RenderPipeline.builder(RenderPipelines.RENDERTYPE_LINES_SNIPPET)
.withLocation(Identifier.of(CameraTweaks.MOD_ID, "pipeline/lines_cull"))
.withVertexFormat(VertexFormats.POSITION_COLOR_NORMAL_LINE_WIDTH, VertexFormat.DrawMode.LINES)
.withDepthTestFunction(DepthTestFunction.LEQUAL_DEPTH_TEST)
.withDepthWrite(false)
.withCull(true)
.build();
static final RenderPipeline QUADS_PIPELINE = RenderPipeline.builder(RenderPipelines.POSITION_COLOR_SNIPPET)
.withLocation(Identifier.of(CameraTweaks.MOD_ID, "pipeline/quads"))
.withVertexFormat(VertexFormats.POSITION_COLOR, VertexFormat.DrawMode.QUADS)
.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
.withBlend(BlendFunction.TRANSLUCENT)
.withDepthWrite(false)
.withCull(false)
.build();
static final RenderPipeline QUADS_CULL_PIPELINE = RenderPipeline.builder(RenderPipelines.POSITION_COLOR_SNIPPET)
.withLocation(Identifier.of(CameraTweaks.MOD_ID, "pipeline/quads_cull"))
.withVertexFormat(VertexFormats.POSITION_COLOR, VertexFormat.DrawMode.QUADS)
.withDepthTestFunction(DepthTestFunction.LEQUAL_DEPTH_TEST)
.withBlend(BlendFunction.TRANSLUCENT)
.withDepthWrite(false)
.withCull(false)
.build();
}
@@ -1,13 +1,11 @@
package me.retucio.camtweaks.util.render;
import com.mojang.blaze3d.vertex.VertexFormat;
import me.retucio.camtweaks.util.ChatUtil;
import net.minecraft.SharedConstants;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.*;
import net.minecraft.client.render.state.OutlineRenderState;
import net.minecraft.client.util.BufferAllocator;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Colors;
import net.minecraft.util.math.*;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
@@ -82,7 +80,7 @@ public class RenderUtil {
buffer.vertex(matrices.peek().getPositionMatrix(), x + width, y, 0).color(r, g, b, a);
buffer.vertex(matrices.peek().getPositionMatrix(), x, y, 0).color(r, g, b, a);
Layers.getGlobalQuads().draw(buffer.end());
Layers.quads().draw(buffer.end());
matrices.pop();
}
@@ -93,8 +91,116 @@ public class RenderUtil {
drawVerticalLine(stack, x1, y1, y2, color, width);
}
public static void drawBlockFaceOutlines(MatrixStack matrices, BlockPos pos, Direction face, Color color, float lineWidth, boolean cull) {
Vec3d cameraPos = mc.gameRenderer.getCamera().getCameraPos();
float minX = (float) (pos.getX() - cameraPos.x);
float minY = (float) (pos.getY() - cameraPos.y);
float minZ = (float) (pos.getZ() - cameraPos.z);
float maxX = minX + 1;
float maxY = minY + 1;
float maxZ = minZ + 1;
BufferBuilder buffer = tesselator.begin(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR_NORMAL_LINE_WIDTH);
switch (face) {
case UP:
buffer.vertex(matrices.peek(), minX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
break;
case DOWN:
buffer.vertex(matrices.peek(), minX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
break;
case EAST:
buffer.vertex(matrices.peek(), maxX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
break;
case WEST:
buffer.vertex(matrices.peek(), minX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
break;
case NORTH:
buffer.vertex(matrices.peek(), minX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
break;
case SOUTH:
buffer.vertex(matrices.peek(), minX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
break;
}
if (cull) Layers.linesCull().draw(buffer.end());
else Layers.lines().draw(buffer.end());
}
// expand es para evitar z-fighting
public static void drawBlockFaceFilled(MatrixStack matrices, BlockPos pos, Direction face, Color color, float expand) {
public static void drawBlockFaceFilled(MatrixStack matrices, BlockPos pos, Direction face, Color color, float expand, boolean cull) {
Vec3d cameraPos = mc.gameRenderer.getCamera().getCameraPos();
float minX = (float) (pos.getX() - cameraPos.x);
@@ -166,34 +272,71 @@ public class RenderUtil {
break;
}
Layers.getGlobalQuads().draw(buffer.end());
if (cull) Layers.quadsCull().draw(buffer.end());
else Layers.quads().draw(buffer.end());
}
// cajas
public static void drawOutlineBox(MatrixStack matrices, Box box, Color color, float lineWidth) {
Camera camera = mc.gameRenderer.getCamera();
Vec3d cameraPos = camera.getCameraPos();
public static void drawOutlineBox(MatrixStack matrices, Box box, Color color, float lineWidth, boolean cull) {
Vec3d cameraPos = mc.gameRenderer.getCamera().getCameraPos();
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(1 / camera.getPitch()));
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(1 / (camera.getYaw() + 180f)));
float minX = (float) (box.minX - cameraPos.x);
float minY = (float) (box.minY - cameraPos.y);
float minZ = (float) (box.minZ - cameraPos.z);
float maxX = (float) (box.maxX - cameraPos.x);
float maxY = (float) (box.maxY - cameraPos.y);
float maxZ = (float) (box.maxZ - cameraPos.z);
VertexRendering.drawOutline(
matrices,
mc.getBufferBuilders()
.getEntityVertexConsumers()
.getBuffer(RenderLayers.lines()),
VoxelShapes.cuboid(box),
-cameraPos.x,
-cameraPos.y,
-cameraPos.z,
color.getRGB(),
lineWidth);
BufferBuilder buffer = tesselator.begin(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR_NORMAL_LINE_WIDTH);
// parte inferior
buffer.vertex(matrices.peek(), minX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
// parte superior
buffer.vertex(matrices.peek(), minX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
// líneas verticales
buffer.vertex(matrices.peek(), minX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, minZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), maxX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, minY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
buffer.vertex(matrices.peek(), minX, maxY, maxZ).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth);
if (cull) Layers.linesCull().draw(buffer.end());
else Layers.lines().draw(buffer.end());
}
public static void drawFilledBox(MatrixStack matrices, Box box, Color color) {
public static void drawFilledBox(MatrixStack matrices, Box box, Color color, boolean cull) {
Vec3d cameraPos = mc.gameRenderer.getCamera().getCameraPos();
float minX = (float) (box.minX - cameraPos.x);
float minY = (float) (box.minY - cameraPos.y);
float minZ = (float) (box.minZ - cameraPos.z);
@@ -233,26 +376,27 @@ public class RenderUtil {
buffer.vertex(matrices.peek().getPositionMatrix(), minX, maxY, maxZ).color(color.getRGB());
buffer.vertex(matrices.peek().getPositionMatrix(), minX, maxY, minZ).color(color.getRGB());
Layers.getGlobalQuads().draw(buffer.end());
if (cull) Layers.quadsCull().draw(buffer.end());
else Layers.quads().draw(buffer.end());
}
// formas custom
public static void drawVoxelShapeOutline(MatrixStack matrices, VoxelShape voxelShape, BlockPos pos, Color color, float lineWidth) {
public static void drawVoxelShapeOutline(MatrixStack matrices, VoxelShape voxelShape, BlockPos blockPos, Color color, float lineWidth, boolean cull) {
if (voxelShape.isEmpty()) return;
voxelShape.forEachBox((minX, minY, minZ, maxX, maxY, maxZ) -> {
Box box = new Box(
pos.getX() + minX, pos.getY() + minY, pos.getZ() + minZ,
pos.getX() + maxX, pos.getY() + maxY, pos.getZ() + maxZ
blockPos.getX() + minX, blockPos.getY() + minY, blockPos.getZ() + minZ,
blockPos.getX() + maxX, blockPos.getY() + maxY, blockPos.getZ() + maxZ
);
drawOutlineBox(matrices, box, color, lineWidth);
drawOutlineBox(matrices, box, color, lineWidth, cull);
});
}
public static void drawVoxelShapeFilled(MatrixStack matrices, VoxelShape voxelShape, BlockPos pos, Color color) {
public static void drawVoxelShapeFilled(MatrixStack matrices, VoxelShape voxelShape, BlockPos pos, Color color, boolean cull) {
if (voxelShape.isEmpty()) return;
voxelShape.forEachBox((minX, minY, minZ, maxX, maxY, maxZ) -> {
@@ -261,22 +405,43 @@ public class RenderUtil {
pos.getX() + maxX, pos.getY() + maxY, pos.getZ() + maxZ
);
drawFilledBox(matrices, box, color);
drawFilledBox(matrices, box, color, cull);
});
}
// bloques
public static void drawBlockOutline(MatrixStack matrices, BlockPos pos, Color color, float lineWidth) {
public static void drawBlockOutline(MatrixStack matrices, BlockPos pos, Color color, float lineWidth, boolean cull) {
Box box = new Box(pos.getX(), pos.getY(), pos.getZ(),
pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1);
drawOutlineBox(matrices, box, color, lineWidth);
drawOutlineBox(matrices, box, color, lineWidth, cull);
}
public static void drawBlockFilled(MatrixStack matrices, BlockPos pos, Color color) {
public static void drawBlockFilled(MatrixStack matrices, BlockPos pos, Color color, boolean cull) {
Box box = new Box(pos.getX(), pos.getY(), pos.getZ(),
pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1);
drawFilledBox(matrices, box, color);
drawFilledBox(matrices, box, color, cull);
}
public static MatrixStack matrixFrom(Vec3d pos) {
MatrixStack matrices = new MatrixStack();
Camera camera = mc.gameRenderer.getCamera();
Vec3d camPos = camera.getCameraPos();
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getYaw()));
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getPitch() + 180.0F));
matrices.translate(
pos.getX() - camPos.getX(),
pos.getY() - camPos.getY(),
pos.getZ() - camPos.getZ()
);
return matrices;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 939 B

@@ -1,5 +1,6 @@
accessWidener v2 named
accessible field net/minecraft/client/texture/TextureManager textures Ljava/util/Map;
accessible method net/minecraft/network/ClientConnection handleQueuedTasks ()V
accessible method net/minecraft/network/ClientConnection sendImmediately (Lnet/minecraft/network/packet/Packet;Lio/netty/channel/ChannelFutureListener;Z)V
@@ -11,6 +12,9 @@ accessible class net/minecraft/client/network/ClientCommonNetworkHandler$Confirm
accessible class net/minecraft/client/font/TextRenderer$Drawer
accessible method net/minecraft/entity/Entity setFlag (IZ)V
accessible method net/minecraft/entity/player/PlayerEntity canGlide ()Z
accessible field net/minecraft/client/particle/BillboardParticle alpha F
accessible field net/minecraft/client/particle/BillboardParticle scale F
accessible field net/minecraft/client/particle/Particle velocityMultiplier F
@@ -23,3 +27,4 @@ accessible field net/minecraft/client/render/WorldRenderer worldRenderState Lnet
accessible method net/minecraft/client/render/GameRenderer getProjectionMatrix (F)Lorg/joml/Matrix4f;
accessible method net/minecraft/screen/ScreenHandlerType register (Ljava/lang/String;Lnet/minecraft/screen/ScreenHandlerType$Factory;)Lnet/minecraft/screen/ScreenHandlerType;
accessible method net/minecraft/client/Keyboard onKey (JILnet/minecraft/client/input/KeyInput;)V
+3 -1
View File
@@ -10,6 +10,7 @@
"ItemMixin",
"ItemStackMixin",
"KeyInputMixin",
"LivingEntityMixin",
"PlayerEntityMixin",
"ServerConnectorMixin",
"StringHelperMixin",
@@ -78,6 +79,7 @@
"accessor.AnvilScreenAccessor",
"accessor.ClientPlayNetworkHandlerAccessor",
"accessor.HandledScreenAccessor",
"accessor.KeyBindingAccessor"
"accessor.KeyBindingAccessor",
"accessor.OverlayTextureAccessor"
]
}