本文整理匯總了Java中net.minecraft.block.state.IBlockState.getRenderType方法的典型用法代碼示例。如果您正苦於以下問題:Java IBlockState.getRenderType方法的具體用法?Java IBlockState.getRenderType怎麽用?Java IBlockState.getRenderType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.block.state.IBlockState
的用法示例。
在下文中一共展示了IBlockState.getRenderType方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createParticle
import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
@Nullable
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
IBlockState iblockstate = Block.getStateById(p_178902_15_[0]);
if (iblockstate.getBlock() != Blocks.AIR && iblockstate.getRenderType() == EnumBlockRenderType.INVISIBLE)
{
return null;
}
else
{
int i = Minecraft.getMinecraft().getBlockColors().getColor(iblockstate);
if (iblockstate.getBlock() instanceof BlockFalling)
{
i = ((BlockFalling)iblockstate.getBlock()).getDustColor(iblockstate);
}
float f = (float)(i >> 16 & 255) / 255.0F;
float f1 = (float)(i >> 8 & 255) / 255.0F;
float f2 = (float)(i & 255) / 255.0F;
return new ParticleFallingDust(worldIn, xCoordIn, yCoordIn, zCoordIn, f, f1, f2);
}
}
示例2: renderBlockBrightness
import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
@SuppressWarnings("incomplete-switch")
public void renderBlockBrightness(IBlockState state, float brightness)
{
EnumBlockRenderType enumblockrendertype = state.getRenderType();
if (enumblockrendertype != EnumBlockRenderType.INVISIBLE)
{
switch (enumblockrendertype)
{
case MODEL:
IBakedModel ibakedmodel = this.getModelForState(state);
this.blockModelRenderer.renderModelBrightness(ibakedmodel, state, brightness, true);
break;
case ENTITYBLOCK_ANIMATED:
this.chestRenderer.renderChestBrightness(state.getBlock(), brightness);
case LIQUID:
}
}
}
示例3: createParticle
import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
IBlockState iblockstate = Block.getStateById(p_178902_15_[0]);
if (iblockstate.getBlock() != Blocks.AIR && iblockstate.getRenderType() == EnumBlockRenderType.INVISIBLE)
{
return null;
}
else
{
int i = Minecraft.getMinecraft().getBlockColors().getColor(iblockstate);
if (iblockstate.getBlock() instanceof BlockFalling)
{
i = ((BlockFalling)iblockstate.getBlock()).getDustColor(iblockstate);
}
float f = (float)(i >> 16 & 255) / 255.0F;
float f1 = (float)(i >> 8 & 255) / 255.0F;
float f2 = (float)(i & 255) / 255.0F;
return new ParticleFallingDust(worldIn, xCoordIn, yCoordIn, zCoordIn, f, f1, f2);
}
}
示例4: renderBlockBrightness
import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
@SuppressWarnings("incomplete-switch")
public void renderBlockBrightness(IBlockState state, float brightness)
{
EnumBlockRenderType enumblockrendertype = state.getRenderType();
if (enumblockrendertype != EnumBlockRenderType.INVISIBLE)
{
switch (enumblockrendertype)
{
case MODEL:
IBakedModel ibakedmodel = this.getModelForState(state);
this.blockModelRenderer.renderModelBrightness(ibakedmodel, state, brightness, true);
break;
case ENTITYBLOCK_ANIMATED:
this.chestRenderer.renderChestBrightness(state.getBlock(), brightness);
case LIQUID:
}
}
}
示例5: createRunningParticles
import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
protected void createRunningParticles()
{
int i = MathHelper.floor(this.posX);
int j = MathHelper.floor(this.posY - 0.20000000298023224D);
int k = MathHelper.floor(this.posZ);
BlockPos blockpos = new BlockPos(i, j, k);
IBlockState iblockstate = this.world.getBlockState(blockpos);
if (iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE)
{
this.world.spawnParticle(EnumParticleTypes.BLOCK_CRACK, this.posX + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, this.getEntityBoundingBox().minY + 0.1D, this.posZ + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, -this.motionX * 4.0D, 1.5D, -this.motionZ * 4.0D, new int[] {Block.getStateId(iblockstate)});
}
}
示例6: renderBlockDamage
import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
public void renderBlockDamage(IBlockState state, BlockPos pos, TextureAtlasSprite texture, IBlockAccess blockAccess)
{
if (state.getRenderType() == EnumBlockRenderType.MODEL)
{
state = state.getActualState(blockAccess, pos);
IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(state);
IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(state, ibakedmodel, texture, pos)).makeBakedModel();
this.blockModelRenderer.renderModel(blockAccess, ibakedmodel1, state, pos, Tessellator.getInstance().getBuffer(), true);
}
}
示例7: createRunningParticles
import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
protected void createRunningParticles()
{
int i = MathHelper.floor_double(this.posX);
int j = MathHelper.floor_double(this.posY - 0.20000000298023224D);
int k = MathHelper.floor_double(this.posZ);
BlockPos blockpos = new BlockPos(i, j, k);
IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
if (iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE)
{
this.worldObj.spawnParticle(EnumParticleTypes.BLOCK_CRACK, this.posX + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, this.getEntityBoundingBox().minY + 0.1D, this.posZ + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, -this.motionX * 4.0D, 1.5D, -this.motionZ * 4.0D, new int[] {Block.getStateId(iblockstate)});
}
}
示例8: renderBlockDamage
import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
public void renderBlockDamage(IBlockState state, BlockPos pos, TextureAtlasSprite texture, IBlockAccess blockAccess)
{
if (state.getRenderType() == EnumBlockRenderType.MODEL)
{
state = state.getActualState(blockAccess, pos);
IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(state);
IBakedModel ibakedmodel1 = net.minecraftforge.client.ForgeHooksClient.getDamageModel(ibakedmodel, texture, state, blockAccess, pos);
this.blockModelRenderer.renderModel(blockAccess, ibakedmodel1, state, pos, Tessellator.getInstance().getBuffer(), true);
}
}
示例9: createParticle
import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
@Nullable
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
IBlockState iblockstate = Block.getStateById(p_178902_15_[0]);
return iblockstate.getRenderType() == EnumBlockRenderType.INVISIBLE ? null : (new ParticleBlockDust(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, iblockstate)).init();
}
示例10: addBlockHitEffects
import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
/**
* Adds block hit particles for the specified block
*/
public void addBlockHitEffects(BlockPos pos, EnumFacing side)
{
IBlockState iblockstate = this.worldObj.getBlockState(pos);
if (iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE)
{
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
float f = 0.1F;
AxisAlignedBB axisalignedbb = iblockstate.getBoundingBox(this.worldObj, pos);
double d0 = (double)i + this.rand.nextDouble() * (axisalignedbb.maxX - axisalignedbb.minX - 0.20000000298023224D) + 0.10000000149011612D + axisalignedbb.minX;
double d1 = (double)j + this.rand.nextDouble() * (axisalignedbb.maxY - axisalignedbb.minY - 0.20000000298023224D) + 0.10000000149011612D + axisalignedbb.minY;
double d2 = (double)k + this.rand.nextDouble() * (axisalignedbb.maxZ - axisalignedbb.minZ - 0.20000000298023224D) + 0.10000000149011612D + axisalignedbb.minZ;
if (side == EnumFacing.DOWN)
{
d1 = (double)j + axisalignedbb.minY - 0.10000000149011612D;
}
if (side == EnumFacing.UP)
{
d1 = (double)j + axisalignedbb.maxY + 0.10000000149011612D;
}
if (side == EnumFacing.NORTH)
{
d2 = (double)k + axisalignedbb.minZ - 0.10000000149011612D;
}
if (side == EnumFacing.SOUTH)
{
d2 = (double)k + axisalignedbb.maxZ + 0.10000000149011612D;
}
if (side == EnumFacing.WEST)
{
d0 = (double)i + axisalignedbb.minX - 0.10000000149011612D;
}
if (side == EnumFacing.EAST)
{
d0 = (double)i + axisalignedbb.maxX + 0.10000000149011612D;
}
this.addEffect((new ParticleDigging(this.worldObj, d0, d1, d2, 0.0D, 0.0D, 0.0D, iblockstate)).setBlockPos(pos).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
}
}
示例11: renderShadow
import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
/**
* Renders the entities shadow.
*/
private void renderShadow(Entity entityIn, double x, double y, double z, float shadowAlpha, float partialTicks)
{
if (!Config.isShaders() || !Shaders.shouldSkipDefaultShadow)
{
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
this.renderManager.renderEngine.bindTexture(SHADOW_TEXTURES);
World world = this.getWorldFromRenderManager();
GlStateManager.depthMask(false);
float f = this.shadowSize;
if (entityIn instanceof EntityLiving)
{
EntityLiving entityliving = (EntityLiving)entityIn;
f *= entityliving.getRenderSizeModifier();
if (entityliving.isChild())
{
f *= 0.5F;
}
}
double d5 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
double d0 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
double d1 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;
int i = MathHelper.floor(d5 - (double)f);
int j = MathHelper.floor(d5 + (double)f);
int k = MathHelper.floor(d0 - (double)f);
int l = MathHelper.floor(d0);
int i1 = MathHelper.floor(d1 - (double)f);
int j1 = MathHelper.floor(d1 + (double)f);
double d2 = x - d5;
double d3 = y - d0;
double d4 = z - d1;
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
for (BlockPos blockpos : BlockPos.getAllInBoxMutable(new BlockPos(i, k, i1), new BlockPos(j, l, j1)))
{
IBlockState iblockstate = world.getBlockState(blockpos.down());
if (iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE && world.getLightFromNeighbors(blockpos) > 3)
{
this.renderShadowSingle(iblockstate, x, y, z, blockpos, shadowAlpha, f, d2, d3, d4);
}
}
tessellator.draw();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
}
}
示例12: doRender
import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
/**
* Renders the desired {@code T} type Entity.
*/
public void doRender(EntityFallingBlock entity, double x, double y, double z, float entityYaw, float partialTicks)
{
if (entity.getBlock() != null)
{
IBlockState iblockstate = entity.getBlock();
if (iblockstate.getRenderType() == EnumBlockRenderType.MODEL)
{
World world = entity.getWorldObj();
if (iblockstate != world.getBlockState(new BlockPos(entity)) && iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE)
{
this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
if (this.renderOutlines)
{
GlStateManager.enableColorMaterial();
GlStateManager.enableOutlineMode(this.getTeamColor(entity));
}
vertexbuffer.begin(7, DefaultVertexFormats.BLOCK);
BlockPos blockpos = new BlockPos(entity.posX, entity.getEntityBoundingBox().maxY, entity.posZ);
GlStateManager.translate((float)(x - (double)blockpos.getX() - 0.5D), (float)(y - (double)blockpos.getY()), (float)(z - (double)blockpos.getZ() - 0.5D));
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
blockrendererdispatcher.getBlockModelRenderer().renderModel(world, blockrendererdispatcher.getModelForState(iblockstate), iblockstate, blockpos, vertexbuffer, false, MathHelper.getPositionRandom(entity.getOrigin()));
tessellator.draw();
if (this.renderOutlines)
{
GlStateManager.disableOutlineMode();
GlStateManager.disableColorMaterial();
}
GlStateManager.enableLighting();
GlStateManager.popMatrix();
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
}
}
}
示例13: renderOverlays
import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
/**
* Renders the overlays.
*/
public void renderOverlays(float partialTicks)
{
GlStateManager.disableAlpha();
if (this.mc.player.isEntityInsideOpaqueBlock())
{
IBlockState iblockstate = this.mc.world.getBlockState(new BlockPos(this.mc.player));
BlockPos blockpos = new BlockPos(this.mc.player);
EntityPlayer entityplayer = this.mc.player;
for (int i = 0; i < 8; ++i)
{
double d0 = entityplayer.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * entityplayer.width * 0.8F);
double d1 = entityplayer.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F);
double d2 = entityplayer.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * entityplayer.width * 0.8F);
BlockPos blockpos1 = new BlockPos(d0, d1 + (double)entityplayer.getEyeHeight(), d2);
IBlockState iblockstate1 = this.mc.world.getBlockState(blockpos1);
if (iblockstate1.func_191058_s())
{
iblockstate = iblockstate1;
blockpos = blockpos1;
}
}
if (iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE)
{
Object object = Reflector.getFieldValue(Reflector.RenderBlockOverlayEvent_OverlayType_BLOCK);
if (!Reflector.callBoolean(Reflector.ForgeEventFactory_renderBlockOverlay, new Object[] {this.mc.player, Float.valueOf(partialTicks), object, iblockstate, blockpos}))
{
this.renderBlockInHand(partialTicks, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate));
}
}
}
if (!this.mc.player.isSpectator())
{
if (this.mc.player.isInsideOfMaterial(Material.WATER) && !Reflector.callBoolean(Reflector.ForgeEventFactory_renderWaterOverlay, new Object[] {this.mc.player, Float.valueOf(partialTicks)}))
{
this.renderWaterOverlayTexture(partialTicks);
}
if (this.mc.player.isBurning() && !Reflector.callBoolean(Reflector.ForgeEventFactory_renderFireOverlay, new Object[] {this.mc.player, Float.valueOf(partialTicks)}))
{
this.renderFireInFirstPerson(partialTicks);
}
}
GlStateManager.enableAlpha();
}
示例14: renderBlock
import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
public boolean renderBlock(IBlockState state, BlockPos pos, IBlockAccess blockAccess, VertexBuffer worldRendererIn)
{
try
{
EnumBlockRenderType enumblockrendertype = state.getRenderType();
if (enumblockrendertype == EnumBlockRenderType.INVISIBLE)
{
return false;
}
else
{
if (blockAccess.getWorldType() != WorldType.DEBUG_WORLD)
{
try
{
state = state.getActualState(blockAccess, pos);
}
catch (Exception var8)
{
;
}
}
switch (enumblockrendertype)
{
case MODEL:
return this.blockModelRenderer.renderModel(blockAccess, this.getModelForState(state), state, pos, worldRendererIn, true);
case ENTITYBLOCK_ANIMATED:
return false;
case LIQUID:
return this.fluidRenderer.renderFluid(blockAccess, state, pos, worldRendererIn);
default:
return false;
}
}
}
catch (Throwable throwable)
{
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block in world");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being tesselated");
CrashReportCategory.addBlockInfo(crashreportcategory, pos, state.getBlock(), state.getBlock().getMetaFromState(state));
throw new ReportedException(crashreport);
}
}
示例15: createParticle
import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
IBlockState iblockstate = Block.getStateById(p_178902_15_[0]);
return iblockstate.getRenderType() == EnumBlockRenderType.INVISIBLE ? null : (new ParticleBlockDust(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, iblockstate)).init();
}