Improvements for debug tool and solar panel

This commit is contained in:
drcrazy 2018-09-25 16:00:44 +03:00
parent 1e9cfa07b6
commit d06bd5eef9
3 changed files with 28 additions and 16 deletions

View file

@ -286,7 +286,7 @@ public class TRContent {
INDUSTRIAL(EnumPowerTier.MEDIUM, ConfigTechReborn.industrialGenerationRateD, ConfigTechReborn.industrialGenerationRateN),
ULTIMATE(EnumPowerTier.HIGH, ConfigTechReborn.ultimateGenerationRateD, ConfigTechReborn.ultimateGenerationRateN),
QUANTUM(EnumPowerTier.EXTREME, ConfigTechReborn.quantumGenerationRateD, ConfigTechReborn.quantumGenerationRateN),
CREATIVE(EnumPowerTier.INFINITE, Integer.MAX_VALUE, Integer.MAX_VALUE);
CREATIVE(EnumPowerTier.INFINITE, Integer.MAX_VALUE / 100, Integer.MAX_VALUE / 100);
public final String name;
public final Block block;

View file

@ -52,23 +52,30 @@ public class ItemDebugTool extends Item {
EnumFacing facing, float hitX, float hitY, float hitZ) {
Block block = worldIn.getBlockState(pos).getBlock();
if (block != null) {
playerIn.sendMessage(new TextComponentString(
TextFormatting.GREEN + "Block Registry Name:" + TextFormatting.BLUE + block.getRegistryName().toString()));
sendMessage(playerIn, worldIn, new TextComponentString(TextFormatting.GREEN + "Block Registry Name: "
+ TextFormatting.BLUE + block.getRegistryName().toString()));
} else {
return EnumActionResult.FAIL;
}
TileEntity tile = worldIn.getTileEntity(pos);
if (tile instanceof IEnergyInterfaceTile) {
if (!tile.getWorld().isRemote) {
playerIn.sendMessage(new TextComponentString(TextFormatting.GREEN + "Power" + TextFormatting.BLUE
+ PowerSystem.getLocaliszedPower(((IEnergyInterfaceTile) tile).getEnergy())));
}
return EnumActionResult.SUCCESS;
} else if (tile != null && tile.hasCapability(CapabilityEnergy.ENERGY, facing)) {
if (!tile.getWorld().isRemote) {
playerIn.sendMessage(new TextComponentString(TextFormatting.GREEN + "Power " + TextFormatting.RED
+ tile.getCapability(CapabilityEnergy.ENERGY, facing).getEnergyStored() + "FU"));
}
return EnumActionResult.SUCCESS;
if (tile != null) {
sendMessage(playerIn, worldIn, new TextComponentString(
TextFormatting.GREEN + "Tile Entity: " + TextFormatting.BLUE + tile.getDisplayName().toString()));
}
if (tile instanceof IEnergyInterfaceTile) {
sendMessage(playerIn, worldIn, new TextComponentString(TextFormatting.GREEN + "Power: "
+ TextFormatting.BLUE + PowerSystem.getLocaliszedPower(((IEnergyInterfaceTile) tile).getEnergy())));
} else if (tile.hasCapability(CapabilityEnergy.ENERGY, facing)) {
sendMessage(playerIn, worldIn, new TextComponentString(TextFormatting.GREEN + "Power " + TextFormatting.RED
+ tile.getCapability(CapabilityEnergy.ENERGY, facing).getEnergyStored() + "FU"));
}
return EnumActionResult.SUCCESS;
}
private void sendMessage(EntityPlayer playerIn, World worldIn, TextComponentString string) {
if (!worldIn.isRemote) {
playerIn.sendMessage(string);
}
return EnumActionResult.FAIL;
}
}

View file

@ -36,6 +36,7 @@ import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.util.StringUtils;
import techreborn.blocks.generator.BlockSolarPanel;
import techreborn.init.TRContent;
import techreborn.init.TRContent.SolarPanels;
import java.util.List;
@ -57,6 +58,10 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
if (world.isRemote) {
return;
}
if (panel == TRContent.SolarPanels.CREATIVE) {
setEnergy(Integer.MAX_VALUE);
return;
}
if (world.getTotalWorldTime() % 20 == 0) {
canSeeSky = world.canBlockSeeSky(pos.up());
if (lastState != isSunOut()) {