Skip to content

Commit

Permalink
Re-fixed the broken leaves rendering settings.
Browse files Browse the repository at this point in the history
(I forgot the field isn't static, so vanilla only updates it's own leaves)
  • Loading branch information
dries007 committed Aug 17, 2018
1 parent ebc6b99 commit b86306e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
Expand Up @@ -15,15 +15,19 @@
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import net.dries007.tfc.api.types.Tree;
import net.dries007.tfc.util.OreDictionaryHelper;
Expand Down Expand Up @@ -174,4 +178,30 @@ private void doLeafDecay(World world, BlockPos pos, IBlockState state)

world.setBlockToAir(pos);
}

@SideOnly(Side.CLIENT)
@Override
public BlockRenderLayer getRenderLayer()
{
/*
* This is a way to make sure the leave settings are updated.
* The result of this call is cached somewhere, so it's not that important, but:
* The alternative would be to use `Minecraft.getMinecraft().gameSettings.fancyGraphics` directly in the 2 relevant methods.
* It's better to do that than to refer to Blocks.LEAVES, for performance reasons.
*/
leavesFancy = Minecraft.getMinecraft().gameSettings.fancyGraphics;
return super.getRenderLayer();
}

@SuppressWarnings("deprecation")
@SideOnly(Side.CLIENT)
@Override
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
/*
* See comment on getRenderLayer()
*/
leavesFancy = Minecraft.getMinecraft().gameSettings.fancyGraphics;
return super.shouldSideBeRendered(blockState, blockAccess, pos, side);
}
}
1 change: 0 additions & 1 deletion src/main/java/net/dries007/tfc/types/DefaultOres.java
Expand Up @@ -19,7 +19,6 @@
@Mod.EventBusSubscriber(modid = MOD_ID)
public class DefaultOres
{

private static final ResourceLocation NATIVE_COPPER = new ResourceLocation(MOD_ID, "native_copper");
private static final ResourceLocation NATIVE_GOLD = new ResourceLocation(MOD_ID, "native_gold");
private static final ResourceLocation NATIVE_PLATINUM = new ResourceLocation(MOD_ID, "native_platinum");
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/net/dries007/tfc/util/CapabilityItemSize.java
@@ -1,7 +1,6 @@
/*
* Work under Copyright. Licensed under the EUPL.
* See the project README.md and LICENSE.txt for more information.
*
*/

package net.dries007.tfc.util;
Expand Down Expand Up @@ -52,7 +51,6 @@ public void readNBT(Capability<IItemSize> capability, IItemSize instance, EnumFa

}
}, () -> INSTANCE.getCapability(Size.SMALL, Weight.MEDIUM, true));

}

/**
Expand Down

0 comments on commit b86306e

Please sign in to comment.