Compare commits

..
Author SHA1 Message Date
Dakotah fe065803aa THIS ADDS FEATURE REQUEST ISSUE TO GITHUB (#514)
* Add feature request template

* Add feature request template

* Add labels to feature request template automatically

* switch labels to enhancement
2024-05-30 16:30:09 -07:00
ah-OOG-ah f94268c384 Add null check to FluidRenderer (#513)
* Add null check to FluidRenderer

* Update FluidRenderer.java
2024-05-30 17:56:32 -04:00
jss2a98aj f7a8b0f3bf Cloud scaling, distance, and some fixes 2024-05-24 22:16:41 -07:00
embeddedt 8893cf2291 Mark chunk graph as dirty when FOV changes (#506) 2024-05-24 15:59:46 -04:00
Jason Mitchell adc575c5ab remaps 2024-05-23 20:00:21 -07:00
Jason Mitchell 35a056b73b Patches vanilla getFlowDirection to not crash with a ClassCastException if another mod implements their own fluid renderer and calls getFlowDirection when COFH ASM is loaded 2024-05-23 20:00:21 -07:00
jss2a98aj fbbb0ed4f2 Various cleanup (IJK -> XYZ etc) 2024-05-23 19:49:49 -07:00
jss2a98aj bc148ba09c Updated file overlooked in previous sync 2024-05-23 19:49:49 -07:00
jss2a98aj 1db3932af0 Roll ITileOverride into TileOverride 2024-05-23 19:49:49 -07:00
jss2a98aj 0fd4611a97 Refactor glass pane mixins to solve compat issues 2024-05-23 19:49:49 -07:00
jss2a98aj 27243991b7 Add near fog distance percentage slider
Initial commit by MellowArpeggiation and George Paton
FOG_NEAR to FOG_NEAR_DISTANCE, minimum of 1% by jss2a98aj
2024-05-23 19:49:49 -07:00
jss2a98aj 956eec0366 Face culling for the Enchantment Table 2024-05-23 19:49:49 -07:00
jss2a98aj 9b06c5a210 Add interpolated icon support (Roadhog360) 2024-05-23 19:49:49 -07:00
jss2a98aj 5511759b6d Fix door smooth lighting, cull sides against solid blocks 2024-05-23 19:49:49 -07:00
jss2a98aj fb5aa81e01 Sandstone connected textures 2024-05-23 19:49:49 -07:00
jss2a98aj 6592e13e02 Improve Bookshelf connected textures 2024-05-23 19:49:49 -07:00
Jason Mitchell 31174dc35a Update README.MD 2024-05-23 17:57:46 -07:00
Caedis f0bd9de081 Disable Dynamic Lights video option when module is disabled (#491) 2024-05-17 20:18:23 +00:00
Jason Mitchell 75617a5456 More null checks 2024-05-14 23:23:01 -07:00
Jason Mitchell e158faada0 Only set/access texture info cache from the main thread 2024-05-14 22:35:21 -07:00
Raven Szewczyk f684bc0a1b Fix RenderBlockFluid reading the block type from the world access multiple times (#482)
* Fix RenderBlockFluid reading the block type from the world access multiple times

* Fix compiler warnings
2024-05-13 18:04:58 +01:00
53 changed files with 1324 additions and 1058 deletions

No files matched your search

@@ -0,0 +1,33 @@
name: Feature Request
description: "Request a feature."
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: "Please use this form to request features. We ask you check if it was already requested though"
- type: input
id: discord
attributes:
label: Your GTNH Discord Username
description: Leave empty if you don't have one, but this will make it harder to contact you if we need additional info.
placeholder: "Example: Wumpus#1234"
- type: textarea
id: request
attributes:
label: Feature Request
description: "Relevant information, as well as relevant images"
placeholder: "Example: https://mclo.gs/ OR submit the file to github by dragging it to this textbox."
validations:
required: true
- type: checkboxes
id: final
attributes:
label: Final Checklist
description: Certify that you read things
options:
- label: "I have searched the issues and haven't found a similar issue."
required: true
- label: "I have read the known incompatibilities and this is not related to one of those."
required: true
- label: "This issue is not related to a feature that is disabed by default - Shaders, MCPF, etc. [They'll be enabled when they're ready for testing]"
required: true
+6 -4
View File
@@ -17,10 +17,12 @@
# Known (temporary) Incompatibilities
* Forge Relocation - Currently non Thread Safe; safe if not in use
* ProjectRed Frames - Currently non Thread Safe; safe if not in use
* EndlessIDs - Future compat planned
* FalseTweaks - Future compat planned
* SmoothFont - Future compat planned
* RPLE - Future compat planned
# Known - Incompatibilities
* EndlessIDs - Not currently planned (Looking for volunteers)
* FalseTweaks - Not currently planned (Looking for volunteers)
* SmoothFont - Not currently planned (Looking for volunteers)
* RPLE - Not currently planned (Looking for volunteers)
# Permanent Incompatibilities
* Optifine [Disabled, won't fix]
@@ -110,6 +110,11 @@ public class AngelicaConfig {
@Config.RequiresMcRestart
public static boolean fixExtraUtilsSodiumCompat;
@Config.Comment("Fix RenderBlockFluid reading the block type from the world access multiple times")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixFluidRendererCheckingBlockAgain;
@Config.Comment("Enable Debug Logging")
@Config.DefaultBoolean(false)
@Config.RequiresMcRestart
@@ -236,6 +236,9 @@ public class GLStateManager {
}
public static boolean isMainThread() {
return Thread.currentThread() == MainThread;
}
public static void assertMainThread() {
if (Thread.currentThread() != CurrentThread && !runningSplash) {
@@ -1259,6 +1262,9 @@ public class GLStateManager {
return true;
}
final TextureInfo info = TextureInfoCache.INSTANCE.getInfo(texture);
if (info == null) {
return true;
}
switch (pname) {
case GL11.GL_TEXTURE_MIN_FILTER -> {
if(info.getMinFilter() == param && !shouldBypassCache()) return false;
@@ -1330,6 +1336,9 @@ public class GLStateManager {
return true;
}
final TextureInfo info = TextureInfoCache.INSTANCE.getInfo(texture);
if (info == null) {
return true;
}
switch (pname) {
case EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT -> {
if(info.getMaxAnisotropy() == param && !shouldBypassCache()) return false;
@@ -1355,7 +1364,9 @@ public class GLStateManager {
public static int getTexParameterOrDefault(int texture, int pname, IntSupplier defaultSupplier) {
final TextureInfo info = TextureInfoCache.INSTANCE.getInfo(texture);
if (info == null) {
return defaultSupplier.getAsInt();
}
return switch (pname) {
case GL11.GL_TEXTURE_MIN_FILTER -> info.getMinFilter();
case GL11.GL_TEXTURE_MAG_FILTER -> info.getMagFilter();
@@ -1379,6 +1390,9 @@ public class GLStateManager {
return GL11.glGetTexParameterf(target, pname);
}
final TextureInfo info = TextureInfoCache.INSTANCE.getInfo(getBoundTexture());
if(info == null) {
return GL11.glGetTexParameterf(target, pname);
}
return switch (pname) {
case EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT -> info.getMaxAnisotropy();
@@ -1392,7 +1406,9 @@ public class GLStateManager {
return GL11.glGetTexLevelParameteri(target, level, pname);
}
final TextureInfo info = TextureInfoCache.INSTANCE.getInfo(getBoundTexture());
if (info == null) {
return GL11.glGetTexLevelParameteri(target, level, pname);
}
return switch (pname) {
case GL11.GL_TEXTURE_WIDTH -> info.getWidth();
case GL11.GL_TEXTURE_HEIGHT -> info.getHeight();
@@ -21,7 +21,7 @@ public class TextureInfoCache {
}
public TextureInfo getInfo(int id) {
if(id < 0) return null;
if(id < 0 || !GLStateManager.isMainThread()) return null;
return cache.computeIfAbsent(id, TextureInfo::new);
}
@@ -45,7 +45,7 @@ public class TextureInfoCache {
}
public void onDeleteTexture(int id) {
if(id >= 0) cache.remove(id);
if(id >= 0 && GLStateManager.isMainThread()) cache.remove(id);
}
}
@@ -63,6 +63,12 @@ public enum Mixins {
)
),
ANGELICA_FIX_FLUID_RENDERER_CHECKING_BLOCK_AGAIN(
new Builder("Fix RenderBlockFluid reading the block type from the world access multiple times")
.setPhase(Phase.EARLY).addMixinClasses("angelica.bugfixes.MixinRenderBlockFluid").setSide(Side.BOTH)
.setApplyIf(() -> AngelicaConfig.fixFluidRendererCheckingBlockAgain)
.addTargetedMod(TargetedMod.VANILLA)),
// Not compatible with the lwjgl debug callbacks, so disable if that's enabled
ARCHAIC_SPLASH(new Builder("ArchaicFix Splash").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.showSplashMemoryBar && !AngelicaMod.lwjglDebug).addMixinClasses(
@@ -96,6 +102,7 @@ public enum Mixins {
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableSodium).addMixinClasses(
"sodium.MixinChunkProviderClient"
,"sodium.MixinBlock"
,"sodium.MixinBlockFluidBase"
,"sodium.AccessorBiomeColorEvent"
,"sodium.MixinBiomeGenBase"
,"sodium.MixinChunk"
@@ -245,7 +252,9 @@ public enum Mixins {
"toggle.MixinEntityRenderer",
"toggle.MixinGuiIngame",
"toggle.MixinRender",
"toggle.MixinRenderItem"
"toggle.MixinRenderItem",
"interpolatedtexturemap.MixinTextureMap"
))
),
BETTER_FACE_CULLING(new Builder("Better face culling")
@@ -256,6 +265,7 @@ public enum Mixins {
"MixinBlock",
"MixinBlockCactus",
"MixinBlockCarpet",
"MixinBlockEnchantmentTable",
"MixinBlockFarmland",
"MixinBlockSlab",
"MixinBlockSnow",
@@ -7,6 +7,7 @@ import net.minecraft.entity.EntityLivingBase;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(EntityRenderer.class)
@@ -23,4 +24,9 @@ public abstract class MixinEntityRenderer {
);
}
@ModifyArg(method = "setupCameraTransform", at = @At(value = "INVOKE", target = "Lorg/lwjgl/util/glu/Project;gluPerspective(FFFF)V", ordinal = 0), index = 0)
private float captureFov(float fov) {
RenderingState.INSTANCE.setFov(fov);
return fov;
}
}
@@ -11,7 +11,7 @@ public class MixinFMLClientHandler {
* @reason Remove more traces of Optifine
*/
@Overwrite
public void detectOptifine() {
private void detectOptifine() {
// Do nothing
}
@@ -0,0 +1,24 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.bugfixes;
import com.gtnewhorizons.angelica.mixins.hooks.FluidHooks;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fluids.BlockFluidBase;
import net.minecraftforge.fluids.RenderBlockFluid;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.llamalad7.mixinextras.sugar.Local;
@Mixin(value = RenderBlockFluid.class, remap = false)
public class MixinRenderBlockFluid {
@Redirect(
method = "renderWorldBlock", at = @At(
value = "INVOKE",
target = "Lnet/minecraftforge/fluids/BlockFluidBase;getFlowDirection(Lnet/minecraft/world/IBlockAccess;III)D"))
double hodgepodge$directFlowDirectionCheck(IBlockAccess world, int x, int y, int z, @Local BlockFluidBase block) {
return FluidHooks.getFlowDirection(world, x, y, z, block);
}
}
@@ -103,7 +103,7 @@ public abstract class MixinFontRenderer implements FontRendererAccessor {
@Shadow
protected abstract String bidiReorder(String p_147647_1_);
@Shadow
@Shadow(remap = false)
protected abstract void bindTexture(ResourceLocation location);
@Unique
@@ -0,0 +1,50 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.faceculling;
import jss.notfine.util.IFaceObstructionCheckHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockEnchantmentTable;
import net.minecraft.block.material.Material;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(value = BlockEnchantmentTable.class)
public abstract class MixinBlockEnchantmentTable extends Block implements IFaceObstructionCheckHelper {
/**
* @author jss2a98aj
* @reason More accurate face culling.
*/
public boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side) {
//If this is the top
if(side == 1) {
return true;
}
//Check if other block is solid
Block otherBlock = worldIn.getBlock(x, y, z);
if(otherBlock.isOpaqueCube()) {
return false;
}
//Check for IFaceObstructionCheckHelper
if(otherBlock instanceof IFaceObstructionCheckHelper target) {
return target.isFaceNonObstructing(worldIn, x, y, z, side, 0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F);
}
//Default
return true;
}
@Override
public boolean isFaceNonObstructing(IBlockAccess worldIn, int x, int y, int z, int side, double otherMinX, double otherMinY, double otherMinZ, double otherMaxX, double otherMaxY, double otherMaxZ) {
if(getRenderBlockPass() == 1) {
return true;
}
if(side <= 1) {
return side == 0;
}
return otherMaxY > 0.75F;
}
private MixinBlockEnchantmentTable(Material material) {
super(material);
}
}
@@ -17,7 +17,7 @@ public abstract class MixinRenderBlocks {
/**
* @author jss2a98aj
* @reason Culling a few more faces
* @reason Do not render fence arms unless actually required.
*/
@Overwrite
public boolean renderBlockFence(BlockFence fence, int x, int y, int z) {
@@ -69,6 +69,30 @@ public abstract class MixinRenderBlocks {
return true;
}
/**
* @author jss2a98aj
* @reason Cull faces against solid blocks, fix door smooth lighting
*/
@Overwrite
public boolean renderBlockDoor(Block block, int x, int y, int z) {
final int meta = blockAccess.getBlockMetadata(x, y, z);
if((meta & 8) != 0) {
if (blockAccess.getBlock(x, y - 1, z) != block) {
return false;
}
} else if (blockAccess.getBlock(x, y + 1, z) != block) {
return false;
}
if ((meta & 8) != 0) {
uvRotateTop = meta % 6;
}
boolean flag = renderStandardBlock(block, x, y, z);
uvRotateTop = 0;
return flag;
}
/**
* @author jss2a98aj
* @reason Fix modded wall detection
@@ -87,6 +111,7 @@ public abstract class MixinRenderBlocks {
@Shadow public IBlockAccess blockAccess;
@Shadow public boolean field_152631_f;
@Shadow public int uvRotateTop;
@Shadow public abstract void setRenderBounds(double minX, double minY, double minZ, double maxX, double maxY, double maxZ);
@Shadow public abstract boolean renderStandardBlock(Block blockType, int blockX, int blockY, int blockZ);
@@ -0,0 +1,51 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.interpolatedtexturemap;
import com.google.gson.JsonObject;
import jss.notfine.render.InterpolatedIcon;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.AbstractTexture;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.client.renderer.texture.ITickableTextureObject;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.SimpleResource;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Final;
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.CallbackInfoReturnable;
import java.util.Map;
@Mixin(TextureMap.class)
public abstract class MixinTextureMap extends AbstractTexture implements ITickableTextureObject, IIconRegister {
@Shadow
@Final
private Map mapRegisteredSprites;
@Shadow
protected abstract ResourceLocation completeResourceLocation(ResourceLocation p_147634_1_, int p_147634_2_);
@Inject(method = "registerIcon", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;<init>(Ljava/lang/String;)V"), cancellable = true)
private void registerInterpolatedIcon(String textureName, CallbackInfoReturnable<IIcon> cir) {
try {
IResource resource = Minecraft.getMinecraft().getResourceManager().getResource(completeResourceLocation(new ResourceLocation(textureName), 0));
if (resource instanceof SimpleResource) {
//This returns IMetadataSections, which seems to already remove unused mcmeta fields in 1.7.10
//I'm just running this to populate the mcmetaJson field more easily; this does it for us
if (resource.getMetadata("animation") != null) {
JsonObject mcmetaJson = ((SimpleResource) resource).mcmetaJson;
if (mcmetaJson.getAsJsonObject("animation").getAsJsonPrimitive("interpolate").getAsBoolean()) {
InterpolatedIcon interpolatedIcon = new InterpolatedIcon(textureName);
mapRegisteredSprites.put(textureName, interpolatedIcon);
cir.setReturnValue(interpolatedIcon);
}
}
}
} catch (Exception ignored) {/*Should quietly fail, no need to fail hard*/}
}
}
@@ -1,5 +1,6 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.leaves;
import jss.notfine.util.IFaceObstructionCheckHelper;
import jss.notfine.util.ILeafBlock;
import jss.notfine.util.LeafRenderUtil;
import net.minecraft.block.Block;
@@ -9,13 +10,18 @@ import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(value = BlockLeavesBase.class)
public abstract class MixinBlockLeavesBase extends Block implements ILeafBlock {
public abstract class MixinBlockLeavesBase extends Block implements IFaceObstructionCheckHelper, ILeafBlock {
@Override
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
return LeafRenderUtil.shouldSideBeRendered(world, x, y, z, side);
}
@Override()
public boolean isFaceNonObstructing(IBlockAccess world, int x, int y, int z, int side, double otherMinX, double otherMinY, double otherMinZ, double otherMaxX, double otherMaxY, double otherMaxZ) {
return LeafRenderUtil.isFaceNonObstructing(world, x, y, z);
}
private MixinBlockLeavesBase(Material material) {
super(material);
}
@@ -14,6 +14,8 @@ import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.lwjgl.opengl.GL11;
@Mixin(EntityRenderer.class)
abstract public class MixinEntityRenderer {
@@ -30,6 +32,10 @@ abstract public class MixinEntityRenderer {
return SettingsManager.waterDetail;
}
/**
* @author Caedis
* @reason Void fog toggle
*/
@WrapOperation(
method = "setupFog",
at = @At(
@@ -37,10 +43,22 @@ abstract public class MixinEntityRenderer {
target = "Lnet/minecraft/world/WorldProvider;getWorldHasVoidParticles()Z"
)
)
private boolean angelica$wrapVoidFog(WorldProvider provider, Operation<Boolean> original){
private boolean notFine$toggleVoidFog(WorldProvider provider, Operation<Boolean> original){
return ((boolean)Settings.VOID_FOG.option.getStore()) ? original.call(provider) : false;
}
@Redirect(
method = "setupFog",
at = @At(
value = "INVOKE",
target = "Lorg/lwjgl/opengl/GL11;glFogf(IF)V",
ordinal = 14
)
)
private void notFine$nearFogDistance(int mode, float value) {
GL11.glFogf(mode, farPlaneDistance * (int)Settings.FOG_NEAR_DISTANCE.option.getStore() * 0.01F - 1F);
}
@Redirect(
method = "updateRenderer()V",
at = @At(
@@ -48,7 +66,7 @@ abstract public class MixinEntityRenderer {
target = "Lnet/minecraft/client/renderer/EntityRenderer;updateTorchFlicker()V"
)
)
private void toggleTorchFlicker(EntityRenderer instance) {
private void notFine$toggleTorchFlicker(EntityRenderer instance) {
if((boolean)Settings.MODE_LIGHT_FLICKER.option.getStore()) {
updateTorchFlicker();
} else {
@@ -59,6 +77,10 @@ abstract public class MixinEntityRenderer {
@Shadow
abstract void updateTorchFlicker();
@Shadow private boolean lightmapUpdateNeeded;
@Shadow
private boolean lightmapUpdateNeeded;
@Shadow
private float farPlaneDistance;
}
@@ -0,0 +1,24 @@
package com.gtnewhorizons.angelica.mixins.early.sodium;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.fluids.BlockFluidBase;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@Mixin(value = BlockFluidBase.class, remap = false)
public class MixinBlockFluidBase {
@WrapOperation(method = "getFlowDirection", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/material/Material;isLiquid()Z"), remap = true)
private static boolean isLiquid(Material instance, Operation<Boolean> original, @Local Block block) {
if (block instanceof BlockFluidBase) {
return original.call(instance);
} else {
return false;
}
}
}
@@ -0,0 +1,19 @@
package com.gtnewhorizons.angelica.mixins.hooks;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fluids.BlockFluidBase;
public class FluidHooks {
/**
* {@link BlockFluidBase#getFluid()} that uses the given Block instead of fetching it from the world again
*/
public static double getFlowDirection(IBlockAccess world, int x, int y, int z, BlockFluidBase block) {
if (!block.getMaterial().isLiquid()) {
return -1000.0;
}
Vec3 vec = block.getFlowVector(world, x, y, z);
return vec.xCoord == 0.0D && vec.zCoord == 0.0D ? -1000.0D : Math.atan2(vec.zCoord, vec.xCoord) - Math.PI / 2D;
}
}
@@ -14,20 +14,20 @@ import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.util.IIcon;
@Mixin(targets = "connor135246.campfirebackport.client.rendering.RenderBlockCampfire", remap = false)
@Mixin(value = connor135246.campfirebackport.client.rendering.RenderBlockCampfire.class, remap = false)
public class MixinRenderBlockCampfire {
@Inject(method = "renderFace", at = @At("HEAD"))
private static void angelica$beforeRenderFace(double x, double y, double z, Block block, RenderBlocks renderer, IIcon icon, int side, CallbackInfo ci) {
AnimationsRenderUtils.markBlockTextureForUpdate(icon, renderer.blockAccess);
((ITexturesCache)renderer).getRenderedTextures().add(icon);
}
@ModifyArgs(method = "renderFire", at = @At(value = "INVOKE", target = "Lconnor135246/campfirebackport/client/rendering/RenderBlockCampfire;drawCrossedSquaresTwoIcons(Lnet/minecraft/util/IIcon;Lnet/minecraft/util/IIcon;DDDF)V"))
private static void angelica$onDrawCrossedSquaresTwoIcons(Args args, double x, double y, double z, Block block, RenderBlocks renderer, boolean mix) {
IIcon icon1 = (IIcon)args.get(0);
AnimationsRenderUtils.markBlockTextureForUpdate(icon1, renderer.blockAccess);
((ITexturesCache)renderer).getRenderedTextures().add(icon1);
IIcon icon2 = (IIcon)args.get(1);
AnimationsRenderUtils.markBlockTextureForUpdate(icon2, renderer.blockAccess);
((ITexturesCache)renderer).getRenderedTextures().add(icon2);
@@ -64,6 +64,8 @@ public class CloudRenderer implements IResourceManagerReloadListener {
private VertexBuffer vbo;
private int cloudMode = -1;
private int renderDistance = -1;
private int cloudElevation = -1;
private int scaleMult = -1;
private DynamicTexture COLOR_TEX = null;
@@ -82,9 +84,8 @@ public class CloudRenderer implements IResourceManagerReloadListener {
return instance;
}
private int getScale() {
return cloudMode == 2 ? 12 : 8;
return (cloudMode == 2 ? 12 : 8) * scaleMult;
}
private float ceilToScale(float value) {
@@ -139,11 +140,12 @@ public class CloudRenderer implements IResourceManagerReloadListener {
tessellator.pos(sectX0, 0, sectZ1).tex(u0, v1).color(bCol, bCol, bCol, ALPHA).endVertex();
if (fancy) {
final int height = HEIGHT * scaleMult;
// Top
tessellator.pos(sectX0, HEIGHT, sectZ0).tex(u0, v0).color(1, 1, 1, ALPHA).endVertex();
tessellator.pos(sectX0, HEIGHT, sectZ1).tex(u0, v1).color(1, 1, 1, ALPHA).endVertex();
tessellator.pos(sectX1, HEIGHT, sectZ1).tex(u1, v1).color(1, 1, 1, ALPHA).endVertex();
tessellator.pos(sectX1, HEIGHT, sectZ0).tex(u1, v0).color(1, 1, 1, ALPHA).endVertex();
tessellator.pos(sectX0, height, sectZ0).tex(u0, v0).color(1, 1, 1, ALPHA).endVertex();
tessellator.pos(sectX0, height, sectZ1).tex(u0, v1).color(1, 1, 1, ALPHA).endVertex();
tessellator.pos(sectX1, height, sectZ1).tex(u1, v1).color(1, 1, 1, ALPHA).endVertex();
tessellator.pos(sectX1, height, sectZ0).tex(u1, v0).color(1, 1, 1, ALPHA).endVertex();
float slice;
float sliceCoord0;
@@ -157,8 +159,8 @@ public class CloudRenderer implements IResourceManagerReloadListener {
if (slice > -CULL_DIST) {
slice += INSET;
tessellator.pos(slice, 0, sectZ1).tex(sliceCoord0, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
tessellator.pos(slice, HEIGHT, sectZ1).tex(sliceCoord1, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
tessellator.pos(slice, HEIGHT, sectZ0).tex(sliceCoord1, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
tessellator.pos(slice, height, sectZ1).tex(sliceCoord1, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
tessellator.pos(slice, height, sectZ0).tex(sliceCoord1, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
tessellator.pos(slice, 0, sectZ0).tex(sliceCoord0, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
slice -= INSET;
}
@@ -168,8 +170,8 @@ public class CloudRenderer implements IResourceManagerReloadListener {
if (slice <= CULL_DIST) {
slice -= INSET;
tessellator.pos(slice, 0, sectZ0).tex(sliceCoord0, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
tessellator.pos(slice, HEIGHT, sectZ0).tex(sliceCoord1, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
tessellator.pos(slice, HEIGHT, sectZ1).tex(sliceCoord1, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
tessellator.pos(slice, height, sectZ0).tex(sliceCoord1, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
tessellator.pos(slice, height, sectZ1).tex(sliceCoord1, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
tessellator.pos(slice, 0, sectZ1).tex(sliceCoord0, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
slice += INSET;
}
@@ -183,8 +185,8 @@ public class CloudRenderer implements IResourceManagerReloadListener {
if (slice > -CULL_DIST) {
slice += INSET;
tessellator.pos(sectX0, 0, slice).tex(u0, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
tessellator.pos(sectX0, HEIGHT, slice).tex(u0, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
tessellator.pos(sectX1, HEIGHT, slice).tex(u1, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
tessellator.pos(sectX0, height, slice).tex(u0, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
tessellator.pos(sectX1, height, slice).tex(u1, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
tessellator.pos(sectX1, 0, slice).tex(u1, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
slice -= INSET;
}
@@ -194,8 +196,8 @@ public class CloudRenderer implements IResourceManagerReloadListener {
if (slice <= CULL_DIST) {
slice -= INSET;
tessellator.pos(sectX1, 0, slice).tex(u1, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
tessellator.pos(sectX1, HEIGHT, slice).tex(u1, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
tessellator.pos(sectX0, HEIGHT, slice).tex(u0, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
tessellator.pos(sectX1, height, slice).tex(u1, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
tessellator.pos(sectX0, height, slice).tex(u0, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
tessellator.pos(sectX0, 0, slice).tex(u0, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
slice += INSET;
}
@@ -238,21 +240,32 @@ public class CloudRenderer implements IResourceManagerReloadListener {
public void checkSettings() {
GraphicsQualityOff cloudGraphicsQuality = (GraphicsQualityOff)Settings.MODE_CLOUDS.option.getStore();
final int cloudQualitySetting = cloudGraphicsQuality == GraphicsQualityOff.FANCY
final int cloudQualitySetting = cloudGraphicsQuality == GraphicsQualityOff.FANCY
|| cloudGraphicsQuality == GraphicsQualityOff.DEFAULT && mc.gameSettings.fancyGraphics ? 2 : 1;
boolean newEnabled = mc.gameSettings.shouldRenderClouds()
final boolean newEnabled = 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());
final int cloudScaleMult = (int)Settings.CLOUD_SCALE.option.getStore();
if (isBuilt()
&& (!newEnabled
|| cloudQualitySetting != cloudMode
|| mc.gameSettings.renderDistanceChunks != renderDistance)) {
|| targetDistance != renderDistance
|| cloudScaleMult != scaleMult)) {
dispose();
}
cloudMode = cloudQualitySetting;
renderDistance = mc.gameSettings.renderDistanceChunks;
renderDistance = targetDistance;
scaleMult = cloudScaleMult;
cloudElevation = mc.theWorld == null ? 128 : (int)mc.theWorld.provider.getCloudHeight();
//Allows the setting to work with RFG and similar without hardcoding.
//The minimum height check is so stuff like Aether cloud height doesn't get messed up.
if(cloudElevation >= 96) {
cloudElevation = (int)Settings.CLOUD_HEIGHT.option.getStore();
}
if (newEnabled && !isBuilt()) {
build();
@@ -268,7 +281,7 @@ public class CloudRenderer implements IResourceManagerReloadListener {
double totalOffset = cloudTicks + partialTicks;
double x = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks + totalOffset * 0.03;
double y = mc.theWorld.provider.getCloudHeight() - (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks) + 0.33;
double y = cloudElevation - (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks) + 0.33;
double z = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks;
int scale = getScale();
@@ -2,6 +2,7 @@ package com.gtnewhorizons.angelica.rendering;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import lombok.Getter;
import lombok.Setter;
import org.joml.Matrix4f;
import org.joml.Vector3d;
import org.lwjgl.BufferUtils;
@@ -21,6 +22,9 @@ public class RenderingState {
private final Matrix4f projectionMatrix = new Matrix4f().identity();
@Getter
private final Matrix4f modelViewMatrix = new Matrix4f().identity();
@Getter
@Setter
private float fov;
public void setCameraPosition(double x, double y, double z) {
@@ -358,8 +358,7 @@ public class ColorizeBlock {
return colorizeBlock(blockAccess, colorMap, x, y, z);
}
private static boolean colorizeBlock(IBlockAccess blockAccess, IColorMap colorMap, int x, int y,
int z) {
private static boolean colorizeBlock(IBlockAccess blockAccess, IColorMap colorMap, int x, int y, int z) {
if (colorMap == null) {
return false;
} else {
@@ -30,9 +30,7 @@ final class BlockOrientation extends RenderBlockState {
{ WEST_FACE, EAST_FACE, NORTH_FACE, SOUTH_FACE, TOP_FACE, BOTTOM_FACE, 2, -2, -2, -2, 0, 0 },
{ NORTH_FACE, SOUTH_FACE, TOP_FACE, BOTTOM_FACE, WEST_FACE, EAST_FACE, 0, 0, 0, 0, -2, -2 }, };
private int i;
private int j;
private int k;
private int x, y, z;
private int metadata;
private int altMetadata;
private int metadataBits;
@@ -46,29 +44,29 @@ final class BlockOrientation extends RenderBlockState {
@Override
public void clear() {
super.clear();
i = j = k = 0;
x = y = z = 0;
renderType = -1;
metadata = 0;
blockFace = textureFace = 0;
rotateUV = 0;
offsetsComputed = false;
haveOffsets = false;
di = dj = dk = 0;
dx = dy = dz = 0;
}
@Override
public int getI() {
return i;
public int getX() {
return x;
}
@Override
public int getJ() {
return j;
public int getY() {
return y;
}
@Override
public int getK() {
return k;
public int getZ() {
return z;
}
@Override
@@ -86,11 +84,6 @@ final class BlockOrientation extends RenderBlockState {
return textureFaceOrig;
}
@Override
public String getTextureFaceName() {
throw new UnsupportedOperationException("getTextureName");
}
@Override
public int getFaceForHV() {
return blockFace;
@@ -98,7 +91,7 @@ final class BlockOrientation extends RenderBlockState {
@Override
public boolean match(BlockStateMatcher matcher) {
return isInWorld() ? matcher.match(blockAccess, i, j, k) : matcher.match(block, metadata);
return isInWorld() ? matcher.match(blockAccess, x, y, z) : matcher.match(block, metadata);
}
@Override
@@ -113,32 +106,32 @@ final class BlockOrientation extends RenderBlockState {
}
offsetsComputed = true;
haveOffsets = false;
di = dj = dk = 0;
dx = dy = dz = 0;
switch (renderType) {
case 1 -> { // renderCrossedSquares
while (j + dj > 0 && block == blockAccess.getBlock(i, j + dj - 1, k)) {
dj--;
while (y + dy > 0 && block == blockAccess.getBlock(x, y + dy - 1, z)) {
dy--;
haveOffsets = true;
}
} // renderBlockDoor
case 7, 40 -> { // renderBlockDoublePlant
if ((metadata & 0x8) != 0 && block == blockAccess.getBlock(i, j - 1, k)) {
dj--;
if ((metadata & 0x8) != 0 && block == blockAccess.getBlock(x, y - 1, z)) {
dy--;
haveOffsets = true;
}
}
case 14 -> { // renderBlockBed
metadata = blockAccess.getBlockMetadata(i, j, k);
metadata = blockAccess.getBlockMetadata(x, y, z);
switch (metadata) {
case 0, 4 -> dk = 1; // head is one block south
case 1, 5 -> di = -1; // head is one block west
case 2, 6 -> dk = -1; // head is one block north
case 3, 7 -> di = 1; // head is one block east
case 0, 4 -> dz = 1; // head is one block south
case 1, 5 -> dx = -1; // head is one block west
case 2, 6 -> dz = -1; // head is one block north
case 3, 7 -> dx = 1; // head is one block east
default -> {
return false; // head itself, no offset
}
}
haveOffsets = block == blockAccess.getBlock(i + di, j, k + dk);
haveOffsets = block == blockAccess.getBlock(x + dx, y, z + dz);
}
default -> {
}
@@ -161,9 +154,9 @@ final class BlockOrientation extends RenderBlockState {
this.block = block;
this.blockAccess = blockAccess;
inWorld = true;
this.i = x;
this.j = y;
this.k = z;
this.x = x;
this.y = y;
this.z = z;
renderType = block.getRenderType();
metadata = altMetadata = blockAccess.getBlockMetadata(x, y, z);
offsetsComputed = false;
@@ -181,12 +174,12 @@ final class BlockOrientation extends RenderBlockState {
this.block = block;
blockAccess = null;
inWorld = false;
i = j = k = 0;
x = y = z = 0;
renderType = block.getRenderType();
blockFace = textureFace = textureFaceOrig = face;
this.metadata = metadata;
metadataBits = 1 << metadata;
di = dj = dk = 0;
dx = dy = dz = 0;
rotateUV = 0;
}
@@ -35,12 +35,12 @@ public class CTMUtils {
private static final boolean enableStandard = MCPatcherForgeConfig.instance().ctmStandard;
private static final boolean enableNonStandard = MCPatcherForgeConfig.instance().ctmNonStandard;
private static final List<ITileOverride> allOverrides = new ArrayList<>();
private static final List<TileOverride> allOverrides = new ArrayList<>();
private static final Map<Block, List<BlockStateMatcher>> blockOverrides = new IdentityHashMap<>();
private static final Map<String, List<ITileOverride>> tileOverrides = new HashMap<>();
private static final Map<String, List<TileOverride>> tileOverrides = new HashMap<>();
private static TileLoader tileLoader;
private static ITileOverride lastOverride;
private static TileOverride lastOverride;
private static final TileOverrideIterator.IJK ijkIterator = newIJKIterator();
private static final TileOverrideIterator.Metadata metadataIterator = newMetadataIterator();
@@ -94,12 +94,12 @@ public class CTMUtils {
@Override
public void afterChange() {
for (ITileOverride override : allOverrides) {
for (TileOverride override : allOverrides) {
override.registerIcons();
}
for (Map.Entry<Block, List<BlockStateMatcher>> entry : blockOverrides.entrySet()) {
for (BlockStateMatcher matcher : entry.getValue()) {
ITileOverride override = (ITileOverride) matcher.getData();
TileOverride override = (TileOverride) matcher.getData();
if (override.getRenderPass() >= 0) {
RenderPassAPI.instance.setRenderPassForBlock(entry.getKey(), override.getRenderPass());
}
@@ -107,12 +107,12 @@ public class CTMUtils {
}
for (List<BlockStateMatcher> overrides : blockOverrides.values()) {
overrides.sort((m1, m2) -> {
ITileOverride o1 = (ITileOverride) m1.getData();
ITileOverride o2 = (ITileOverride) m2.getData();
TileOverride o1 = (TileOverride) m1.getData();
TileOverride o2 = (TileOverride) m2.getData();
return o1.compareTo(o2);
});
}
for (List<ITileOverride> overrides : tileOverrides.values()) {
for (List<TileOverride> overrides : tileOverrides.values()) {
Collections.sort(overrides);
}
setBlankResource();
@@ -124,12 +124,12 @@ public class CTMUtils {
haveBlockFace = false;
}
public static synchronized IIcon getBlockIcon(IIcon icon, RenderBlocks renderBlocks, Block block, IBlockAccess blockAccess,
int i, int j, int k, int face) {
public static synchronized IIcon getBlockIcon(IIcon icon, Block block, IBlockAccess blockAccess,
int x, int y, int z, int face) {
lastOverride = null;
if (blockAccess != null && checkFace(face)) {
if (!haveBlockFace) {
renderBlockState.setBlock(block, blockAccess, i, j, k);
renderBlockState.setBlock(block, blockAccess, x, y, z);
renderBlockState.setFace(face);
}
lastOverride = ijkIterator.go(renderBlockState, icon);
@@ -141,7 +141,7 @@ public class CTMUtils {
return lastOverride == null && skipDefaultRendering(block) ? RenderBlocksUtils.blankIcon : icon;
}
public static synchronized IIcon getBlockIcon(IIcon icon, RenderBlocks renderBlocks, Block block, int face, int metadata) {
public static synchronized IIcon getBlockIcon(IIcon icon, Block block, int face, int metadata) {
lastOverride = null;
if (checkFace(face) && checkRenderType(block)) {
renderBlockState.setBlockMetadata(block, metadata, face);
@@ -153,8 +153,8 @@ public class CTMUtils {
return icon;
}
public static IIcon getBlockIcon(IIcon icon, RenderBlocks renderBlocks, Block block, int face) {
return getBlockIcon(icon, renderBlocks, block, face, 0);
public static IIcon getBlockIcon(IIcon icon, Block block, int face) {
return getBlockIcon(icon, block, face, 0);
}
public static void reset() {}
@@ -175,7 +175,7 @@ public class CTMUtils {
return RenderPassAPI.instance.skipDefaultRendering(block);
}
private static synchronized void registerOverride(ITileOverride override) {
private static synchronized void registerOverride(TileOverride override) {
if (override != null && !override.isDisabled()) {
boolean registered = false;
List<BlockStateMatcher> matchingBlocks = override.getMatchingBlocks();
@@ -194,7 +194,7 @@ public class CTMUtils {
Set<String> matchingTiles = override.getMatchingTiles();
if (!MCPatcherUtils.isNullOrEmpty(matchingTiles)) {
for (String name : matchingTiles) {
List<ITileOverride> list = tileOverrides.computeIfAbsent(name, k -> new ArrayList<>());
List<TileOverride> list = tileOverrides.computeIfAbsent(name, k -> new ArrayList<>());
list.add(override);
logger.fine("using %s for tile %s", override, name);
registered = true;
@@ -20,28 +20,28 @@ public class GlassPaneRenderer {
private static final IIcon[] icons = new IIcon[6];
private static double u0; // left edge
private static double u1; // 7/16 point
private static double u2; // 9/16 point
private static double u3; // right edge
private static double v0; // top edge
private static double v1; // bottom edge
private static double uLeft; // left edge
private static double uLeftThin; // 7/16 point
private static double uRightThin; // 9/16 point
private static double uRight; // right edge
private static double vTop; // top edge
private static double vBottom; // bottom edge
private static double u1Scaled;
private static double u2Scaled;
public static void renderThin(RenderBlocks renderBlocks, Block blockPane, IIcon origIcon, int i, int j, int k,
public static void renderThin(RenderBlocks renderBlocks, Block blockPane, IIcon origIcon, int x, int y, int z,
boolean connectNorth, boolean connectSouth, boolean connectWest, boolean connectEast) {
if (setupIcons(renderBlocks, blockPane, origIcon, i, j, k)) {
render(i, j, k, connectNorth, connectSouth, connectWest, connectEast, 0.0, 0.0, 0.0, false);
if (setupIcons(renderBlocks, blockPane, origIcon, x, y, z)) {
render(x, y, z, connectNorth, connectSouth, connectWest, connectEast, 0.0, 0.0, 0.0, false);
}
}
public static void renderThick(RenderBlocks renderBlocks, Block blockPane, IIcon origIcon, int i, int j, int k,
public static void renderThick(RenderBlocks renderBlocks, Block blockPane, IIcon origIcon, int x, int y, int z,
boolean connectNorth, boolean connectSouth, boolean connectWest, boolean connectEast) {
if (setupIcons(renderBlocks, blockPane, origIcon, i, j, k)) {
setupPaneEdges(renderBlocks, blockPane, i, j, k);
render(i, j, k, connectNorth, connectSouth, connectWest, connectEast, 0.0625, 1.0, 0.001, true);
if (setupIcons(renderBlocks, blockPane, origIcon, x, y, z)) {
setupPaneEdges(renderBlocks.blockAccess, blockPane, x, y, z);
render(x, y, z, connectNorth, connectSouth, connectWest, connectEast, 0.0625, 1.0, 0.001, true);
}
}
@@ -52,7 +52,7 @@ public class GlassPaneRenderer {
}
for (int face = BlockOrientation.NORTH_FACE; face <= BlockOrientation.EAST_FACE; face++) {
icons[face] = CTMUtils
.getBlockIcon(origIcon, renderBlocks, blockPane, renderBlocks.blockAccess, x, y, z, face);
.getBlockIcon(origIcon, blockPane, renderBlocks.blockAccess, x, y, z, face);
if (icons[face] == null) {
skipPaneRendering = false;
return false;
@@ -63,8 +63,7 @@ public class GlassPaneRenderer {
return skipPaneRendering;
}
private static void setupPaneEdges(RenderBlocks renderBlocks, Block blockPane, int x, int y, int z) {
IBlockAccess blockAccess = renderBlocks.blockAccess;
private static void setupPaneEdges(IBlockAccess blockAccess, Block blockPane, int x, int y, int z) {
int metadata = blockAccess.getBlockMetadata(x, y, z);
skipBottomEdgeRendering = blockAccess.getBlock(x, y - 1, z) == blockPane
&& blockAccess.getBlockMetadata(x, y - 1, z) == metadata;
@@ -74,16 +73,16 @@ public class GlassPaneRenderer {
private static void render(int x, int y, int z, boolean connectNorth, boolean connectSouth, boolean connectWest,
boolean connectEast, double thickness, double uOffset, double yOffset, boolean edges) {
final double i0 = x;
final double i1 = i0 + 0.5 - thickness;
final double i2 = i0 + 0.5 + thickness;
final double i3 = i0 + 1.0;
final double j0 = y + yOffset;
final double j1 = y + 1.0 - yOffset;
final double k0 = z;
final double k1 = k0 + 0.5 - thickness;
final double k2 = k0 + 0.5 + thickness;
final double k3 = k0 + 1.0;
final double west = x;
final double westThin = x + 0.5 - thickness;
final double eastThin = x + 0.5 + thickness;
final double east = x + 1.0;
final double down = y + yOffset;
final double up = y + 1.0 - yOffset;
final double north = z;
final double northThin = z + 0.5 - thickness;
final double southThin = z + 0.5 + thickness;
final double south = z + 1.0;
u1Scaled = 8.0 - uOffset;
u2Scaled = 8.0 + uOffset;
@@ -94,149 +93,149 @@ public class GlassPaneRenderer {
if (edges) {
// east pane edge: 1/8 wide
setupTileCoords(BlockOrientation.EAST_FACE);
drawFace(i3, j1, k2, u1, v0, i3, j0, k1, u2, v1);
drawFace(east, up, southThin, uLeftThin, vTop, east, down, northThin, uRightThin, vBottom);
// west pane edge: 1/8 wide
setupTileCoords(BlockOrientation.WEST_FACE);
drawFace(i0, j1, k1, u1, v0, i0, j0, k2, u2, v1);
drawFace(west, up, northThin, uLeftThin, vTop, west, down, southThin, uRightThin, vBottom);
// south pane edge: 1/8 wide
setupTileCoords(BlockOrientation.SOUTH_FACE);
drawFace(i1, j1, k3, u1, v0, i2, j0, k3, u2, v1);
drawFace(westThin, up, south, uLeftThin, vTop, eastThin, down, south, uRightThin, vBottom);
// north pane edge: 1/8 wide
setupTileCoords(BlockOrientation.NORTH_FACE);
drawFace(i2, j1, k0, u1, v0, i1, j0, k0, u2, v1);
drawFace(eastThin, up, north, uLeftThin, vTop, westThin, down, north, uRightThin, vBottom);
}
}
if (connectEast && connectWest) {
// full west-east pane
setupTileCoords(BlockOrientation.SOUTH_FACE);
drawFace(i0, j1, k2, u0, v0, i3, j0, k2, u3, v1);
drawFace(west, up, southThin, uLeft, vTop, east, down, southThin, uRight, vBottom);
setupTileCoords(BlockOrientation.NORTH_FACE);
drawFace(i3, j1, k1, u0, v0, i0, j0, k1, u3, v1);
drawFace(east, up, northThin, uLeft, vTop, west, down, northThin, uRight, vBottom);
} else if (connectWest) {
// west half-pane
setupTileCoords(BlockOrientation.SOUTH_FACE);
if (connectSouth) {
// inner corner: 7/16 wide
drawFace(i0, j1, k2, u2, v0, i1, j0, k2, u3, v1);
drawFace(west, up, southThin, uRightThin, vTop, westThin, down, southThin, uRight, vBottom);
} else {
// outer corner: 9/16 wide
drawFace(i0, j1, k2, u1, v0, i2, j0, k2, u3, v1);
drawFace(west, up, southThin, uLeftThin, vTop, eastThin, down, southThin, uRight, vBottom);
}
setupTileCoords(BlockOrientation.NORTH_FACE);
if (connectNorth) {
// inner corner: 7/16 wide
drawFace(i1, j1, k1, u0, v0, i0, j0, k1, u1, v1);
drawFace(westThin, up, northThin, uLeft, vTop, west, down, northThin, uLeftThin, vBottom);
} else {
// outer corner: 9/16 wide
drawFace(i2, j1, k1, u0, v0, i0, j0, k1, u2, v1);
drawFace(eastThin, up, northThin, uLeft, vTop, west, down, northThin, uRightThin, vBottom);
}
if (edges && !connectNorth && !connectSouth) {
// pane edge: 1/8 wide
setupTileCoords(BlockOrientation.EAST_FACE);
drawFace(i2, j1, k2, u1, v0, i2, j0, k1, u2, v1);
drawFace(eastThin, up, southThin, uLeftThin, vTop, eastThin, down, northThin, uRightThin, vBottom);
}
} else if (connectEast) {
// east half-pane
setupTileCoords(BlockOrientation.SOUTH_FACE);
if (connectSouth) {
// inner corner: 7/16 wide
drawFace(i2, j1, k2, u0, v0, i3, j0, k2, u1, v1);
drawFace(eastThin, up, southThin, uLeft, vTop, east, down, southThin, uLeftThin, vBottom);
} else {
// outer corner: 9/16 wide
drawFace(i1, j1, k2, u0, v0, i3, j0, k2, u2, v1);
drawFace(westThin, up, southThin, uLeft, vTop, east, down, southThin, uRightThin, vBottom);
}
setupTileCoords(BlockOrientation.NORTH_FACE);
if (connectNorth) {
// inner corner: 7/16 wide
drawFace(i3, j1, k1, u2, v0, i2, j0, k1, u3, v1);
drawFace(east, up, northThin, uRightThin, vTop, eastThin, down, northThin, uRight, vBottom);
} else {
// outer corner: 9/16 wide
drawFace(i3, j1, k1, u1, v0, i1, j0, k1, u3, v1);
drawFace(east, up, northThin, uLeftThin, vTop, westThin, down, northThin, uRight, vBottom);
}
if (edges && !connectNorth && !connectSouth) {
// pane edge: 1/8 wide
setupTileCoords(BlockOrientation.WEST_FACE);
drawFace(i1, j1, k1, u1, v0, i1, j0, k2, u2, v1);
drawFace(westThin, up, northThin, uLeftThin, vTop, westThin, down, southThin, uRightThin, vBottom);
}
}
if (connectNorth && connectSouth) {
// full north-south pane
setupTileCoords(BlockOrientation.WEST_FACE);
drawFace(i1, j1, k0, u0, v0, i1, j0, k3, u3, v1);
drawFace(westThin, up, north, uLeft, vTop, westThin, down, south, uRight, vBottom);
setupTileCoords(BlockOrientation.EAST_FACE);
drawFace(i2, j1, k3, u0, v0, i2, j0, k0, u3, v1);
drawFace(eastThin, up, south, uLeft, vTop, eastThin, down, north, uRight, vBottom);
} else if (connectNorth) {
// north half-pane
setupTileCoords(BlockOrientation.WEST_FACE);
if (connectWest) {
// inner corner: 7/16 wide
drawFace(i1, j1, k0, u2, v0, i1, j0, k1, u3, v1);
drawFace(westThin, up, north, uRightThin, vTop, westThin, down, northThin, uRight, vBottom);
} else {
// outer corner: 9/16 wide
drawFace(i1, j1, k0, u1, v0, i1, j0, k2, u3, v1);
drawFace(westThin, up, north, uLeftThin, vTop, westThin, down, southThin, uRight, vBottom);
}
setupTileCoords(BlockOrientation.EAST_FACE);
if (connectEast) {
// inner corner: 7/16 wide
drawFace(i2, j1, k1, u0, v0, i2, j0, k0, u1, v1);
drawFace(eastThin, up, northThin, uLeft, vTop, eastThin, down, north, uLeftThin, vBottom);
} else {
// outer corner: 9/16 wide
drawFace(i2, j1, k2, u0, v0, i2, j0, k0, u2, v1);
drawFace(eastThin, up, southThin, uLeft, vTop, eastThin, down, north, uRightThin, vBottom);
}
if (edges && !connectWest && !connectEast) {
// pane edge: 1/8 wide
setupTileCoords(BlockOrientation.SOUTH_FACE);
drawFace(i1, j1, k2, u1, v0, i2, j0, k2, u2, v1);
drawFace(westThin, up, southThin, uLeftThin, vTop, eastThin, down, southThin, uRightThin, vBottom);
}
} else if (connectSouth) {
// south half-pane
setupTileCoords(BlockOrientation.WEST_FACE);
if (connectWest) {
// inner corner: 7/16 wide
drawFace(i1, j1, k2, u0, v0, i1, j0, k3, u1, v1);
drawFace(westThin, up, southThin, uLeft, vTop, westThin, down, south, uLeftThin, vBottom);
} else {
// outer corner: 9/16 wide
drawFace(i1, j1, k1, u0, v0, i1, j0, k3, u2, v1);
drawFace(westThin, up, northThin, uLeft, vTop, westThin, down, south, uRightThin, vBottom);
}
setupTileCoords(BlockOrientation.EAST_FACE);
if (connectEast) {
// inner corner: 7/16 wide
drawFace(i2, j1, k3, u2, v0, i2, j0, k2, u3, v1);
drawFace(eastThin, up, south, uRightThin, vTop, eastThin, down, southThin, uRight, vBottom);
} else {
// outer corner: 9/16 wide
drawFace(i2, j1, k3, u1, v0, i2, j0, k1, u3, v1);
drawFace(eastThin, up, south, uLeftThin, vTop, eastThin, down, northThin, uRight, vBottom);
}
if (edges && !connectWest && !connectEast) {
// pane edge: 1/8 wide
setupTileCoords(BlockOrientation.NORTH_FACE);
drawFace(i2, j1, k1, u1, v0, i1, j0, k1, u2, v1);
drawFace(eastThin, up, northThin, uLeftThin, vTop, westThin, down, northThin, uRightThin, vBottom);
}
}
}
private static void setupTileCoords(int face) {
IIcon icon = icons[face];
u0 = icon.getMinU();
u1 = icon.getInterpolatedU(u1Scaled);
u2 = icon.getInterpolatedU(u2Scaled);
u3 = icon.getMaxU();
v0 = icon.getMinV();
v1 = icon.getMaxV();
final IIcon icon = icons[face];
uLeft = icon.getMinU();
uLeftThin = icon.getInterpolatedU(u1Scaled);
uRightThin = icon.getInterpolatedU(u2Scaled);
uRight = icon.getMaxU();
vTop = icon.getMinV();
vBottom = icon.getMaxV();
}
private static void drawFace(double x0, double y0, double z0, double u0, double v0, // top left
@@ -248,8 +247,9 @@ public class GlassPaneRenderer {
tessellator.addVertexWithUV(x1, y0, z1, u1, v0);
}
static void clear() {
protected static void clear() {
Arrays.fill(icons, null);
skipPaneRendering = false;
}
}
@@ -1,27 +0,0 @@
package com.prupe.mcpatcher.ctm;
import java.util.List;
import java.util.Set;
import net.minecraft.util.IIcon;
import com.prupe.mcpatcher.mal.block.BlockStateMatcher;
interface ITileOverride extends Comparable<ITileOverride> {
boolean isDisabled();
void registerIcons();
List<BlockStateMatcher> getMatchingBlocks();
Set<String> getMatchingTiles();
int getRenderPass();
int getWeight();
IIcon getTileWorld(RenderBlockState renderBlockState, IIcon origIcon);
IIcon getTileHeld(RenderBlockState renderBlockState, IIcon origIcon);
}
@@ -64,9 +64,9 @@ abstract public class RenderBlockState {
protected boolean offsetsComputed;
protected boolean haveOffsets;
protected int di;
protected int dj;
protected int dk;
protected int dx;
protected int dy;
protected int dz;
final public IBlockAccess getBlockAccess() {
return blockAccess;
@@ -99,15 +99,15 @@ abstract public class RenderBlockState {
inWorld = false;
offsetsComputed = false;
haveOffsets = false;
di = dj = dk = 0;
dx = dy = dz = 0;
setFilter(null);
}
abstract public int getI();
abstract public int getX();
abstract public int getJ();
abstract public int getY();
abstract public int getK();
abstract public int getZ();
abstract public int getBlockFace();
@@ -115,8 +115,6 @@ abstract public class RenderBlockState {
abstract public int getTextureFaceOrig();
abstract public String getTextureFaceName();
abstract public int getFaceForHV();
abstract public boolean match(BlockStateMatcher matcher);
@@ -125,20 +123,20 @@ abstract public class RenderBlockState {
abstract public boolean setCoordOffsetsForRenderType();
final public int getDI() {
return di;
final public int getDX() {
return dx;
}
final public int getDJ() {
return dj;
final public int getDY() {
return dy;
}
final public int getDK() {
return dk;
final public int getDZ() {
return dz;
}
abstract public boolean shouldConnectByBlock(Block neighbor, int neighborI, int neighborJ, int neighborK);
abstract public boolean shouldConnectByBlock(Block neighbor, int neighborX, int neighborY, int neighborZ);
abstract public boolean shouldConnectByTile(Block neighbor, IIcon origIcon, int neighborI, int neighborJ,
int neighborK);
abstract public boolean shouldConnectByTile(Block neighbor, IIcon origIcon, int neighborX, int neighborY,
int neighborZ);
}
@@ -28,7 +28,7 @@ import com.prupe.mcpatcher.mal.resource.PropertiesFile;
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
import com.prupe.mcpatcher.mal.tile.TileLoader;
abstract class TileOverride implements ITileOverride {
abstract class TileOverride implements Comparable<TileOverride> {
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CONNECTED_TEXTURES, "CTM");
@@ -306,7 +306,6 @@ abstract class TileOverride implements ITileOverride {
return String.format("%s[%s] (%d tiles)", getMethod(), properties, getNumberOfTiles());
}
@Override
public final void registerIcons() {
icons = new IIcon[tileNames.size()];
for (int i = 0; i < icons.length; i++) {
@@ -314,17 +313,14 @@ abstract class TileOverride implements ITileOverride {
}
}
@Override
final public boolean isDisabled() {
return !properties.valid();
}
@Override
final public List<BlockStateMatcher> getMatchingBlocks() {
return matchBlocks;
}
@Override
final public Set<String> getMatchingTiles() {
if (MCPatcherUtils.isNullOrEmpty(matchTiles)) {
return null;
@@ -333,18 +329,16 @@ abstract class TileOverride implements ITileOverride {
}
}
@Override
final public int getRenderPass() {
return renderPass;
}
@Override
final public int getWeight() {
return weight;
}
@Override
public int compareTo(ITileOverride o) {
public int compareTo(TileOverride o) {
int result = o.getWeight() - getWeight();
if (result != 0) {
return result;
@@ -370,19 +364,19 @@ abstract class TileOverride implements ITileOverride {
private boolean shouldConnect(RenderBlockState renderBlockState, IIcon icon, int[] offset) {
IBlockAccess blockAccess = renderBlockState.getBlockAccess();
Block block = renderBlockState.getBlock();
int i = renderBlockState.getI();
int j = renderBlockState.getJ();
int k = renderBlockState.getK();
i += offset[0];
j += offset[1];
k += offset[2];
Block neighbor = blockAccess.getBlock(i, j, k);
int x = renderBlockState.getX();
int y = renderBlockState.getY();
int z = renderBlockState.getZ();
x += offset[0];
y += offset[1];
z += offset[2];
Block neighbor = blockAccess.getBlock(x, y, z);
if (neighbor == null) {
return false;
}
if (block == neighbor) {
BlockStateMatcher filter = renderBlockState.getFilter();
if (filter != null && !filter.match(blockAccess, i, j, k)) {
if (filter != null && !filter.match(blockAccess, x, y, z)) {
return false;
}
}
@@ -392,23 +386,22 @@ abstract class TileOverride implements ITileOverride {
int[] normal = NORMALS[blockFace];
if (!neighbor.shouldSideBeRendered(
blockAccess,
i + normal[0],
j + normal[1],
k + normal[2],
x + normal[0],
y + normal[1],
z + normal[2],
blockFace)) {
return false;
}
}
}
return switch (connectType) {
case CONNECT_BY_TILE -> renderBlockState.shouldConnectByTile(neighbor, icon, i, j, k);
case CONNECT_BY_BLOCK -> renderBlockState.shouldConnectByBlock(neighbor, i, j, k);
case CONNECT_BY_TILE -> renderBlockState.shouldConnectByTile(neighbor, icon, x, y, z);
case CONNECT_BY_BLOCK -> renderBlockState.shouldConnectByBlock(neighbor, x, y, z);
case CONNECT_BY_MATERIAL -> block.blockMaterial == neighbor.blockMaterial;
default -> false;
};
}
@Override
public final IIcon getTileWorld(RenderBlockState renderBlockState, IIcon origIcon) {
if (icons == null) {
properties.error("no images loaded, disabling");
@@ -416,9 +409,9 @@ abstract class TileOverride implements ITileOverride {
}
IBlockAccess blockAccess = renderBlockState.getBlockAccess();
Block block = renderBlockState.getBlock();
int x = renderBlockState.getI();
int y = renderBlockState.getJ();
int z = renderBlockState.getK();
int x = renderBlockState.getX();
int y = renderBlockState.getY();
int z = renderBlockState.getZ();
if (renderBlockState.getBlockFace() < 0 && requiresFace()) {
properties.warning(
"method=%s is not supported for non-standard block %s:%d @ %d %d %d",
@@ -449,7 +442,6 @@ abstract class TileOverride implements ITileOverride {
return getTileWorld_Impl(renderBlockState, origIcon);
}
@Override
public final IIcon getTileHeld(RenderBlockState renderBlockState, IIcon origIcon) {
if (icons == null) {
properties.error("no images loaded, disabling");
@@ -362,15 +362,15 @@ class TileOverrideImpl {
if (face < 0) {
face = 0;
}
int i = renderBlockState.getI();
int j = renderBlockState.getJ();
int k = renderBlockState.getK();
int x = renderBlockState.getX();
int y = renderBlockState.getY();
int z = renderBlockState.getZ();
if (linked && renderBlockState.setCoordOffsetsForRenderType()) {
i += renderBlockState.getDI();
j += renderBlockState.getDJ();
k += renderBlockState.getDK();
x += renderBlockState.getDX();
y += renderBlockState.getDY();
z += renderBlockState.getDZ();
}
long hash = WeightedIndex.hash128To64(i, j, k, face / symmetry);
long hash = WeightedIndex.hash128To64(x, y, z, face / symmetry);
int index = chooser.choose(hash);
return icons[index];
}
@@ -424,25 +424,25 @@ class TileOverrideImpl {
face = 0;
}
face &= symmetry;
int i = renderBlockState.getI();
int j = renderBlockState.getJ();
int k = renderBlockState.getK();
int x = renderBlockState.getX();
int y = renderBlockState.getY();
int z = renderBlockState.getZ();
int[] xOffset = renderBlockState.getOffset(face, REL_R);
int[] yOffset = renderBlockState.getOffset(face, REL_D);
int x = i * xOffset[0] + j * xOffset[1] + k * xOffset[2];
int y = i * yOffset[0] + j * yOffset[1] + k * yOffset[2];
int offsetX = x * xOffset[0] + y * xOffset[1] + z * xOffset[2];
int offsetY = x * yOffset[0] + y * yOffset[1] + z * yOffset[2];
if (face == NORTH_FACE || face == EAST_FACE) {
x--;
offsetX--;
}
x %= width;
if (x < 0) {
x += width;
offsetX %= width;
if (offsetX < 0) {
offsetX += width;
}
y %= height;
if (y < 0) {
y += height;
offsetY %= height;
if (offsetY < 0) {
offsetY += height;
}
return icons[width * y + x];
return icons[width * offsetY + offsetX];
}
@Override
@@ -13,28 +13,28 @@ import com.prupe.mcpatcher.mal.block.BlockStateMatcher;
import jss.notfine.config.MCPatcherForgeConfig;
abstract public class TileOverrideIterator implements Iterator<ITileOverride> {
abstract public class TileOverrideIterator implements Iterator<TileOverride> {
private static final int MAX_RECURSION = MCPatcherForgeConfig.instance().maxRecursion;
private final Map<Block, List<BlockStateMatcher>> allBlockOverrides;
private final Map<String, List<ITileOverride>> allTileOverrides;
private final Map<String, List<TileOverride>> allTileOverrides;
protected IIcon currentIcon;
private List<BlockStateMatcher> blockOverrides;
private List<ITileOverride> tileOverrides;
private final Set<ITileOverride> skipOverrides = new HashSet<>();
private List<TileOverride> tileOverrides;
private final Set<TileOverride> skipOverrides = new HashSet<>();
private RenderBlockState renderBlockState;
private int blockPos;
private int iconPos;
private boolean foundNext;
private ITileOverride nextOverride;
private ITileOverride lastMatchedOverride;
private TileOverride nextOverride;
private TileOverride lastMatchedOverride;
protected TileOverrideIterator(Map<Block, List<BlockStateMatcher>> allBlockOverrides,
Map<String, List<ITileOverride>> allTileOverrides) {
Map<String, List<TileOverride>> allTileOverrides) {
this.allBlockOverrides = allBlockOverrides;
this.allTileOverrides = allTileOverrides;
}
@@ -72,7 +72,7 @@ abstract public class TileOverrideIterator implements Iterator<ITileOverride> {
if (blockOverrides != null) {
while (blockPos < blockOverrides.size()) {
BlockStateMatcher matcher = blockOverrides.get(blockPos++);
if (renderBlockState.match(matcher) && checkOverride((ITileOverride) matcher.getData())) {
if (renderBlockState.match(matcher) && checkOverride((TileOverride) matcher.getData())) {
renderBlockState.setFilter(matcher);
return true;
}
@@ -82,7 +82,7 @@ abstract public class TileOverrideIterator implements Iterator<ITileOverride> {
}
@Override
public synchronized ITileOverride next() {
public synchronized TileOverride next() {
if (!foundNext) {
throw new IllegalStateException("next called before hasNext() == true");
}
@@ -95,7 +95,7 @@ abstract public class TileOverrideIterator implements Iterator<ITileOverride> {
throw new UnsupportedOperationException("remove not supported");
}
private synchronized boolean checkOverride(ITileOverride override) {
private synchronized boolean checkOverride(TileOverride override) {
if (override != null && !override.isDisabled() && !skipOverrides.contains(override)) {
foundNext = true;
nextOverride = override;
@@ -105,7 +105,7 @@ abstract public class TileOverrideIterator implements Iterator<ITileOverride> {
}
}
public synchronized ITileOverride go(RenderBlockState renderBlockState, IIcon origIcon) {
public synchronized TileOverride go(RenderBlockState renderBlockState, IIcon origIcon) {
this.renderBlockState = renderBlockState;
renderBlockState.setFilter(null);
currentIcon = origIcon;
@@ -120,7 +120,7 @@ abstract public class TileOverrideIterator implements Iterator<ITileOverride> {
pass: for (int pass = 0; pass < MAX_RECURSION; pass++) {
while (hasNext()) {
ITileOverride override = next();
TileOverride override = next();
IIcon newIcon = getTile(override, renderBlockState, origIcon);
if (newIcon != null) {
lastMatchedOverride = override;
@@ -139,28 +139,28 @@ abstract public class TileOverrideIterator implements Iterator<ITileOverride> {
return currentIcon;
}
abstract protected IIcon getTile(ITileOverride override, RenderBlockState renderBlockState, IIcon origIcon);
abstract protected IIcon getTile(TileOverride override, RenderBlockState renderBlockState, IIcon origIcon);
public static final class IJK extends TileOverrideIterator {
IJK(Map<Block, List<BlockStateMatcher>> blockOverrides, Map<String, List<ITileOverride>> tileOverrides) {
IJK(Map<Block, List<BlockStateMatcher>> blockOverrides, Map<String, List<TileOverride>> tileOverrides) {
super(blockOverrides, tileOverrides);
}
@Override
protected synchronized IIcon getTile(ITileOverride override, RenderBlockState renderBlockState, IIcon origIcon) {
protected synchronized IIcon getTile(TileOverride override, RenderBlockState renderBlockState, IIcon origIcon) {
return override.getTileWorld(renderBlockState, origIcon);
}
}
public static final class Metadata extends TileOverrideIterator {
Metadata(Map<Block, List<BlockStateMatcher>> blockOverrides, Map<String, List<ITileOverride>> tileOverrides) {
Metadata(Map<Block, List<BlockStateMatcher>> blockOverrides, Map<String, List<TileOverride>> tileOverrides) {
super(blockOverrides, tileOverrides);
}
@Override
protected synchronized IIcon getTile(ITileOverride override, RenderBlockState renderBlockState, IIcon origIcon) {
protected synchronized IIcon getTile(TileOverride override, RenderBlockState renderBlockState, IIcon origIcon) {
return override.getTileHeld(renderBlockState, origIcon);
}
}
@@ -49,7 +49,7 @@ public class TexturePackAPI {
public static List<IResourcePack> getResourcePacks(String namespace) {
List<IResourcePack> resourcePacks = new ArrayList<>();
IResourceManager resourceManager = getResourceManager();
IResourceManager resourceManager = Minecraft.getMinecraft().getResourceManager();
if (resourceManager instanceof SimpleReloadableResourceManager) {
Set<Map.Entry<String, FallbackResourceManager>> entrySet = ((SimpleReloadableResourceManager) resourceManager).domainResourceManagers
.entrySet();
@@ -69,7 +69,7 @@ public class TexturePackAPI {
public static Set<String> getNamespaces() {
Set<String> namespaces = new HashSet<>();
namespaces.add(DEFAULT_NAMESPACE);
IResourceManager resourceManager = getResourceManager();
IResourceManager resourceManager = Minecraft.getMinecraft().getResourceManager();
if (resourceManager instanceof SimpleReloadableResourceManager simpleReloadableResourceManager) {
namespaces.addAll(simpleReloadableResourceManager.domainResourceManagers.keySet());
}
@@ -307,8 +307,7 @@ public class TexturePackAPI {
}
public static void flushUnusedTextures() {
TextureManager textureManager = Minecraft.getMinecraft()
.getTextureManager();
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
if (textureManager != null) {
Set<ResourceLocation> texturesToUnload = new HashSet<>();
Set<Map.Entry<ResourceLocation, ITextureObject>> entrySet = textureManager.mapTextureObjects.entrySet();
@@ -326,8 +325,4 @@ public class TexturePackAPI {
}
}
private static IResourceManager getResourceManager() {
return Minecraft.getMinecraft()
.getResourceManager();
}
}
+17 -4
View File
@@ -40,7 +40,7 @@ public enum Settings {
SettingsManager.cloudsUpdated();
}
},
CLOUD_SCALE(new NotFineOptionSlider(4, 2, 20, 1, null)),
CLOUD_SCALE(new NotFineOptionSlider(1, 1, 3, 1, null)),
DOWNFALL_DISTANCE(new NotFineOptionCycling<>(DownfallQuality.DEFAULT, OptionImpact.MEDIUM)) {
@Override
public void applyChanges() {
@@ -54,6 +54,7 @@ public enum Settings {
DynamicLights.Mode = (DynamicLightsMode) DYNAMIC_LIGHTS.option.getStore();
}
},
FOG_NEAR_DISTANCE(new NotFineOptionSliderPercentage(75, 1, 100, 1, OptionImpact.LOW)),
GUI_BACKGROUND(new NotFineOptionCycling<>(BackgroundSelect.DEFAULT, null)) {
@Override
public void applyChanges() {
@@ -111,7 +112,7 @@ public enum Settings {
},
PARTICLES_ENC_TABLE(new NotFineOptionSlider(1, 0, 16, 1, OptionImpact.LOW)),
PARTICLES_VOID(new NotFineOptionTickBox(true, OptionImpact.LOW)),
RENDER_DISTANCE_CLOUDS(new NotFineOptionSlider(4, 4, 64, 2, OptionImpact.VARIES)) {
RENDER_DISTANCE_CLOUDS(new NotFineOptionSlider(4, 4, 64, 1, OptionImpact.VARIES)) {
@Override
public void applyChanges() {
SettingsManager.cloudsUpdated();
@@ -171,8 +172,7 @@ public enum Settings {
@Override
public Control<Integer> getControl() {
//TODO: Don't hardcode CLOUD_SCALE check.
return new SliderControl(this, min, max, step, setting != Settings.CLOUD_SCALE ? ControlValueFormatter.number() : NotFineControlValueFormatter.multiplied(0.25f));
return new SliderControl(this, min, max, step, ControlValueFormatter.number());
}
@Override
@@ -188,6 +188,19 @@ public enum Settings {
}
}
public static class NotFineOptionSliderPercentage extends NotFineOptionSlider {
protected NotFineOptionSliderPercentage(int base, int min, int max, int step, OptionImpact impact, OptionFlag... optionFlags) {
super(base, min, max, step, impact, optionFlags);
}
@Override
public Control<Integer> getControl() {
return new SliderControl(this, min, max, step, NotFineControlValueFormatter.percentage());
}
}
public static class NotFineOptionTickBox extends NotFineOption<Boolean> {
protected NotFineOptionTickBox(boolean base, OptionImpact impact, OptionFlag... optionFlags) {
@@ -57,8 +57,8 @@ public class SettingsManager {
public static void cloudsUpdated() {
if(Settings.MODE_CLOUDS.option.getStore() != GraphicsQualityOff.OFF) {
minimumFarPlaneDistance = 32 * (int)Settings.RENDER_DISTANCE_CLOUDS.option.getStore();
minimumFarPlaneDistance += Math.abs((int)Settings.CLOUD_HEIGHT.option.getStore());
minimumFarPlaneDistance = 32 * ((int)Settings.RENDER_DISTANCE_CLOUDS.option.getStore());
minimumFarPlaneDistance += (int)Settings.CLOUD_HEIGHT.option.getStore();
mc.gameSettings.clouds = true;
} else {
minimumFarPlaneDistance = 128;
@@ -190,7 +190,7 @@ public class NotFineGameOptionPages {
.add(Settings.MODE_WATER.option)
.add(Settings.DOWNFALL_DISTANCE.option)
.add(Settings.MODE_VIGNETTE.option)
.add(Settings.DYNAMIC_LIGHTS.option)
.add(Settings.DYNAMIC_LIGHTS.option, AngelicaConfig.enableDynamicLights)
.add(Settings.MODE_SHADOWS.option)
.add(Settings.VOID_FOG.option)
.add(Settings.MODE_DROPPED_ITEMS.option)
@@ -206,12 +206,13 @@ public class NotFineGameOptionPages {
.add(Settings.MODE_SKY.option)
.add(Settings.MODE_SUN_MOON.option)
.add(Settings.MODE_CLOUDS.option)
//.add(Settings.RENDER_DISTANCE_CLOUDS.option)
.add(Settings.RENDER_DISTANCE_CLOUDS.option)
.add(Settings.CLOUD_HEIGHT.option)
//.add(Settings.CLOUD_SCALE.option)
.add(Settings.CLOUD_SCALE.option)
.add(Settings.MODE_CLOUD_TRANSLUCENCY.option)
.add(Settings.MODE_STARS.option)
.add(Settings.TOTAL_STARS.option)
.add(Settings.FOG_NEAR_DISTANCE.option)
.build());
return new OptionPage(I18n.format("options.button.sky"), ImmutableList.copyOf(groups));
}
@@ -4,6 +4,7 @@ import me.jellysquid.mods.sodium.client.gui.options.control.ControlValueFormatte
import net.minecraft.client.resources.I18n;
public class NotFineControlValueFormatter {
public static ControlValueFormatter multiplied(float multiplier) {
return (value) -> String.valueOf((value * multiplier));
}
@@ -12,4 +13,8 @@ public class NotFineControlValueFormatter {
return (v) -> (v == 0) ? I18n.format("options.off") : I18n.format((int)Math.pow(2, v) + "x");
}
public static ControlValueFormatter percentage() {
return (value) -> String.valueOf(value) + "%";
}
}
@@ -0,0 +1,64 @@
package jss.notfine.render;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureUtil;
/**
* Originally created by ganymedes01 for Et Futurum.
* Ported to NotFine and cleaned up by Roadhog360.
* @author ganymedes01
* @author Roadhog360
*/
@SideOnly(Side.CLIENT)
public class InterpolatedIcon extends TextureAtlasSprite {
protected int[][] interpolatedFrameData;
public InterpolatedIcon(String name) {
super(name);
}
@Override
public void updateAnimation() {
super.updateAnimation();
try {
updateAnimationInterpolated();
} catch (Exception e) {
}
}
private void updateAnimationInterpolated() throws IllegalArgumentException, IllegalAccessException {
double d0 = 1.0D - tickCounter / (double) animationMetadata.getFrameTimeSingle(frameCounter);
int i = animationMetadata.getFrameIndex(frameCounter);
int j = animationMetadata.getFrameCount() == 0 ? framesTextureData.size() : animationMetadata.getFrameCount();
int k = animationMetadata.getFrameIndex((frameCounter + 1) % j);
if (i != k && k >= 0 && k < framesTextureData.size()) {
int[][] aint = (int[][]) framesTextureData.get(i);
int[][] aint1 = (int[][]) framesTextureData.get(k);
if (interpolatedFrameData == null || interpolatedFrameData.length != aint.length)
interpolatedFrameData = new int[aint.length][];
for (int l = 0; l < aint.length; l++) {
if (interpolatedFrameData[l] == null)
interpolatedFrameData[l] = new int[aint[l].length];
if (l < aint1.length && aint1[l].length == aint[l].length)
for (int i1 = 0; i1 < aint[l].length; ++i1) {
int j1 = aint[l][i1];
int k1 = aint1[l][i1];
int l1 = (int) (((j1 & 16711680) >> 16) * d0 + ((k1 & 16711680) >> 16) * (1.0D - d0));
int i2 = (int) (((j1 & 65280) >> 8) * d0 + ((k1 & 65280) >> 8) * (1.0D - d0));
int j2 = (int) ((j1 & 255) * d0 + (k1 & 255) * (1.0D - d0));
interpolatedFrameData[l][i1] = j1 & -16777216 | l1 << 16 | i2 << 8 | j2;
}
}
TextureUtil.uploadTextureMipmap(interpolatedFrameData, width, height, originX, originY, false, false);
}
}
}
@@ -81,13 +81,14 @@ public class SodiumGameOptionPages {
firstGroupBuilder.add(Settings.MODE_LIGHT_FLICKER.option)
.add(Settings.MODE_SKY.option)
.add(Settings.MODE_SUN_MOON.option)
//.add(Settings.RENDER_DISTANCE_CLOUDS.option)
.add(Settings.RENDER_DISTANCE_CLOUDS.option)
.add(Settings.CLOUD_HEIGHT.option)
//.add(Settings.CLOUD_SCALE.option)
.add(Settings.CLOUD_SCALE.option)
.add(Settings.MODE_CLOUD_TRANSLUCENCY.option)
.add(Settings.MODE_STARS.option)
.add(Settings.TOTAL_STARS.option);
firstGroupBuilder.add(Settings.VOID_FOG.option);
.add(Settings.TOTAL_STARS.option)
.add(Settings.FOG_NEAR_DISTANCE.option)
.add(Settings.VOID_FOG.option);
groups.add(firstGroupBuilder.build());
int maxGuiScale = Math.max(3, Math.min(Minecraft.getMinecraft().displayWidth / 320, Minecraft.getMinecraft().displayHeight / 240));
@@ -221,7 +222,7 @@ public class SodiumGameOptionPages {
)*/
.add(Settings.MODE_SHADOWS.option)
.add(Settings.MODE_VIGNETTE.option)
.add(Settings.DYNAMIC_LIGHTS.option)
.add(Settings.DYNAMIC_LIGHTS.option, AngelicaConfig.enableDynamicLights)
.build());
@@ -30,6 +30,12 @@ public class OptionGroup {
return this;
}
public Builder add(Option<?> option, boolean isVisible){
if (isVisible) return add(option);
return this;
}
public OptionGroup build() {
Validate.notEmpty(this.options, "At least one option must be specified");
@@ -7,6 +7,7 @@ import com.gtnewhorizons.angelica.compat.toremove.RenderLayer;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.gtnewhorizons.angelica.rendering.RenderingState;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import it.unimi.dsi.fastutil.longs.LongSet;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
@@ -64,6 +65,7 @@ public class SodiumWorldRenderer implements ChunkStatusListener {
private int renderDistance;
private double lastCameraX, lastCameraY, lastCameraZ;
private float lastFov;
private double lastCameraPitch, lastCameraYaw;
private float lastFogDistance;
@@ -213,8 +215,10 @@ public class SodiumWorldRenderer implements ChunkStatusListener {
float fogDistance = FogHelper.getFogCutoff();
float fov = RenderingState.INSTANCE.getFov();
boolean dirty = pos.x != this.lastCameraX || pos.y != this.lastCameraY || pos.z != this.lastCameraZ ||
pitch != this.lastCameraPitch || yaw != this.lastCameraYaw || fogDistance != this.lastFogDistance;
pitch != this.lastCameraPitch || yaw != this.lastCameraYaw || fogDistance != this.lastFogDistance || fov != this.lastFov;
if(AngelicaConfig.enableIris) {
iris$ensureStateSwapped();
@@ -232,6 +236,7 @@ public class SodiumWorldRenderer implements ChunkStatusListener {
this.lastCameraPitch = pitch;
this.lastCameraYaw = yaw;
this.lastFogDistance = fogDistance;
this.lastFov = fov;
profiler.endStartSection("chunk_update");
@@ -45,6 +45,7 @@ public class FluidRenderer {
private final QuadLightData quadLightData = new QuadLightData();
private boolean useSeparateAo;
private final int[] quadColors = new int[4];
private final TextureAtlasSprite missingTex = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:missing");
public FluidRenderer(LightPipelineProvider lpp) {
int normal = Norm3b.pack(0.0f, 1.0f, 0.0f);
@@ -95,7 +96,7 @@ public class FluidRenderer {
int posZ = pos.z;
Fluid fluid = ((IFluidBlock) block).getFluid();
if(fluid == null) return false;
if (fluid == null) return false;
// Check for occluded sides; if everything is occluded, don't render
boolean sfUp = this.isFluidOccluded(world, posX, posY, posZ, ForgeDirection.UP, fluid);
@@ -117,6 +118,11 @@ public class FluidRenderer {
(TextureAtlasSprite) fluid.getFlowingIcon(),
null
};
// Because some mods are wack and return null textures here
sprites[0] = sprites[0] == null ? missingTex : sprites[0];
sprites[1] = sprites[1] == null ? missingTex : sprites[1];
boolean hc = fluid.getColor() != 0xffffffff;
boolean rendered = false;
@@ -10,3 +10,7 @@ public net.minecraft.client.renderer.Tessellator field_78406_i #vertexCount
public-f net.minecraft.client.settings.GameSettings$Options field_148270_M #valueStep
#For supporting some strangely setup mods
public net.minecraft.block.BlockLeaves field_150129_M
#For the interpolated icon class
public net.minecraft.client.renderer.texture.TextureAtlasSprite field_110982_k #animationMetadata
#For interpolated icon mixin
public net.minecraft.client.resources.SimpleResource field_110530_g #mcmetaJson
Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 B

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 B

After

Width:  |  Height:  |  Size: 303 B

@@ -1,4 +1,5 @@
matchBlocks=minecraft:bookshelf
matchTiles=bookshelf
faces=sides
tiles=0-3
method=horizontal
method=horizontal
connect=tile
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

@@ -0,0 +1,5 @@
matchTiles=sandstone_normal
metadata=0
method=top
tiles=0
connect=tile
@@ -14,7 +14,6 @@ options.gui_background.2=Steinziegel
options.gui_background.3=Bemooste Steinziegel
options.gui_background.4=Eichenholzbretter
options.gui_background.5=Birkenholzbretter
options.guiScale.massive=Riesig
options.mode_cloud_translucency=Wolkendurchlässigkeit
options.mode_cloud_translucency.-1=Standard
options.mode_cloud_translucency.0=Immer
@@ -52,4 +51,3 @@ options.title.particle=Partikeleinstellungen
options.title.sky=Atmosphäreneinstellungen
options.title.video=Grafikeinstellungen
options.total_stars=Sternendichte
options.void_fog=Void Fog
@@ -10,15 +10,13 @@ options.graphics.smart=Smart
options.graphics.ultra=Ultra
options.off=Off
options.on=On
options.cloud_height=Cloud Height
options.cloud_height=Cloud Elevation
options.cloud_scale=Cloud Scale
options.gui_background=Background
options.guiScale.massive=Massive
options.downfall_distance=Weather Effects
options.dynamic_fov=Dynamic FOV
options.dynamic_fov.tooltip=If enabled, the game's field of view will change based on the player's speed.
options.dynamic_lights=Dynamic Lights
options.dynamic_lights.tooltip=Enables dynamic lights. Modes: OFF - off, FASTEST - 500ms delay, FAST - 250ms delay, FANCY - no delay
options.fog_near_distance=Near Fog Distance
options.mode_cloud_translucency=Cloud Translucency
options.mode_clouds=Clouds
options.mode_dropped_items=Dropped Items
@@ -35,7 +33,7 @@ options.mode_water=Water
options.mode_vignette=Vignette
options.particles_enc_table=Enchantment Particles
options.particles_void=Void Particles
options.render_distance_clouds=Cloud Render Distance
options.render_distance_clouds=Minimum Cloud Distance
options.title.detail=Detail Settings
options.title.other=Other Settings
options.title.particle=Particle Settings
@@ -14,7 +14,6 @@ options.gui_background.2=Kamienne cegły
options.gui_background.3=Zamszone kamienne cegły
options.gui_background.4=Dębowe deski
options.gui_background.5=Brzozowe deski
options.guiScale.massive=Massive
options.downfall_distance=Efekty pogody
options.downfall_distance.-1=Domyślne
options.downfall_distance.0=Szybkie
@@ -66,4 +65,3 @@ options.title.particle=Ustawienia cząsteczek
options.title.sky=Ustawienia atmosfery
options.title.video=Ustawienia graficzne
options.total_stars=Gęstość gwiazd
options.void_fog=Void Fog
@@ -13,10 +13,10 @@ options.on=打开
options.cloud_height=云高度
options.cloud_scale=云比例
options.gui_background=背景
options.guiScale.massive=巨大
options.downfall_distance=天气效果距离
options.dynamic_fov=动态视场
options.dynamic_fov.tooltip=如果启用,游戏的视场将根据玩家的速度而变化
options.fog_near_distance=迷雾起始位置
options.mode_cloud_translucency=云透明度
options.mode_clouds=云
options.mode_dropped_items=掉落物品
@@ -34,10 +34,11 @@ options.mode_vignette=晕影
options.particles_enc_table=附魔粒子效果
options.particles_void=虚空粒子效果
options.render_distance_clouds=云渲染距离
options.title.detail=细节设置 | 来自 NotFine
options.title.other=杂项设置 | 来自NotFine
options.title.particle=粒子设置 | 来自NotFine
options.title.sky=天空设置 | 来自NotFine
options.title.video=视频设置 | 来自NotFine
options.title.detail=细节设置
options.title.other=杂项设置
options.title.particle=粒子设置
options.title.sky=天空设置
options.title.video=视频设置
options.total_stars=星星密度
options.void_fog=Void Fog
options.void_fog=虚空雾