mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-28 04:25:38 +00:00
Full Imports and Code Format Optimization
This commit is contained in:
1 parent
250edf099c
commit
6815f579a7
1192 files changed
+60344
-62167
No files matched your search
@@ -16,20 +16,20 @@ import noppes.npcs.controllers.data.Availability;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TileBorder extends TileEntity implements IEntitySelector{
|
||||
public Availability availability = new Availability();
|
||||
public AxisAlignedBB boundingbox;
|
||||
public int rotation = 0;
|
||||
public int height = 10;
|
||||
public String message = "availability.areaNotAvailble";
|
||||
public class TileBorder extends TileEntity implements IEntitySelector {
|
||||
public Availability availability = new Availability();
|
||||
public AxisAlignedBB boundingbox;
|
||||
public int rotation = 0;
|
||||
public int height = 10;
|
||||
public String message = "availability.areaNotAvailble";
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
super.readFromNBT(compound);
|
||||
readExtraNBT(compound);
|
||||
}
|
||||
|
||||
public void readExtraNBT(NBTTagCompound compound){
|
||||
|
||||
public void readExtraNBT(NBTTagCompound compound) {
|
||||
availability.readFromNBT(compound.getCompoundTag("BorderAvailability"));
|
||||
rotation = compound.getInteger("BorderRotation");
|
||||
height = compound.getInteger("BorderHeight");
|
||||
@@ -37,78 +37,76 @@ public class TileBorder extends TileEntity implements IEntitySelector{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
writeExtraNBT(compound);
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
super.writeToNBT(compound);
|
||||
writeExtraNBT(compound);
|
||||
}
|
||||
|
||||
public void writeExtraNBT(NBTTagCompound compound){
|
||||
compound.setTag("BorderAvailability", availability.writeToNBT(new NBTTagCompound()));
|
||||
compound.setInteger("BorderRotation", rotation);
|
||||
compound.setInteger("BorderHeight", height);
|
||||
compound.setString("BorderMessage", message);
|
||||
|
||||
public void writeExtraNBT(NBTTagCompound compound) {
|
||||
compound.setTag("BorderAvailability", availability.writeToNBT(new NBTTagCompound()));
|
||||
compound.setInteger("BorderRotation", rotation);
|
||||
compound.setInteger("BorderHeight", height);
|
||||
compound.setString("BorderMessage", message);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if(worldObj.isRemote)
|
||||
return;
|
||||
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + height + 1, zCoord + 1);
|
||||
List<Entity> list = worldObj.selectEntitiesWithinAABB(Entity.class, box, this);
|
||||
for(Entity entity : list){
|
||||
if(entity instanceof EntityEnderPearl){
|
||||
EntityEnderPearl pearl = (EntityEnderPearl) entity;
|
||||
if(pearl.getThrower() instanceof EntityPlayer && !availability.isAvailable((EntityPlayer)pearl.getThrower()))
|
||||
entity.isDead = true;
|
||||
continue;
|
||||
}
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
if(availability.isAvailable(player))
|
||||
continue;
|
||||
int posX = this.xCoord;
|
||||
int posZ = this.zCoord;
|
||||
int posY = this.yCoord;
|
||||
if(rotation == 0){
|
||||
posZ--;
|
||||
}
|
||||
else if(rotation == 2){
|
||||
posZ++;
|
||||
}
|
||||
else if(rotation == 1){
|
||||
posX++;
|
||||
}
|
||||
else if(rotation == 3){
|
||||
posX--;
|
||||
}
|
||||
while(!worldObj.isAirBlock(posX, posY, posZ)){
|
||||
posY++;
|
||||
}
|
||||
player.setPositionAndUpdate(posX + 0.5, posY, posZ + 0.5);
|
||||
if(!message.isEmpty())
|
||||
player.addChatComponentMessage(new ChatComponentTranslation(message));
|
||||
}
|
||||
if (worldObj.isRemote)
|
||||
return;
|
||||
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + height + 1, zCoord + 1);
|
||||
List<Entity> list = worldObj.selectEntitiesWithinAABB(Entity.class, box, this);
|
||||
for (Entity entity : list) {
|
||||
if (entity instanceof EntityEnderPearl) {
|
||||
EntityEnderPearl pearl = (EntityEnderPearl) entity;
|
||||
if (pearl.getThrower() instanceof EntityPlayer && !availability.isAvailable((EntityPlayer) pearl.getThrower()))
|
||||
entity.isDead = true;
|
||||
continue;
|
||||
}
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
if (availability.isAvailable(player))
|
||||
continue;
|
||||
int posX = this.xCoord;
|
||||
int posZ = this.zCoord;
|
||||
int posY = this.yCoord;
|
||||
if (rotation == 0) {
|
||||
posZ--;
|
||||
} else if (rotation == 2) {
|
||||
posZ++;
|
||||
} else if (rotation == 1) {
|
||||
posX++;
|
||||
} else if (rotation == 3) {
|
||||
posX--;
|
||||
}
|
||||
while (!worldObj.isAirBlock(posX, posY, posZ)) {
|
||||
posY++;
|
||||
}
|
||||
player.setPositionAndUpdate(posX + 0.5, posY, posZ + 0.5);
|
||||
if (!message.isEmpty())
|
||||
player.addChatComponentMessage(new ChatComponentTranslation(message));
|
||||
}
|
||||
}
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){
|
||||
NBTTagCompound compound = pkt.func_148857_g();
|
||||
rotation = compound.getInteger("Rotation");
|
||||
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
NBTTagCompound compound = pkt.func_148857_g();
|
||||
rotation = compound.getInteger("Rotation");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setInteger("Rotation", rotation);
|
||||
S35PacketUpdateTileEntity packet = new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, compound);
|
||||
return packet;
|
||||
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setInteger("Rotation", rotation);
|
||||
S35PacketUpdateTileEntity packet = new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, compound);
|
||||
return packet;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canUpdate(){
|
||||
public boolean canUpdate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity var1) {
|
||||
return var1 instanceof EntityPlayerMP || var1 instanceof EntityEnderPearl;
|
||||
}
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity var1) {
|
||||
return var1 instanceof EntityPlayerMP || var1 instanceof EntityEnderPearl;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user