mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-26 14:53:05 +00:00
Fix #1440 Chisel Blocks do not render when used as Camo for Forestry Greenhouse blocks
This commit is contained in:
1 parent
e1eb4d25fb
commit
91d46d1331
7 files changed
+43
-34
No files matched your search
@@ -69,6 +69,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumFacing.Plane;
|
||||
import net.minecraft.util.EnumHand;
|
||||
@@ -359,11 +360,11 @@ public abstract class BlockGreenhouse extends BlockStructure implements ISpriteR
|
||||
/* MODELS */
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) {
|
||||
if (hasGlass()) {
|
||||
return BlockRenderLayer.TRANSLUCENT;
|
||||
return layer == BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
return layer != BlockRenderLayer.TRANSLUCENT && layer != BlockRenderLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.greenhouse.gui;
|
||||
|
||||
import forestry.api.core.CamouflageManager;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiAnalyzer;
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
import forestry.core.render.EnumTankLevel;
|
||||
import forestry.greenhouse.multiblock.IGreenhouseControllerInternal;
|
||||
|
||||
@@ -58,9 +58,9 @@ public class WidgetCamouflageTab extends Widget {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
TextureManager textureManager = minecraft.getTextureManager();
|
||||
textureManager.bindTexture(manager.gui.textureFile);
|
||||
manager.gui.drawTexturedModalRect(startX + xPos, startY + yPos, 192, 0, 48, 25);
|
||||
manager.gui.drawTexturedModalRect(startX + xPos, startY + yPos, 196, 0, 48, 25);
|
||||
if (handlerSlot != null) {
|
||||
manager.gui.drawTexturedModalRect(startX + xPos + 44, startY + yPos, 192, 25, 24, 25);
|
||||
manager.gui.drawTexturedModalRect(startX + xPos + 44, startY + yPos, 196, 25, 24, 25);
|
||||
}
|
||||
if (!typeStack.isEmpty()) {
|
||||
textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
|
||||
@@ -52,7 +52,7 @@ public class WidgetClimatePillar extends Widget {
|
||||
public void draw(int startX, int startY) {
|
||||
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
|
||||
textureManager.bindTexture(manager.gui.textureFile);
|
||||
manager.gui.drawTexturedModalRect(startX + xPos, startY + yPos, 216, 25, width, height);
|
||||
manager.gui.drawTexturedModalRect(startX + xPos, startY + yPos, 220, 25, width, height);
|
||||
for(ClimateButton button : buttons){
|
||||
button.draw(startX, startY);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.models;
|
||||
|
||||
import java.time.chrono.MinguoEra;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.core.CamouflageManager;
|
||||
@@ -29,9 +31,11 @@ import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -78,37 +82,40 @@ public class ModelGreenhouse extends ModelBlockDefault<BlockGreenhouse, ModelGre
|
||||
IBlockAccess world = key.world;
|
||||
BlockPos pos = key.pos;
|
||||
|
||||
if (!camouflageStack.isEmpty()) {
|
||||
ICamouflageHandler camouflageHandler = CamouflageUtil.getCamouflageHandler(world, pos);
|
||||
ICamouflagedTile camouflageTile = (ICamouflagedTile) TileUtil.getTile(world, pos, TileEntity.class);
|
||||
ICamouflageItemHandler itemHandler = CamouflageManager.camouflageAccess.getHandlerFromItem(camouflageStack);
|
||||
if (itemHandler != null && camouflageHandler != null && camouflageTile != null) {
|
||||
Pair<IBlockState, IBakedModel> model = itemHandler.getModel(camouflageStack, camouflageHandler, camouflageTile);
|
||||
|
||||
baker.addBakedModel(model.getLeft(), model.getRight());
|
||||
baker.setParticleSprite(model.getRight().getParticleTexture());
|
||||
BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer();
|
||||
if(layer != BlockRenderLayer.CUTOUT){
|
||||
if (!camouflageStack.isEmpty()) {
|
||||
ICamouflageHandler camouflageHandler = CamouflageUtil.getCamouflageHandler(world, pos);
|
||||
ICamouflagedTile camouflageTile = (ICamouflagedTile) TileUtil.getTile(world, pos, TileEntity.class);
|
||||
ICamouflageItemHandler itemHandler = CamouflageManager.camouflageAccess.getHandlerFromItem(camouflageStack);
|
||||
if (itemHandler != null && camouflageHandler != null && camouflageTile != null) {
|
||||
Pair<IBlockState, IBakedModel> model = itemHandler.getModel(camouflageStack, camouflageHandler, camouflageTile);
|
||||
|
||||
baker.addBakedModel(model.getLeft(), model.getRight());
|
||||
baker.setParticleSprite(model.getRight().getParticleTexture());
|
||||
}
|
||||
}
|
||||
|
||||
//Bake the default blocks
|
||||
else if (block.getGreenhouseType() == BlockGreenhouseType.GLASS) {
|
||||
TextureAtlasSprite glassSprite = BlockGreenhouseType.getSprite(BlockGreenhouseType.GLASS, null, null, world, pos);
|
||||
|
||||
baker.addBlockModel(pos, BlockGreenhouseType.getSprite(BlockGreenhouseType.GLASS, null, null, world, pos), 100);
|
||||
baker.setParticleSprite(glassSprite);
|
||||
} else {
|
||||
TextureAtlasSprite plainSprite = BlockGreenhouseType.getSprite(BlockGreenhouseType.PLAIN, null, null, world, pos);
|
||||
|
||||
baker.addBlockModel(pos, BlockGreenhouseType.getSprite(BlockGreenhouseType.PLAIN, null, null, world, pos), 100);
|
||||
baker.setParticleSprite(plainSprite);
|
||||
}
|
||||
}
|
||||
|
||||
//Bake the default blocks
|
||||
else if (block.getGreenhouseType() == BlockGreenhouseType.GLASS) {
|
||||
TextureAtlasSprite glassSprite = BlockGreenhouseType.getSprite(BlockGreenhouseType.GLASS, null, null, world, pos);
|
||||
|
||||
baker.addBlockModel(pos, BlockGreenhouseType.getSprite(BlockGreenhouseType.GLASS, null, null, world, pos), 100);
|
||||
baker.setParticleSprite(glassSprite);
|
||||
} else {
|
||||
TextureAtlasSprite plainSprite = BlockGreenhouseType.getSprite(BlockGreenhouseType.PLAIN, null, null, world, pos);
|
||||
|
||||
baker.addBlockModel(pos, BlockGreenhouseType.getSprite(BlockGreenhouseType.PLAIN, null, null, world, pos), 100);
|
||||
baker.setParticleSprite(plainSprite);
|
||||
}
|
||||
|
||||
if (block.getGreenhouseType().hasOverlaySprite) {
|
||||
TextureAtlasSprite[] sprite = new TextureAtlasSprite[6];
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
sprite[facing.ordinal()] = BlockGreenhouseType.getSprite(block.getGreenhouseType(), facing, key.state, world, pos);
|
||||
if (block.getGreenhouseType().hasOverlaySprite) {
|
||||
TextureAtlasSprite[] sprite = new TextureAtlasSprite[6];
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
sprite[facing.ordinal()] = BlockGreenhouseType.getSprite(block.getGreenhouseType(), facing, key.state, world, pos);
|
||||
}
|
||||
baker.addBlockModel(pos, sprite, 101);
|
||||
}
|
||||
baker.addBlockModel(pos, sprite, 101);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user