cleanup; remove Block##getRenderType
This commit is contained in:
parent
d56f28e6d2
commit
af68ad3f30
50 changed files with 35 additions and 120 deletions
|
@ -20,6 +20,7 @@ import common.block.liquid.BlockLiquid;
|
|||
import common.block.liquid.BlockStaticLiquid;
|
||||
import common.collect.Maps;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
|
@ -50,7 +51,7 @@ public class BlockRenderer
|
|||
public void renderBlockDamage(State state, BlockPos pos, Sprite texture, IWorldAccess blockAccess)
|
||||
{
|
||||
Block block = state.getBlock();
|
||||
if (block.getRenderType() == 3)
|
||||
if (block != Blocks.air && !block.getMaterial().isLiquid())
|
||||
{
|
||||
state = block.getState(state, blockAccess, pos);
|
||||
IBakedModel ibakedmodel = this.manager.getModelForState(state);
|
||||
|
@ -60,30 +61,17 @@ public class BlockRenderer
|
|||
}
|
||||
}
|
||||
|
||||
public boolean renderBlock(State state, BlockPos pos, IWorldAccess blockAccess, RenderBuffer worldRendererIn)
|
||||
{
|
||||
if(this.gm.xrayActive && !state.getBlock().isXrayVisible())
|
||||
return false;
|
||||
int i = state.getBlock().getRenderType();
|
||||
|
||||
if (i == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
return this.renderFluid(blockAccess, state, pos, worldRendererIn);
|
||||
case 3:
|
||||
IBakedModel ibakedmodel = this.getModelFromBlockState(state, blockAccess, pos);
|
||||
return this.renderBase(blockAccess, ibakedmodel, state, pos, worldRendererIn, !this.gm.xrayActive);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
public boolean renderBlock(State state, BlockPos pos, IWorldAccess world, RenderBuffer rb) {
|
||||
Block block = state.getBlock();
|
||||
if(this.gm.xrayActive && !block.isXrayVisible())
|
||||
return false;
|
||||
if(block == Blocks.air)
|
||||
return false;
|
||||
else if(block.getMaterial().isLiquid())
|
||||
return this.renderFluid(world, state, pos, rb);
|
||||
IBakedModel model = this.getModelFromBlockState(state, world, pos);
|
||||
return this.renderBase(world, model, state, pos, rb, !this.gm.xrayActive);
|
||||
}
|
||||
|
||||
public IBakedModel getModelFromBlockState(State state, IWorldAccess worldIn, BlockPos pos)
|
||||
{
|
||||
|
@ -113,7 +101,7 @@ public class BlockRenderer
|
|||
|
||||
public void renderBlockEntity(State state, float brightness)
|
||||
{
|
||||
if (state.getBlock().getRenderType() == 3)
|
||||
if (state.getBlock() != Blocks.air && !state.getBlock().getMaterial().isLiquid())
|
||||
{
|
||||
IBakedModel model = this.manager.getModelForState(state);
|
||||
this.renderModelBrightness(model, state, brightness, true);
|
||||
|
|
|
@ -1100,7 +1100,7 @@ public class EffectRenderer {
|
|||
State iblockstate = this.world.getState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if(block.getRenderType() != -1) {
|
||||
if(block != Blocks.air) {
|
||||
int i = pos.getX();
|
||||
int j = pos.getY();
|
||||
int k = pos.getZ();
|
||||
|
|
|
@ -17,11 +17,11 @@ import client.renderer.texture.TextureMap;
|
|||
import common.block.Block;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.item.Item;
|
||||
import common.item.ItemAction;
|
||||
import common.item.ItemStack;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.GuiPosition;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Vec3;
|
||||
|
@ -429,7 +429,7 @@ public class ItemRenderer
|
|||
}
|
||||
}
|
||||
|
||||
if (iblockstate.getBlock().getRenderType() != -1)
|
||||
if (iblockstate.getBlock() != Blocks.air)
|
||||
{
|
||||
this.renderBlockInside(partialTicks, this.gm.getBlockRendererDispatcher().getModelManager().getTexture(iblockstate));
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ import common.collect.Sets;
|
|||
import common.init.BlockRegistry;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.Item;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.GuiPosition;
|
||||
|
|
|
@ -9,9 +9,9 @@ import client.renderer.texture.Sprite;
|
|||
import client.renderer.texture.TextureMap;
|
||||
import common.block.Block;
|
||||
import common.block.liquid.BlockDynamicLiquid;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.collect.Maps;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.properties.Property;
|
||||
import common.world.State;
|
||||
|
||||
|
@ -29,9 +29,8 @@ public class ModelManager
|
|||
{
|
||||
this.texMap = textures;
|
||||
for(Block block : BlockRegistry.blocks()) {
|
||||
if(block.getRenderType() != 3) {
|
||||
if(block == Blocks.air || block.getMaterial().isLiquid()) {
|
||||
this.builtin.add(block);
|
||||
// Log.info("Builtin: " + BlockRegistry.getNameFromBlock(block));
|
||||
}
|
||||
else {
|
||||
Property<?>[] ignored = block.getIgnoredProperties();
|
||||
|
|
|
@ -23,6 +23,7 @@ import common.block.Block;
|
|||
import common.block.ITileEntityProvider;
|
||||
import common.collect.Maps;
|
||||
import common.collect.Sets;
|
||||
import common.init.Blocks;
|
||||
import common.model.BlockLayer;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
|
@ -172,7 +173,7 @@ public class RenderChunk
|
|||
BlockLayer enumworldblocklayer1 = block.getRenderLayer();
|
||||
int j = enumworldblocklayer1.ordinal();
|
||||
|
||||
if (block.getRenderType() != -1)
|
||||
if (block != Blocks.air)
|
||||
{
|
||||
RenderBuffer worldrenderer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayerId(j);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import client.renderer.blockmodel.IBakedModel;
|
|||
import client.renderer.texture.TextureMap;
|
||||
import common.block.Block;
|
||||
import common.entity.item.EntityFalling;
|
||||
import common.init.Blocks;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
@ -37,7 +38,7 @@ public class RenderFallingBlock extends Render<EntityFalling>
|
|||
BlockPos blockpos = new BlockPos(entity);
|
||||
World world = entity.getWorldObj();
|
||||
|
||||
if (iblockstate != world.getState(blockpos) && block.getRenderType() == 3)
|
||||
if (iblockstate != world.getState(blockpos) && block != Blocks.air && !block.getMaterial().isLiquid())
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)x, (float)y, (float)z);
|
||||
|
|
|
@ -7,7 +7,6 @@ import client.renderer.texture.TextureMap;
|
|||
import common.entity.Entity;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.GuiPosition;
|
||||
|
||||
|
||||
public class RenderItemEntity<T extends Entity> extends Render<T>
|
||||
|
|
|
@ -8,6 +8,7 @@ import client.renderer.model.ModelBase;
|
|||
import client.renderer.model.ModelMinecart;
|
||||
import client.renderer.texture.TextureMap;
|
||||
import common.entity.item.EntityCart;
|
||||
import common.init.Blocks;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Vec3;
|
||||
import common.world.State;
|
||||
|
@ -93,7 +94,7 @@ public class RenderMinecart<T extends EntityCart> extends Render<T>
|
|||
int j = entity.getDisplayTileOffset();
|
||||
State iblockstate = entity.getDisplayTile();
|
||||
|
||||
if (iblockstate.getBlock().getRenderType() == 3)
|
||||
if (iblockstate.getBlock() != Blocks.air && !iblockstate.getBlock().getMaterial().isLiquid())
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
this.bindTexture(TextureMap.BLOCKS);
|
||||
|
|
|
@ -10,7 +10,6 @@ import common.entity.types.EntityLiving;
|
|||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.GuiPosition;
|
||||
|
||||
public class LayerHeldItem implements LayerRenderer<EntityLiving>
|
||||
{
|
||||
|
|
|
@ -4,8 +4,8 @@ import org.lwjgl.opengl.GL11;
|
|||
|
||||
import client.renderer.Drawing;
|
||||
import client.renderer.GlState;
|
||||
import common.block.tile.BlockStandingSign;
|
||||
import common.block.tile.BlockWallSign;
|
||||
import common.block.tech.BlockStandingSign;
|
||||
import common.block.tech.BlockWallSign;
|
||||
import common.tileentity.TileEntitySign;
|
||||
import common.world.State;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue