mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-19 11:59:40 +00:00
Leaf render mode edge case handling
This commit is contained in:
1 parent
986f1bd6a1
commit
d8d8cd93c5
7 files changed
+83
-170
No files matched your search
+8
-15
@@ -1,13 +1,10 @@
|
||||
package com.gtnewhorizons.angelica.mixins.late.notfine.leaves.thaumcraft;
|
||||
|
||||
import jss.notfine.gui.options.named.LeavesQuality;
|
||||
import jss.notfine.util.IFaceObstructionCheckHelper;
|
||||
import jss.notfine.util.ILeafBlock;
|
||||
import jss.notfine.core.Settings;
|
||||
import jss.notfine.core.SettingsManager;
|
||||
import jss.notfine.util.LeafRenderUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -16,21 +13,12 @@ import org.spongepowered.asm.mixin.Shadow;
|
||||
import thaumcraft.common.blocks.BlockMagicalLeaves;
|
||||
|
||||
@Mixin(value = BlockMagicalLeaves.class)
|
||||
public abstract class MixinBlockMagicalLeaves extends Block implements ILeafBlock {
|
||||
public abstract class MixinBlockMagicalLeaves extends Block implements IFaceObstructionCheckHelper, ILeafBlock {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
int maskedMeta = world.getBlockMetadata(x, y, z) & 3;
|
||||
int renderMode;
|
||||
if(Settings.MODE_LEAVES.option.getStore() == LeavesQuality.SHELLED_FAST) {
|
||||
renderMode = world.getBlock(
|
||||
x + Facing.offsetsXForSide[side],
|
||||
y + Facing.offsetsYForSide[side],
|
||||
z + Facing.offsetsZForSide[side]
|
||||
) instanceof ILeafBlock ? 1 : 0;
|
||||
} else {
|
||||
renderMode = SettingsManager.leavesOpaque ? 1 : 0;
|
||||
}
|
||||
final int renderMode = LeafRenderUtil.selectRenderMode(world, x, y, z, side) ? 1 : 0;
|
||||
maskedMeta = maskedMeta > 1 ? 0 : maskedMeta;
|
||||
return icon[renderMode + maskedMeta * 2];
|
||||
}
|
||||
@@ -44,6 +32,11 @@ public abstract class MixinBlockMagicalLeaves extends Block implements ILeafBloc
|
||||
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 MixinBlockMagicalLeaves(Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
+2
-15
@@ -1,12 +1,8 @@
|
||||
package com.gtnewhorizons.angelica.mixins.late.notfine.leaves.twilightforest;
|
||||
|
||||
import jss.notfine.core.Settings;
|
||||
import jss.notfine.core.SettingsManager;
|
||||
import jss.notfine.gui.options.named.LeavesQuality;
|
||||
import jss.notfine.util.ILeafBlock;
|
||||
import jss.notfine.util.LeafRenderUtil;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -18,16 +14,7 @@ public abstract class MixinBlockTFLeaves extends BlockLeaves {
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
int maskedMeta = world.getBlockMetadata(x, y, z) & 3;
|
||||
int renderMode;
|
||||
if(Settings.MODE_LEAVES.option.getStore() == LeavesQuality.SHELLED_FAST) {
|
||||
renderMode = world.getBlock(
|
||||
x + Facing.offsetsXForSide[side],
|
||||
y + Facing.offsetsYForSide[side],
|
||||
z + Facing.offsetsZForSide[side]
|
||||
) instanceof ILeafBlock ? 1 : 0;
|
||||
} else {
|
||||
renderMode = SettingsManager.leavesOpaque ? 1 : 0;
|
||||
}
|
||||
int renderMode = LeafRenderUtil.selectRenderMode(world, x, y, z, side) ? 1 : 0;
|
||||
maskedMeta = maskedMeta > 1 ? 0 : maskedMeta;
|
||||
return Blocks.leaves.field_150129_M[renderMode][maskedMeta];
|
||||
}
|
||||
|
||||
+2
-15
@@ -1,12 +1,8 @@
|
||||
package com.gtnewhorizons.angelica.mixins.late.notfine.leaves.twilightforest;
|
||||
|
||||
import jss.notfine.core.Settings;
|
||||
import jss.notfine.core.SettingsManager;
|
||||
import jss.notfine.gui.options.named.LeavesQuality;
|
||||
import jss.notfine.util.ILeafBlock;
|
||||
import jss.notfine.util.LeafRenderUtil;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -17,16 +13,7 @@ public abstract class MixinBlockTFLeaves3 extends BlockLeaves {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
int renderMode;
|
||||
if(Settings.MODE_LEAVES.option.getStore() == LeavesQuality.SHELLED_FAST) {
|
||||
renderMode = world.getBlock(
|
||||
x + Facing.offsetsXForSide[side],
|
||||
y + Facing.offsetsYForSide[side],
|
||||
z + Facing.offsetsZForSide[side]
|
||||
) instanceof ILeafBlock ? 1 : 0;
|
||||
} else {
|
||||
renderMode = SettingsManager.leavesOpaque ? 1 : 0;
|
||||
}
|
||||
final int renderMode = LeafRenderUtil.selectRenderMode(world, x, y, z, side) ? 1 : 0;
|
||||
return Blocks.leaves.field_150129_M[renderMode][0];
|
||||
}
|
||||
|
||||
|
||||
+5
-18
@@ -1,11 +1,7 @@
|
||||
package com.gtnewhorizons.angelica.mixins.late.notfine.leaves.twilightforest;
|
||||
|
||||
import jss.notfine.core.Settings;
|
||||
import jss.notfine.core.SettingsManager;
|
||||
import jss.notfine.gui.options.named.LeavesQuality;
|
||||
import jss.notfine.util.ILeafBlock;
|
||||
import jss.notfine.util.LeafRenderUtil;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -17,21 +13,12 @@ public abstract class MixinBlockTFMagicLeaves extends BlockLeaves {
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
int maskedMeta = world.getBlockMetadata(x, y, z) & 3;
|
||||
int renderMode;
|
||||
if(Settings.MODE_LEAVES.option.getStore() == LeavesQuality.SHELLED_FAST) {
|
||||
renderMode = world.getBlock(
|
||||
x + Facing.offsetsXForSide[side],
|
||||
y + Facing.offsetsYForSide[side],
|
||||
z + Facing.offsetsZForSide[side]
|
||||
) instanceof ILeafBlock ? 1 : 0;
|
||||
} else {
|
||||
renderMode = SettingsManager.leavesOpaque ? 1 : 0;
|
||||
}
|
||||
final boolean renderMode = LeafRenderUtil.selectRenderMode(world, x, y, z, side);
|
||||
maskedMeta = maskedMeta > 1 ? 0 : maskedMeta;
|
||||
return switch (maskedMeta) {
|
||||
case 1 -> renderMode == 1 ? SPR_TRANSLEAVES_OPAQUE : SPR_TRANSLEAVES;
|
||||
case 3 -> renderMode == 1 ? SPR_SORTLEAVES_OPAQUE : SPR_SORTLEAVES;
|
||||
default -> renderMode == 1 ? SPR_TIMELEAVES_OPAQUE : SPR_TIMELEAVES;
|
||||
case 1 -> renderMode ? SPR_TRANSLEAVES_OPAQUE : SPR_TRANSLEAVES;
|
||||
case 3 -> renderMode ? SPR_SORTLEAVES_OPAQUE : SPR_SORTLEAVES;
|
||||
default -> renderMode ? SPR_TIMELEAVES_OPAQUE : SPR_TIMELEAVES;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+2
-14
@@ -1,13 +1,10 @@
|
||||
package com.gtnewhorizons.angelica.mixins.late.notfine.leaves.witchery;
|
||||
|
||||
import com.emoniph.witchery.blocks.BlockWitchLeaves;
|
||||
import jss.notfine.core.Settings;
|
||||
import jss.notfine.core.SettingsManager;
|
||||
import jss.notfine.gui.options.named.LeavesQuality;
|
||||
import jss.notfine.util.ILeafBlock;
|
||||
import jss.notfine.util.LeafRenderUtil;
|
||||
import net.minecraft.block.BlockLeavesBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -29,16 +26,7 @@ public abstract class MixinBlockWitchLeaves extends BlockLeavesBase {
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
int maskedMeta = world.getBlockMetadata(x, y, z) & 3;
|
||||
int renderMode;
|
||||
if(Settings.MODE_LEAVES.option.getStore() == LeavesQuality.SHELLED_FAST) {
|
||||
renderMode = world.getBlock(
|
||||
x + Facing.offsetsXForSide[side],
|
||||
y + Facing.offsetsYForSide[side],
|
||||
z + Facing.offsetsZForSide[side]
|
||||
) instanceof ILeafBlock ? 1 : 0;
|
||||
} else {
|
||||
renderMode = SettingsManager.leavesOpaque ? 1 : 0;
|
||||
}
|
||||
final int renderMode = LeafRenderUtil.selectRenderMode(world, x, y, z, side) ? 1 : 0;
|
||||
maskedMeta = maskedMeta > 1 ? 0 : maskedMeta;
|
||||
return iconsForModes[renderMode][maskedMeta];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user