Auto Format code
This commit is contained in:
parent
112b1657cf
commit
796df6c055
503 changed files with 12260 additions and 16291 deletions
|
@ -10,85 +10,67 @@ import reborncore.common.util.WorldUtils;
|
|||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class TilePlayerDectector extends TilePowerAcceptor
|
||||
{
|
||||
public class TilePlayerDectector extends TilePowerAcceptor {
|
||||
|
||||
public String owenerUdid = "";
|
||||
boolean redstone = false;
|
||||
|
||||
public TilePlayerDectector()
|
||||
{
|
||||
public TilePlayerDectector() {
|
||||
super(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
public double getMaxPower() {
|
||||
return 10000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
public double getMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
public double getMaxInput() {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.LOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0)
|
||||
{
|
||||
if (!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0) {
|
||||
boolean lastRedstone = redstone;
|
||||
redstone = false;
|
||||
if (canUseEnergy(10))
|
||||
{
|
||||
if (canUseEnergy(10)) {
|
||||
Iterator tIterator = super.worldObj.playerEntities.iterator();
|
||||
while (tIterator.hasNext())
|
||||
{
|
||||
while (tIterator.hasNext()) {
|
||||
EntityPlayer player = (EntityPlayer) tIterator.next();
|
||||
if (player.getDistanceSq((double) super.getPos().getX() + 0.5D,
|
||||
(double) super.getPos().getY() + 0.5D, (double) super.getPos().getZ() + 0.5D) <= 256.0D)
|
||||
{
|
||||
(double) super.getPos().getY() + 0.5D, (double) super.getPos().getZ() + 0.5D) <= 256.0D) {
|
||||
BlockMachineBase blockMachineBase = (BlockMachineBase) worldObj.getBlockState(pos).getBlock();
|
||||
int meta = blockMachineBase.getMetaFromState(worldObj.getBlockState(pos));
|
||||
if (meta == 0)
|
||||
{// ALL
|
||||
if (meta == 0) {// ALL
|
||||
redstone = true;
|
||||
} else if (meta == 1)
|
||||
{// Others
|
||||
if (!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUniqueID().toString()))
|
||||
{
|
||||
} else if (meta == 1) {// Others
|
||||
if (!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUniqueID().toString())) {
|
||||
redstone = true;
|
||||
}
|
||||
} else
|
||||
{// You
|
||||
if (!owenerUdid.isEmpty() && owenerUdid.equals(player.getUniqueID().toString()))
|
||||
{
|
||||
} else {// You
|
||||
if (!owenerUdid.isEmpty() && owenerUdid.equals(player.getUniqueID().toString())) {
|
||||
redstone = true;
|
||||
}
|
||||
}
|
||||
|
@ -97,29 +79,25 @@ public class TilePlayerDectector extends TilePowerAcceptor
|
|||
}
|
||||
useEnergy(10);
|
||||
}
|
||||
if (lastRedstone != redstone)
|
||||
{
|
||||
if (lastRedstone != redstone) {
|
||||
WorldUtils.updateBlock(worldObj, getPos());
|
||||
worldObj.notifyNeighborsOfStateChange(getPos(), worldObj.getBlockState(getPos()).getBlock());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isProvidingPower()
|
||||
{
|
||||
public boolean isProvidingPower() {
|
||||
return redstone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
owenerUdid = tag.getString("ownerID");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
tag.setString("ownerID", owenerUdid);
|
||||
return tag;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue