use of net.minecraftforge.fluids.FluidStack in project RFToolsDimensions by McJty.
the class LiquidAbsorberBlock method getWailaBody.
@SideOnly(Side.CLIENT)
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
super.getWailaBody(itemStack, currenttip, accessor, config);
LiquidAbsorberTileEntity tileEntity = (LiquidAbsorberTileEntity) accessor.getTileEntity();
if (tileEntity != null && tileEntity.getBlock() != null) {
Block block = tileEntity.getBlock();
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
if (fluid != null) {
int absorbing = tileEntity.getAbsorbing();
int pct = ((DimletConstructionConfiguration.maxLiquidAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxLiquidAbsorbtion;
currenttip.add(TextFormatting.GREEN + "Liquid: " + new FluidStack(fluid, 1).getLocalizedName() + " (" + pct + "%)");
}
}
return currenttip;
}
use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.
the class EntityRenderChemthrowerShot method doRender.
@Override
public void doRender(Entity entity, double x, double y, double z, float f0, float f1) {
FluidStack f = ((EntityChemthrowerShot) entity).getFluid();
if (f == null) {
f = ((EntityChemthrowerShot) entity).getFluidSynced();
if (f == null)
return;
}
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
GlStateManager.enableRescaleNormal();
Tessellator tessellator = ClientUtils.tes();
GlStateManager.disableCull();
GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
TextureAtlasSprite sprite = ClientUtils.mc().getTextureMapBlocks().getAtlasSprite(f.getFluid().getStill(f).toString());
if (sprite != null) {
int colour = f.getFluid().getColor(f);
float a = (colour >> 24 & 255) / 255f;
float r = (colour >> 16 & 255) / 255f;
float g = (colour >> 8 & 255) / 255f;
float b = (colour & 255) / 255f;
ClientUtils.bindAtlas();
GlStateManager.scale(.25f, .25f, .25f);
VertexBuffer worldrenderer = ClientUtils.tes().getBuffer();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
worldrenderer.pos(-.25, -.25, 0).tex(sprite.getInterpolatedU(4), sprite.getInterpolatedV(4)).color(r, g, b, a).endVertex();
worldrenderer.pos(.25, -.25, 0).tex(sprite.getInterpolatedU(0), sprite.getInterpolatedV(4)).color(r, g, b, a).endVertex();
worldrenderer.pos(.25, .25, 0).tex(sprite.getInterpolatedU(0), sprite.getInterpolatedV(0)).color(r, g, b, a).endVertex();
worldrenderer.pos(-.25, .25, 0).tex(sprite.getInterpolatedU(4), sprite.getInterpolatedV(0)).color(r, g, b, a).endVertex();
tessellator.draw();
}
GlStateManager.enableCull();
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
}
use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.
the class EntityChemthrowerShot method getGravity.
@Override
public double getGravity() {
if (getFluid() != null) {
FluidStack fluidStack = getFluid();
boolean isGas = fluidStack.getFluid().isGaseous(fluidStack) || ChemthrowerHandler.isGas(fluidStack.getFluid());
return (isGas ? .025f : .05F) * (fluidStack.getFluid().getDensity(fluidStack) < 0 ? -1 : 1);
}
return super.getGravity();
}
use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.
the class EntityChemthrowerShot method onImpact.
@Override
public void onImpact(RayTraceResult mop) {
if (!this.worldObj.isRemote && getFluid() != null) {
FluidStack fluidStack = getFluid();
Fluid fluid = fluidStack.getFluid();
ChemthrowerEffect effect = ChemthrowerHandler.getEffect(fluid);
boolean fire = fluid.getTemperature(fluidStack) > 1000;
if (effect != null) {
ItemStack thrower = null;
EntityPlayer shooter = (EntityPlayer) this.getShooter();
if (shooter != null)
thrower = shooter.getHeldItem(EnumHand.MAIN_HAND);
if (mop.typeOfHit == Type.ENTITY)
effect.applyToEntity((EntityLivingBase) mop.entityHit, shooter, thrower, fluidStack);
else if (mop.typeOfHit == Type.BLOCK)
effect.applyToBlock(worldObj, mop, shooter, thrower, fluidStack);
} else if (mop.entityHit != null && fluid.getTemperature(fluidStack) > 500) {
int tempDiff = fluid.getTemperature(fluidStack) - 300;
int damage = Math.abs(tempDiff) / 500;
if (mop.entityHit.attackEntityFrom(DamageSource.lava, damage))
mop.entityHit.hurtResistantTime = (int) (mop.entityHit.hurtResistantTime * .75);
}
if (mop.entityHit != null) {
int f = this.isBurning() ? this.fire : fire ? 3 : 0;
if (f > 0) {
mop.entityHit.setFire(f);
if (mop.entityHit.attackEntityFrom(DamageSource.inFire, 2))
mop.entityHit.hurtResistantTime = (int) (mop.entityHit.hurtResistantTime * .75);
}
}
}
}
use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.
the class TileEntityWoodenBarrel method interact.
@Override
public boolean interact(EnumFacing side, EntityPlayer player, EnumHand hand, ItemStack heldItem, float hitX, float hitY, float hitZ) {
FluidStack f = FluidUtil.getFluidContained(heldItem);
boolean metal = this instanceof TileEntityMetalBarrel;
if (f != null)
if (!metal && f.getFluid().isGaseous(f)) {
ChatUtils.sendServerNoSpamMessages(player, new TextComponentTranslation(Lib.CHAT_INFO + "noGasAllowed"));
return true;
} else if (!metal && f.getFluid().getTemperature(f) >= TileEntityWoodenBarrel.IGNITION_TEMPERATURE) {
ChatUtils.sendServerNoSpamMessages(player, new TextComponentTranslation(Lib.CHAT_INFO + "tooHot"));
return true;
}
if (FluidUtil.interactWithFluidHandler(heldItem, tank, player)) {
this.markDirty();
this.markContainingBlockForUpdate(null);
return true;
}
// }
return false;
}
Aggregations