本文整理汇总了Java中net.minecraft.block.Block.getRenderType方法的典型用法代码示例。如果您正苦于以下问题:Java Block.getRenderType方法的具体用法?Java Block.getRenderType怎么用?Java Block.getRenderType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.Block
的用法示例。
在下文中一共展示了Block.getRenderType方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRunningParticles
import net.minecraft.block.Block; //导入方法依赖的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);
Block block = iblockstate.getBlock();
if (block.getRenderType() != -1)
{
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)});
}
}
示例2: doRender
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doe
*/
public void doRender(EntityFallingBlock entity, double x, double y, double z, float entityYaw, float partialTicks)
{
if (entity.getBlock() != null)
{
this.bindTexture(TextureMap.locationBlocksTexture);
IBlockState iblockstate = entity.getBlock();
Block block = iblockstate.getBlock();
BlockPos blockpos = new BlockPos(entity);
World world = entity.getWorldObj();
if (iblockstate != world.getBlockState(blockpos) && block.getRenderType() != -1)
{
if (block.getRenderType() == 3)
{
GlStateManager.pushMatrix();
GlStateManager.translate((float)x, (float)y, (float)z);
GlStateManager.disableLighting();
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.BLOCK);
int i = blockpos.getX();
int j = blockpos.getY();
int k = blockpos.getZ();
worldrenderer.setTranslation((double)((float)(-i) - 0.5F), (double)(-j), (double)((float)(-k) - 0.5F));
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
IBakedModel ibakedmodel = blockrendererdispatcher.getModelFromBlockState(iblockstate, world, (BlockPos)null);
blockrendererdispatcher.getBlockModelRenderer().renderModel(world, ibakedmodel, iblockstate, blockpos, worldrenderer, false);
worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
tessellator.draw();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
}
}
}
示例3: renderBlockDamage
import net.minecraft.block.Block; //导入方法依赖的package包/类
public void renderBlockDamage(IBlockState state, BlockPos pos, TextureAtlasSprite texture, IBlockAccess blockAccess)
{
Block block = state.getBlock();
int i = block.getRenderType();
if (i == 3)
{
state = block.getActualState(state, blockAccess, pos);
IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(state);
IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, texture)).makeBakedModel();
this.blockModelRenderer.renderModel(blockAccess, ibakedmodel1, state, pos, Tessellator.getInstance().getWorldRenderer());
}
}
示例4: isRenderTypeChest
import net.minecraft.block.Block; //导入方法依赖的package包/类
public boolean isRenderTypeChest(Block p_175021_1_, int p_175021_2_)
{
if (p_175021_1_ == null)
{
return false;
}
else
{
int i = p_175021_1_.getRenderType();
return i == 3 ? false : i == 2;
}
}
示例5: pushEntity
import net.minecraft.block.Block; //导入方法依赖的package包/类
public static void pushEntity(IBlockState blockState, BlockPos blockPos, IBlockAccess blockAccess, WorldRenderer wrr)
{
Block block = blockState.getBlock();
int i = Block.getIdFromBlock(block);
int j = block.getRenderType();
int k = block.getMetaFromState(blockState);
int l = ((j & 65535) << 16) + (i & 65535);
int i1 = k & 65535;
wrr.sVertexBuilder.pushEntity(((long)i1 << 32) + (long)l);
}
示例6: onItemUse
import net.minecraft.block.Block; //导入方法依赖的package包/类
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
if (world.isRemote)
return true;
else {
Block block = world.getBlock(x, y, z);
x += Facing.offsetsXForSide[side];
y += Facing.offsetsYForSide[side];
z += Facing.offsetsZForSide[side];
double d0 = 0.0D;
if (side == 1 && block.getRenderType() == 11)
d0 = 0.5D;
Entity entity = spawnEntity(world, stack.getItemDamage(), x + 0.5D, y + d0, z + 0.5D);
if (entity != null) {
if (entity instanceof EntityLivingBase && stack.hasDisplayName())
((EntityLiving) entity).setCustomNameTag(stack.getDisplayName());
if (!player.capabilities.isCreativeMode)
stack.stackSize--;
}
return true;
}
}
示例7: renderBlockDamage
import net.minecraft.block.Block; //导入方法依赖的package包/类
public void renderBlockDamage(IBlockState state, BlockPos pos, TextureAtlasSprite texture, IBlockAccess blockAccess)
{
Block block = state.getBlock();
int i = block.getRenderType();
if (i == 3)
{
state = block.getActualState(state, blockAccess, pos);
IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(state);
if (Reflector.ISmartBlockModel.isInstance(ibakedmodel))
{
IBlockState iblockstate = (IBlockState)Reflector.call(block, Reflector.ForgeBlock_getExtendedState, new Object[] {state, blockAccess, pos});
for (EnumWorldBlockLayer enumworldblocklayer : EnumWorldBlockLayer.values())
{
if (Reflector.callBoolean(block, Reflector.ForgeBlock_canRenderInLayer, new Object[] {enumworldblocklayer}))
{
Reflector.callVoid(Reflector.ForgeHooksClient_setRenderLayer, new Object[] {enumworldblocklayer});
IBakedModel ibakedmodel2 = (IBakedModel)Reflector.call(ibakedmodel, Reflector.ISmartBlockModel_handleBlockState, new Object[] {iblockstate});
IBakedModel ibakedmodel3 = (new SimpleBakedModel.Builder(ibakedmodel2, texture)).makeBakedModel();
this.blockModelRenderer.renderModel(blockAccess, ibakedmodel3, state, pos, Tessellator.getInstance().getWorldRenderer());
}
}
return;
}
IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, texture)).makeBakedModel();
this.blockModelRenderer.renderModel(blockAccess, ibakedmodel1, state, pos, Tessellator.getInstance().getWorldRenderer());
}
}
示例8: addBlockHitEffects
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* Adds block hit particles for the specified block
*/
public void addBlockHitEffects(BlockPos pos, EnumFacing side)
{
IBlockState iblockstate = this.worldObj.getBlockState(pos);
Block block = iblockstate.getBlock();
if (block.getRenderType() != -1)
{
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
float f = 0.1F;
double d0 = (double)i + this.rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (double)(f * 2.0F)) + (double)f + block.getBlockBoundsMinX();
double d1 = (double)j + this.rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (double)(f * 2.0F)) + (double)f + block.getBlockBoundsMinY();
double d2 = (double)k + this.rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (double)(f * 2.0F)) + (double)f + block.getBlockBoundsMinZ();
if (side == EnumFacing.DOWN)
{
d1 = (double)j + block.getBlockBoundsMinY() - (double)f;
}
if (side == EnumFacing.UP)
{
d1 = (double)j + block.getBlockBoundsMaxY() + (double)f;
}
if (side == EnumFacing.NORTH)
{
d2 = (double)k + block.getBlockBoundsMinZ() - (double)f;
}
if (side == EnumFacing.SOUTH)
{
d2 = (double)k + block.getBlockBoundsMaxZ() + (double)f;
}
if (side == EnumFacing.WEST)
{
d0 = (double)i + block.getBlockBoundsMinX() - (double)f;
}
if (side == EnumFacing.EAST)
{
d0 = (double)i + block.getBlockBoundsMaxX() + (double)f;
}
this.addEffect((new EntityDiggingFX(this.worldObj, d0, d1, d2, 0.0D, 0.0D, 0.0D, iblockstate)).func_174846_a(pos).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
}
}
示例9: renderShadow
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* Renders the entity shadows at the position, shadow alpha and partialTickTime. Args: entity, x, y, z, shadowAlpha,
* partialTickTime
*/
private void renderShadow(Entity entityIn, double x, double y, double z, float shadowAlpha, float partialTicks)
{
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 771);
this.renderManager.renderEngine.bindTexture(shadowTextures);
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_double(d5 - (double)f);
int j = MathHelper.floor_double(d5 + (double)f);
int k = MathHelper.floor_double(d0 - (double)f);
int l = MathHelper.floor_double(d0);
int i1 = MathHelper.floor_double(d1 - (double)f);
int j1 = MathHelper.floor_double(d1 + (double)f);
double d2 = x - d5;
double d3 = y - d0;
double d4 = z - d1;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
for (BlockPos blockpos : BlockPos.getAllInBoxMutable(new BlockPos(i, k, i1), new BlockPos(j, l, j1)))
{
Block block = world.getBlockState(blockpos.down()).getBlock();
if (block.getRenderType() != -1 && world.getLightFromNeighbors(blockpos) > 3)
{
this.func_180549_a(block, 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);
}
示例10: pushEntity
import net.minecraft.block.Block; //导入方法依赖的package包/类
public static void pushEntity(Block block)
{
++entityDataIndex;
entityData[entityDataIndex * 2] = Block.blockRegistry.getIDForObject(block) & 65535 | block.getRenderType() << 16;
entityData[entityDataIndex * 2 + 1] = 0;
}
示例11: renderShadow
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* Renders the entity shadows at the position, shadow alpha and partialTickTime.
* Args: entity, x, y, z, shadowAlpha, partialTickTime
*/
private void renderShadow(Entity entityIn, double x, double y, double z, float shadowAlpha, float partialTicks) {
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 771);
this.renderManager.renderEngine.bindTexture(shadowTextures);
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_double(d5 - (double) f);
int j = MathHelper.floor_double(d5 + (double) f);
int k = MathHelper.floor_double(d0 - (double) f);
int l = MathHelper.floor_double(d0);
int i1 = MathHelper.floor_double(d1 - (double) f);
int j1 = MathHelper.floor_double(d1 + (double) f);
double d2 = x - d5;
double d3 = y - d0;
double d4 = z - d1;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
for (BlockPos blockpos : BlockPos.getAllInBoxMutable(new BlockPos(i, k, i1), new BlockPos(j, l, j1))) {
Block block = world.getBlockState(blockpos.down()).getBlock();
if (block.getRenderType() != -1 && world.getLightFromNeighbors(blockpos) > 3) {
this.func_180549_a(block, 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);
}