mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-21 04:42:17 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a621405ba | ||
|
|
45a677030d | ||
|
|
4d531022d2 | ||
|
|
48ba2160ad | ||
|
|
334ec81f9b |
No files matched your search
@@ -4,6 +4,7 @@ import static com.gtnewhorizon.gtnhlib.bytebuf.MemoryUtilities.*;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.FontRendererAccessor;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import it.unimi.dsi.fastutil.chars.Char2ShortOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import jss.util.RandomXoshiro256StarStar;
|
||||
@@ -472,7 +473,7 @@ public class BatchingFontRenderer {
|
||||
continue;
|
||||
}
|
||||
// Draw unicode char
|
||||
shadowOffset = 0.5F;
|
||||
shadowOffset = AngelicaConfig.shadowOffsetFontUC;
|
||||
final int uniPage = chr / 256;
|
||||
texture = getUnicodePageLocation(uniPage);
|
||||
final int startColumn = this.glyphWidth[chr] >>> 4;
|
||||
|
||||
@@ -87,6 +87,11 @@ public class AngelicaConfig {
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean enableFontRenderer;
|
||||
|
||||
@Config.Comment("OffSet fonts shadows draw")
|
||||
@Config.DefaultFloat(0.5F)
|
||||
@Config.RangeFloat(min = 0.5F, max = 1F)
|
||||
public static float shadowOffsetFontUC;
|
||||
|
||||
@Config.Comment("Enable Dynamic Lights")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
|
||||
@@ -308,9 +308,14 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void onGuiOpen(GuiOpenEvent event) {
|
||||
if (!event.isCanceled() && event.gui instanceof GuiMainMenu && gameStartTime == -1) {
|
||||
gameStartTime = ManagementFactory.getRuntimeMXBean().getUptime() / 1000f;
|
||||
LOGGER.info("The game loaded in {} seconds.", gameStartTime);
|
||||
if (!event.isCanceled()) {
|
||||
if (event.gui instanceof GuiMainMenu && gameStartTime == -1 ) {
|
||||
gameStartTime = ManagementFactory.getRuntimeMXBean().getUptime() / 1000f;
|
||||
LOGGER.info("The game loaded in {} seconds.", gameStartTime);
|
||||
}
|
||||
|
||||
// force reset zoom when a GUI is opened
|
||||
if (event.gui != null) Zoom.resetZoom();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -242,7 +242,8 @@ public class CloudRenderer implements IResourceManagerReloadListener {
|
||||
GraphicsQualityOff cloudGraphicsQuality = (GraphicsQualityOff)Settings.MODE_CLOUDS.option.getStore();
|
||||
final int cloudQualitySetting = cloudGraphicsQuality == GraphicsQualityOff.FANCY
|
||||
|| cloudGraphicsQuality == GraphicsQualityOff.DEFAULT && mc.gameSettings.fancyGraphics ? 2 : 1;
|
||||
final boolean newEnabled = mc.gameSettings.shouldRenderClouds()
|
||||
final boolean newEnabled = cloudGraphicsQuality != GraphicsQualityOff.OFF
|
||||
&& mc.gameSettings.shouldRenderClouds()
|
||||
&& mc.theWorld != null
|
||||
&& mc.theWorld.provider.isSurfaceWorld();
|
||||
final int targetDistance = Math.max(mc.gameSettings.renderDistanceChunks, (int)Settings.RENDER_DISTANCE_CLOUDS.option.getStore());
|
||||
|
||||
@@ -8,46 +8,73 @@ import lombok.Getter;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
public class Zoom {
|
||||
|
||||
@Getter
|
||||
private static float zoom = 4.0F;
|
||||
@Getter
|
||||
private static final KeyBinding zoomKey = new KeyBinding("Zoom", 0, "key.categories.misc");
|
||||
|
||||
public static final float ZOOM_MIN = 1.0F;
|
||||
public static final float ZOOM_MAX = 64.0F;
|
||||
public static final float ZOOM_STEP = 1.2F;
|
||||
public static final float ZOOM_DEFAULT = 4.0F;
|
||||
|
||||
private static boolean lastSmoothCameraState = false;
|
||||
@Getter
|
||||
private static float zoom = ZOOM_DEFAULT;
|
||||
@Getter
|
||||
private static final KeyBinding zoomKey = new KeyBinding("Zoom", 0, "key.categories.misc");
|
||||
|
||||
private static boolean zoomEnabled = false;
|
||||
|
||||
public static void init() {
|
||||
ClientRegistry.registerKeyBinding(zoomKey);
|
||||
FMLCommonHandler.instance().bus().register(new Zoom());
|
||||
}
|
||||
|
||||
public static boolean isZoomedIn() {
|
||||
return zoomEnabled;
|
||||
}
|
||||
|
||||
public static void modifyZoom(int eventDWheel) {
|
||||
if (eventDWheel == 0) return;
|
||||
zoom = MathHelper.clamp_float((float) (zoom * Math.pow(ZOOM_STEP, Integer.signum(eventDWheel))), ZOOM_MIN, ZOOM_MAX);
|
||||
}
|
||||
|
||||
private static void resetMouseFilters(Minecraft mc) {
|
||||
((IMouseFilterExt) mc.entityRenderer.mouseFilterXAxis).angelica$reset();
|
||||
((IMouseFilterExt) mc.entityRenderer.mouseFilterYAxis).angelica$reset();
|
||||
}
|
||||
|
||||
public static void resetZoom() {
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
zoomEnabled = false;
|
||||
zoom = ZOOM_DEFAULT;
|
||||
resetMouseFilters(mc);
|
||||
}
|
||||
|
||||
private void handleKeyEvent() {
|
||||
if (zoomKey.getKeyCode() == 0) return;
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
if (mc.currentScreen != null) return;
|
||||
|
||||
if (zoomKey.getIsKeyPressed()) {
|
||||
zoomEnabled = true;
|
||||
} else if (zoomEnabled) {
|
||||
resetZoom();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKeyPress(InputEvent.KeyInputEvent e) {
|
||||
final int keyCode = zoomKey.getKeyCode();
|
||||
if (keyCode == 0 || Keyboard.getEventKey() != keyCode || Keyboard.isRepeatEvent()) return;
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
if (Keyboard.getEventKeyState()) {
|
||||
lastSmoothCameraState = mc.gameSettings.smoothCamera;
|
||||
mc.gameSettings.smoothCamera = true;
|
||||
} else {
|
||||
zoom = 4.0F;
|
||||
if (mc.gameSettings.smoothCamera != lastSmoothCameraState) {
|
||||
((IMouseFilterExt) mc.entityRenderer.mouseFilterXAxis).angelica$reset();
|
||||
((IMouseFilterExt) mc.entityRenderer.mouseFilterYAxis).angelica$reset();
|
||||
}
|
||||
mc.gameSettings.smoothCamera = lastSmoothCameraState;
|
||||
handleKeyEvent();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMouseKeyPress(InputEvent.MouseInputEvent e) {
|
||||
// MouseInputEvent is also fired on mouse movement, which we don't care about, only mouse button presses, so
|
||||
// ensure that before any further key processing.
|
||||
if (Mouse.getEventButton() >= 0) {
|
||||
handleKeyEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,6 +259,7 @@ public class SodiumWorldRenderer {
|
||||
if(AngelicaConfig.enableIris) {
|
||||
if (ShadowRenderingState.areShadowsCurrentlyBeingRendered()) {
|
||||
ShadowRenderer.visibleTileEntities.addAll(this.chunkRenderManager.getVisibleTileEntities());
|
||||
ShadowRenderer.globalTileEntities.addAll(this.globalTileEntities);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -376,7 +377,7 @@ public class SodiumWorldRenderer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void renderTileEntities(EntityLivingBase entity, ICamera camera, float partialTicks) {
|
||||
final int pass = MinecraftForgeClient.getRenderPass();
|
||||
for (TileEntity tileEntity : this.chunkRenderManager.getVisibleTileEntities()) {
|
||||
@@ -390,7 +391,7 @@ public class SodiumWorldRenderer {
|
||||
|
||||
public void onChunkRenderUpdated(int x, int y, int z, ChunkRenderData meshBefore, ChunkRenderData meshAfter) {
|
||||
ListUtil.updateList(this.globalTileEntities, meshBefore.getGlobalTileEntities(), meshAfter.getGlobalTileEntities());
|
||||
|
||||
|
||||
this.chunkRenderManager.onChunkRenderUpdates(x, y, z, meshAfter);
|
||||
}
|
||||
|
||||
|
||||
@@ -352,12 +352,9 @@ public class ChunkRenderManager<T extends ChunkGraphicsState> implements ChunkSt
|
||||
|
||||
private void addEntitiesToRenderLists(ChunkRenderContainer<T> render) {
|
||||
Collection<TileEntity> tileEntities = render.getData().getTileEntities();
|
||||
|
||||
if (!tileEntities.isEmpty()) {
|
||||
this.visibleTileEntities.addAll(tileEntities);
|
||||
}
|
||||
this.visibleTileEntities.addAll(tileEntities);
|
||||
}
|
||||
|
||||
|
||||
public ChunkRenderContainer<T> getRender(int x, int y, int z) {
|
||||
ChunkRenderColumn<T> column = this.columns.get(ChunkPos.toLong(x, z));
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ public class ShadowRenderer {
|
||||
public static final FloatBuffer MODELVIEW_BUFFER = BufferUtils.createFloatBuffer(16);
|
||||
public static final Matrix4f PROJECTION = new Matrix4f();
|
||||
public static List<TileEntity> visibleTileEntities;
|
||||
public static List<TileEntity> globalTileEntities;
|
||||
public static boolean ACTIVE = false;
|
||||
private final float halfPlaneLength;
|
||||
private final float renderDistanceMultiplier;
|
||||
@@ -460,6 +461,7 @@ public class ShadowRenderer {
|
||||
MODELVIEW_BUFFER.clear().rewind();
|
||||
modelView.peek().getModel().get(MODELVIEW_BUFFER);
|
||||
GL11.glLoadMatrix(MODELVIEW_BUFFER);
|
||||
|
||||
for (TileEntity tileEntity : visibleTileEntities) {
|
||||
if (hasEntityFrustum && (culler.isCulled(tileEntity.xCoord - 1, tileEntity.yCoord - 1, tileEntity.zCoord - 1, tileEntity.xCoord + 1, tileEntity.yCoord + 1, tileEntity.zCoord + 1))) {
|
||||
continue;
|
||||
@@ -468,6 +470,15 @@ public class ShadowRenderer {
|
||||
|
||||
shadowTileEntities++;
|
||||
}
|
||||
for (TileEntity tileEntity : globalTileEntities) {
|
||||
if (hasEntityFrustum && (culler.isCulled(tileEntity.xCoord - 1, tileEntity.yCoord - 1, tileEntity.zCoord - 1, tileEntity.xCoord + 1, tileEntity.yCoord + 1, tileEntity.zCoord + 1))) {
|
||||
continue;
|
||||
}
|
||||
renderTileEntity(tileEntity, cameraX, cameraY, cameraZ, partialTicks);
|
||||
|
||||
shadowTileEntities++;
|
||||
}
|
||||
|
||||
GLStateManager.glPopMatrix();
|
||||
|
||||
renderedShadowTileEntities = shadowTileEntities;
|
||||
@@ -492,6 +503,7 @@ public class ShadowRenderer {
|
||||
// levelRenderer.setRenderBuffers(buffers);
|
||||
|
||||
visibleTileEntities = new ArrayList<>();
|
||||
globalTileEntities = new ArrayList<>();
|
||||
|
||||
// Create our camera
|
||||
final MatrixStack modelView = createShadowModelView(this.sunPathRotation, this.intervalSize);
|
||||
|
||||
+6
@@ -16,6 +16,8 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@@ -185,4 +187,8 @@ public abstract class MixinFontRenderer implements FontRendererAccessor {
|
||||
@Override
|
||||
public void angelica$bindTexture(ResourceLocation location) { this.bindTexture(location); }
|
||||
|
||||
@ModifyConstant(method = "getCharWidth", constant = @Constant(intValue = 7))
|
||||
private int angelica$maxCharWidth(int original) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
+13
@@ -3,10 +3,13 @@ package com.gtnewhorizons.angelica.mixins.early.angelica.zoom;
|
||||
import com.gtnewhorizons.angelica.zoom.Zoom;
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import org.spongepowered.asm.lib.Opcodes;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(EntityRenderer.class)
|
||||
public class MixinEntityRenderer_Zoom {
|
||||
@@ -27,4 +30,14 @@ public class MixinEntityRenderer_Zoom {
|
||||
return original;
|
||||
}
|
||||
|
||||
@Redirect(
|
||||
method = { "updateRenderer", "updateCameraAndRender" },
|
||||
at = @At(
|
||||
opcode = Opcodes.GETFIELD,
|
||||
target = "Lnet/minecraft/client/settings/GameSettings;smoothCamera:Z",
|
||||
value = "FIELD"))
|
||||
private boolean angelica$checkZoomEnablement(GameSettings settings) {
|
||||
return settings.smoothCamera || Zoom.isZoomedIn();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,6 +23,8 @@ public class MixinLocale {
|
||||
// storage
|
||||
@Shadow Map<String, String> field_135032_a;
|
||||
|
||||
@Shadow private boolean field_135029_d;
|
||||
|
||||
@Unique
|
||||
private static final List<String> languageCodes = new ArrayList<>();
|
||||
|
||||
@@ -79,4 +81,10 @@ public class MixinLocale {
|
||||
new LinkedList<>(definitions).descendingIterator().forEachRemaining(languageCodes::add);
|
||||
}
|
||||
|
||||
@Inject(method = "checkUnicode", at = @At("HEAD"), cancellable = true)
|
||||
private void iris$checkUnicode(CallbackInfo ci) {
|
||||
this.field_135029_d = false;
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user