use of net.minecraft.block.BlockSign in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class CallRunnerClient method onDrawBlockDamageTexture.
public static void onDrawBlockDamageTexture(RenderGlobal renderGlobal, Tessellator tessellatorIn, VertexBuffer worldRendererIn, Entity entityIn, float partialTicks) {
double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double) partialTicks;
double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double) partialTicks;
double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double) partialTicks;
if (!renderGlobal.damagedBlocks.isEmpty()) {
renderGlobal.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
renderGlobal.preRenderDamagedBlocks();
worldRendererIn.begin(7, DefaultVertexFormats.BLOCK);
worldRendererIn.setTranslation(-d0, -d1, -d2);
worldRendererIn.noColor();
Iterator<DestroyBlockProgress> iterator = renderGlobal.damagedBlocks.values().iterator();
while (iterator.hasNext()) {
DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress) iterator.next();
BlockPos blockpos = destroyblockprogress.getPosition();
double d3 = (double) blockpos.getX() - d0;
double d4 = (double) blockpos.getY() - d1;
double d5 = (double) blockpos.getZ() - d2;
Block block = renderGlobal.theWorld.getBlockState(blockpos).getBlock();
TileEntity te = renderGlobal.theWorld.getTileEntity(blockpos);
boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull;
if (!hasBreak)
hasBreak = te != null && te.canRenderBreaking();
if (!hasBreak) {
PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(renderGlobal.theWorld, blockpos);
if (wrapper == null && (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D)) {
iterator.remove();
} else {
IBlockState iblockstate = renderGlobal.theWorld.getBlockState(blockpos);
if (wrapper != null) {
wrapper.wrapping.renderer.setupTranslation(partialTicks);
worldRendererIn.setTranslation(-wrapper.wrapping.renderer.offsetPos.getX(), -wrapper.wrapping.renderer.offsetPos.getY(), -wrapper.wrapping.renderer.offsetPos.getZ());
}
if (iblockstate.getMaterial() != Material.AIR) {
int i = destroyblockprogress.getPartialBlockDamage();
TextureAtlasSprite textureatlassprite = renderGlobal.destroyBlockIcons[i];
BlockRendererDispatcher blockrendererdispatcher = renderGlobal.mc.getBlockRendererDispatcher();
try {
blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, renderGlobal.theWorld);
} catch (Exception e) {
e.printStackTrace();
}
}
worldRendererIn.setTranslation(-d0, -d1, -d2);
// TODO: Reverse the Matrix Transforms here
if (wrapper != null) {
tessellatorIn.draw();
worldRendererIn.begin(7, DefaultVertexFormats.BLOCK);
wrapper.wrapping.renderer.inverseTransform(partialTicks);
}
}
}
}
tessellatorIn.draw();
worldRendererIn.setTranslation(0.0D, 0.0D, 0.0D);
renderGlobal.postRenderDamagedBlocks();
}
}
Aggregations