mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-24 06:04:27 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88936d3713 | ||
|
|
cf5bf2e2e7 | ||
|
|
cfd2388c85 |
No files matched your search
@@ -2,9 +2,11 @@ package com.gtnewhorizons.angelica.common;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
/**
|
||||
* This Block is not actually getting registered. A static instance is created in AngelicaMod.
|
||||
@@ -19,6 +21,8 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class BlockError extends Block {
|
||||
|
||||
public static final IIcon[] icons = new IIcon[2];
|
||||
|
||||
public BlockError() {
|
||||
super(Material.rock);
|
||||
}
|
||||
@@ -27,7 +31,15 @@ public class BlockError extends Block {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg)
|
||||
{
|
||||
this.blockIcon = reg.registerIcon("angelica:error_block");
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
icons[i] = reg.registerIcon("angelica:error_block_" + i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
}
|
||||
File renamed without changes.
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
@@ -15,7 +15,9 @@ options.cloud_height.tooltip=Cloud Elevation
|
||||
options.cloud_scale=Cloud Scale
|
||||
options.cloud_scale.tooltip=Cloud Scale
|
||||
options.gui_background=Background
|
||||
options.gui_background.tooltip=Background
|
||||
options.downfall_distance=Weather Effects
|
||||
options.downfall_distance.tooltip=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.fog_near_distance=Near Fog Distance
|
||||
@@ -31,10 +33,13 @@ options.mode_glint_inv.tooltip=GUI Enchant VFX
|
||||
options.mode_glint_world=World Enchant VFX
|
||||
options.mode_glint_world.tooltip=World Enchant VFX
|
||||
options.mode_gui_background=Menu Backgrounds
|
||||
options.mode_gui_background.tooltip=Menu Backgrounds
|
||||
options.mode_leaves=Foliage
|
||||
options.mode_leaves.tooltip=Foliage
|
||||
options.mode_light_flicker=Light Flicker
|
||||
options.mode_light_flicker.tooltip=Light Flicker
|
||||
options.mode_shadows=Entity Shadows
|
||||
options.mode_shadows.tooltip=Entity Shadows
|
||||
options.mode_sky=Sky
|
||||
options.mode_sky.tooltip=Render the Sky
|
||||
options.mode_sun_moon=Sun & Moon
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
public abstract class MixinEntityRenderer implements IResourceManagerReloadListener {
|
||||
@Shadow public Minecraft mc;
|
||||
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glClear(I)V", shift = At.Shift.AFTER, ordinal = 0), method = "renderWorld(FJ)V", remap = false)
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/culling/ClippingHelperImpl;getInstance()Lnet/minecraft/client/renderer/culling/ClippingHelper;", shift = At.Shift.AFTER, ordinal = 0), method = "renderWorld(FJ)V")
|
||||
private void iris$beginRender(float partialTicks, long startTime, CallbackInfo ci, @Share("pipeline") LocalRef<WorldRenderingPipeline> pipeline) {
|
||||
CapturedRenderingState.INSTANCE.setTickDelta(partialTicks);
|
||||
SystemTimeUniforms.COUNTER.beginFrame();
|
||||
|
||||
+36
-12
@@ -1,8 +1,12 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.sodium;
|
||||
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.common.BlockError;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import me.jellysquid.mods.sodium.client.SodiumClientMod;
|
||||
import net.coderbot.iris.block_rendering.BlockRenderingSettings;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -19,6 +23,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
@Mixin(RenderBlocks.class)
|
||||
public abstract class MixinRenderBlocks {
|
||||
|
||||
@Unique
|
||||
private static final ObjectOpenHashSet<String> isbrhExceptionCache = new ObjectOpenHashSet<>();
|
||||
|
||||
@Unique
|
||||
private static final Object2IntOpenHashMap<Class<? extends Exception>> exceptionErrorBlockMap = new Object2IntOpenHashMap<>();
|
||||
|
||||
static {
|
||||
exceptionErrorBlockMap.put(NullPointerException.class, 0);
|
||||
exceptionErrorBlockMap.put(ArrayIndexOutOfBoundsException.class, 1);
|
||||
}
|
||||
|
||||
@Unique
|
||||
private boolean isRenderingByType = false;
|
||||
|
||||
@@ -54,12 +69,7 @@ public abstract class MixinRenderBlocks {
|
||||
expect = 0
|
||||
)
|
||||
private boolean wrapRenderWorldBlockObfuscated(RenderBlocks rb, IBlockAccess world, int x, int y, int z, Block block, int modelId) {
|
||||
try {
|
||||
return RenderingRegistry.instance().renderWorldBlock(rb, world, x, y, z, block, modelId);
|
||||
} catch (NullPointerException ignored) {
|
||||
rb.renderStandardBlock(AngelicaMod.blockError, x, y, z);
|
||||
}
|
||||
return false;
|
||||
return handleISBRHException(rb, world, x, y, z, block, modelId);
|
||||
}
|
||||
|
||||
@Redirect(
|
||||
@@ -72,12 +82,7 @@ public abstract class MixinRenderBlocks {
|
||||
expect = 0
|
||||
)
|
||||
private boolean wrapRenderWorldBlockDeobfuscated(RenderBlocks rb, IBlockAccess world, int x, int y, int z, Block block, int modelId) {
|
||||
try {
|
||||
return RenderingRegistry.instance().renderWorldBlock(rb, world, x, y, z, block, modelId);
|
||||
} catch (NullPointerException ignored) {
|
||||
rb.renderStandardBlock(AngelicaMod.blockError, x, y, z);
|
||||
}
|
||||
return false;
|
||||
return handleISBRHException(rb, world, x, y, z, block, modelId);
|
||||
}
|
||||
|
||||
@Redirect(method = "renderStandardBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;isAmbientOcclusionEnabled()Z"))
|
||||
@@ -89,4 +94,23 @@ public abstract class MixinRenderBlocks {
|
||||
|
||||
return Minecraft.isAmbientOcclusionEnabled();
|
||||
}
|
||||
|
||||
private boolean handleISBRHException(RenderBlocks rb, IBlockAccess world, int x, int y, int z, Block block, int modelId) {
|
||||
try {
|
||||
return RenderingRegistry.instance().renderWorldBlock(rb, world, x, y, z, block, modelId);
|
||||
} catch (NullPointerException | ArrayIndexOutOfBoundsException e) {
|
||||
// Render Error Block
|
||||
int meta = exceptionErrorBlockMap.getOrDefault(e.getClass(), 0);
|
||||
rb.overrideBlockTexture = BlockError.icons[exceptionErrorBlockMap.getOrDefault(e.getClass(), 0)];
|
||||
rb.renderStandardBlock(AngelicaMod.blockError, x, y, z);
|
||||
rb.overrideBlockTexture = null;
|
||||
|
||||
// Check if we've already caught the exception for this block and log it if we haven't
|
||||
String key = block.getUnlocalizedName() + ":" + meta;
|
||||
if (isbrhExceptionCache.add(key)) {
|
||||
AngelicaTweaker.LOGGER.warn("Caught an exception during ISBRH rendering for {} at position {}, {}, {} with renderer ID {}", block.getUnlocalizedName(), x, y, z, modelId, e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user