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), INDUSTRIAL(EnumPowerTier.MEDIUM, ConfigTechReborn.industrialGenerationRateD, ConfigTechReborn.industrialGenerationRateN),
ULTIMATE(EnumPowerTier.HIGH, ConfigTechReborn.ultimateGenerationRateD, ConfigTechReborn.ultimateGenerationRateN), ULTIMATE(EnumPowerTier.HIGH, ConfigTechReborn.ultimateGenerationRateD, ConfigTechReborn.ultimateGenerationRateN),
QUANTUM(EnumPowerTier.EXTREME, ConfigTechReborn.quantumGenerationRateD, ConfigTechReborn.quantumGenerationRateN), 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 String name;
public final Block block; public final Block block;

View file

@ -52,23 +52,30 @@ public class ItemDebugTool extends Item {
EnumFacing facing, float hitX, float hitY, float hitZ) { EnumFacing facing, float hitX, float hitY, float hitZ) {
Block block = worldIn.getBlockState(pos).getBlock(); Block block = worldIn.getBlockState(pos).getBlock();
if (block != null) { if (block != null) {
playerIn.sendMessage(new TextComponentString( sendMessage(playerIn, worldIn, new TextComponentString(TextFormatting.GREEN + "Block Registry Name: "
TextFormatting.GREEN + "Block Registry Name:" + TextFormatting.BLUE + block.getRegistryName().toString())); + TextFormatting.BLUE + block.getRegistryName().toString()));
} else {
return EnumActionResult.FAIL;
} }
TileEntity tile = worldIn.getTileEntity(pos); TileEntity tile = worldIn.getTileEntity(pos);
if (tile instanceof IEnergyInterfaceTile) { if (tile != null) {
if (!tile.getWorld().isRemote) { sendMessage(playerIn, worldIn, new TextComponentString(
playerIn.sendMessage(new TextComponentString(TextFormatting.GREEN + "Power" + TextFormatting.BLUE TextFormatting.GREEN + "Tile Entity: " + TextFormatting.BLUE + tile.getDisplayName().toString()));
+ PowerSystem.getLocaliszedPower(((IEnergyInterfaceTile) tile).getEnergy()))); }
} if (tile instanceof IEnergyInterfaceTile) {
return EnumActionResult.SUCCESS; sendMessage(playerIn, worldIn, new TextComponentString(TextFormatting.GREEN + "Power: "
} else if (tile != null && tile.hasCapability(CapabilityEnergy.ENERGY, facing)) { + TextFormatting.BLUE + PowerSystem.getLocaliszedPower(((IEnergyInterfaceTile) tile).getEnergy())));
if (!tile.getWorld().isRemote) { } else if (tile.hasCapability(CapabilityEnergy.ENERGY, facing)) {
playerIn.sendMessage(new TextComponentString(TextFormatting.GREEN + "Power " + TextFormatting.RED sendMessage(playerIn, worldIn, new TextComponentString(TextFormatting.GREEN + "Power " + TextFormatting.RED
+ tile.getCapability(CapabilityEnergy.ENERGY, facing).getEnergyStored() + "FU")); + tile.getCapability(CapabilityEnergy.ENERGY, facing).getEnergyStored() + "FU"));
} }
return EnumActionResult.SUCCESS; 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.powerSystem.TilePowerAcceptor;
import reborncore.common.util.StringUtils; import reborncore.common.util.StringUtils;
import techreborn.blocks.generator.BlockSolarPanel; import techreborn.blocks.generator.BlockSolarPanel;
import techreborn.init.TRContent;
import techreborn.init.TRContent.SolarPanels; import techreborn.init.TRContent.SolarPanels;
import java.util.List; import java.util.List;
@ -57,6 +58,10 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
if (world.isRemote) { if (world.isRemote) {
return; return;
} }
if (panel == TRContent.SolarPanels.CREATIVE) {
setEnergy(Integer.MAX_VALUE);
return;
}
if (world.getTotalWorldTime() % 20 == 0) { if (world.getTotalWorldTime() % 20 == 0) {
canSeeSky = world.canBlockSeeSky(pos.up()); canSeeSky = world.canBlockSeeSky(pos.up());
if (lastState != isSunOut()) { if (lastState != isSunOut()) {