use of com.Da_Technomancer.crossroads.tileentities.RatiatorTileEntity in project Crossroads by Crossroads-Development.
the class QuartzGoggleEffect method armorTick.
@Override
public void armorTick(World world, EntityPlayer player, ArrayList<String> chat, RayTraceResult ray) {
if (ray == null) {
return;
}
TileEntity te = world.getTileEntity(ray.getBlockPos());
if (te instanceof BeamRenderTEBase) {
MagicUnit[] mag = ((BeamRenderTEBase) te).getLastFullSent();
if (mag != null) {
NBTTagCompound nbt = MiscOp.getPlayerTag(player);
if (!nbt.hasKey("elements")) {
nbt.setTag("elements", new NBTTagCompound());
}
nbt = nbt.getCompoundTag("elements");
for (int i = 0; i < mag.length; i++) {
MagicUnit check = mag[i];
if (check != null) {
if (!nbt.hasKey(MagicElements.getElement(check).name())) {
nbt.setBoolean(MagicElements.getElement(check).name(), true);
// Doesn't use deletion-chat as the element discovery notification shouldn't be wiped away in 1 tick.
player.sendMessage(new TextComponentString(TextFormatting.BOLD.toString() + "New Element Discovered: " + MagicElements.getElement(check).toString() + TextFormatting.RESET.toString()));
}
chat.add(EnumFacing.getFront(i).toString() + ": " + check.toString());
}
}
}
}
if (te instanceof IGoggleInfoTE) {
((IGoggleInfoTE) te).addInfo(chat, GoggleLenses.QUARTZ, player, ray.sideHit);
}
if (te instanceof RatiatorTileEntity) {
chat.add("Output Signal: " + ((RatiatorTileEntity) te).getOutput());
}
}
use of com.Da_Technomancer.crossroads.tileentities.RatiatorTileEntity in project Crossroads by Crossroads-Development.
the class OmniMeter method onItemUse.
@Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
TileEntity te = worldIn.getTileEntity(pos);
if (te == null || worldIn.isRemote) {
return te != null && te instanceof RatiatorTileEntity ? EnumActionResult.SUCCESS : EnumActionResult.PASS;
}
boolean pass = true;
if (te.hasCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null)) {
pass = false;
playerIn.sendMessage(new TextComponentString("Temp: " + worldIn.getTileEntity(pos).getCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null).getTemp() + "°C"));
playerIn.sendMessage(new TextComponentString("Biome Temp: " + EnergyConverters.BIOME_TEMP_MULT * worldIn.getBiomeForCoordsBody(pos).getFloatTemperature(pos) + "°C"));
}
if (te.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null)) {
pass = false;
IFluidHandler pipe = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null);
playerIn.sendMessage(new TextComponentString(pipe.getTankProperties().length + " internal tank" + (pipe.getTankProperties().length == 1 ? "." : "s.")));
for (IFluidTankProperties tank : pipe.getTankProperties()) {
playerIn.sendMessage(new TextComponentString("Amount: " + (tank.getContents() == null ? 0 : tank.getContents().amount) + ", Type: " + (tank.getContents() == null ? "None" : tank.getContents().getLocalizedName()) + ", Capacity: " + tank.getCapacity()));
}
}
if (te.hasCapability(Capabilities.AXLE_HANDLER_CAPABILITY, facing.getOpposite())) {
pass = false;
IAxleHandler gear = te.getCapability(Capabilities.AXLE_HANDLER_CAPABILITY, facing.getOpposite());
playerIn.sendMessage(new TextComponentString("Speed: " + MiscOp.betterRound(gear.getMotionData()[0], 3) + ", Energy: " + MiscOp.betterRound(gear.getMotionData()[1], 3) + ", Power: " + MiscOp.betterRound(gear.getMotionData()[2], 3) + ", Mass: " + gear.getPhysData()[0] + ", I: " + gear.getPhysData()[1]));
} else if (te.hasCapability(Capabilities.AXLE_HANDLER_CAPABILITY, facing)) {
pass = false;
IAxleHandler gear = te.getCapability(Capabilities.AXLE_HANDLER_CAPABILITY, facing);
playerIn.sendMessage(new TextComponentString("Speed: " + MiscOp.betterRound(gear.getMotionData()[0], 3) + ", Energy: " + MiscOp.betterRound(gear.getMotionData()[1], 3) + ", Power: " + MiscOp.betterRound(gear.getMotionData()[2], 3) + ", Mass: " + gear.getPhysData()[0] + ", I: " + gear.getPhysData()[1]));
}
if (te instanceof BeamRenderTEBase) {
pass = false;
MagicUnit[] mag = ((BeamRenderTEBase) te).getLastFullSent();
if (mag != null) {
for (int i = 0; i < mag.length; i++) {
MagicUnit check = mag[i];
if (check != null) {
NBTTagCompound nbt = MiscOp.getPlayerTag(playerIn);
if (!nbt.hasKey("elements")) {
nbt.setTag("elements", new NBTTagCompound());
}
nbt = nbt.getCompoundTag("elements");
if (!nbt.hasKey(MagicElements.getElement(check).name())) {
nbt.setBoolean(MagicElements.getElement(check).name(), true);
playerIn.sendMessage(new TextComponentString(TextFormatting.BOLD.toString() + "New Element Discovered: " + MagicElements.getElement(check).toString()));
StoreNBTToClient.syncNBTToClient((EntityPlayerMP) playerIn, false);
}
playerIn.sendMessage(new TextComponentString(EnumFacing.getFront(i).toString() + ": " + check.toString()));
}
}
}
}
if (te instanceof CrystalMasterAxisTileEntity) {
pass = false;
playerIn.sendMessage(new TextComponentString("Element: " + ((((CrystalMasterAxisTileEntity) te).getElement() == null) ? "NONE" : (((CrystalMasterAxisTileEntity) te).getElement().toString() + (((CrystalMasterAxisTileEntity) te).isVoid() ? " (VOID), " : ", ") + "Time: " + ((CrystalMasterAxisTileEntity) te).getTime()))));
}
if (te instanceof RatiatorTileEntity) {
pass = false;
playerIn.sendMessage(new TextComponentString("Out: " + ((RatiatorTileEntity) te).getOutput()));
}
return pass ? EnumActionResult.PASS : EnumActionResult.SUCCESS;
}
use of com.Da_Technomancer.crossroads.tileentities.RatiatorTileEntity in project Crossroads by Crossroads-Development.
the class Ratiator method updateTick.
@Override
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
RatiatorTileEntity te = ((RatiatorTileEntity) worldIn.getTileEntity(pos));
double lastOut = te.getOutput();
double sidePower = Math.max(getPowerOnSide(worldIn, pos, state.getValue(Properties.FACING).rotateY(), false), getPowerOnSide(worldIn, pos, state.getValue(Properties.FACING).rotateYCCW(), false));
te.setOutput(state.getValue(Properties.REDSTONE_BOOL) ? getPowerOnSide(worldIn, pos, state.getValue(Properties.FACING).getOpposite(), true) / (sidePower == 0 ? 1D : sidePower) : getPowerOnSide(worldIn, pos, state.getValue(Properties.FACING).getOpposite(), true) * sidePower);
if (lastOut != te.getOutput()) {
worldIn.neighborChanged(pos.offset(state.getValue(Properties.FACING)), this, pos);
worldIn.notifyNeighborsOfStateExcept(pos.offset(state.getValue(Properties.FACING)), this, state.getValue(Properties.FACING).getOpposite());
}
}
Aggregations