Merge branch 'master' of ssh://dev.mineplex.com:7999/min/mineplex

This commit is contained in:
Chiss 2014-01-21 22:52:05 +11:00
commit b0ea211ae3
4 changed files with 305 additions and 1 deletions

Binary file not shown.

View File

@ -4,6 +4,7 @@ import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.LinkedList;
import net.minecraft.server.v1_6_R3.EntityBat;
import net.minecraft.server.v1_6_R3.EntityCreature;
import net.minecraft.server.v1_6_R3.EntityEnderDragon;
import net.minecraft.server.v1_6_R3.EntityHuman;
@ -22,7 +23,6 @@ import org.bukkit.Sound;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
@ -119,6 +119,11 @@ public class UtilEnt
_goalSelector.set(creature, goalSelector);
_targetSelector.set(creature, new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler));
}
if (((CraftEntity)entity).getHandle() instanceof EntityBat)
{
((EntityBat)((CraftEntity)entity).getHandle()).Vegetated = true;
}
if (((CraftEntity)entity).getHandle() instanceof EntityEnderDragon)
{

View File

@ -0,0 +1,78 @@
package mineplex.servermonitor;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class ProcessRunner extends Thread
{
private ProcessBuilder _processBuilder;
private Process _process;
private Runnable _runnable;
boolean _done = false;
ProcessRunner(String[] args)
{
super("ProcessRunner " + args);
_processBuilder = new ProcessBuilder(args);
}
public void run()
{
try
{
_process = _processBuilder.start();
_process.waitFor();
BufferedReader reader=new BufferedReader(new InputStreamReader(_process.getInputStream()));
String line = reader.readLine();
while(line != null)
{
System.out.println(line);
line=reader.readLine();
}
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
finally
{
_done = true;
if (_runnable != null)
_runnable.run();
}
}
public void start(Runnable runnable)
{
super.start();
_runnable = runnable;
}
public int exitValue() throws IllegalStateException
{
if (_process != null)
{
return _process.exitValue();
}
throw new IllegalStateException("Process not started yet");
}
public boolean isDone()
{
return _done;
}
public void abort()
{
if (!isDone())
{
_process.destroy();
}
}
}

View File

@ -0,0 +1,221 @@
package net.minecraft.server.v1_6_R3;
import java.util.Calendar;
import java.util.Random;
public class EntityBat extends EntityAmbient
{
private ChunkCoordinates h;
public boolean Vegetated = false;
public EntityBat(World paramWorld)
{
super(paramWorld);
a(0.5F, 0.9F);
a(true);
}
protected void a()
{
super.a();
this.datawatcher.a(16, new Byte((byte)0));
}
protected float ba()
{
return 0.1F;
}
protected float bb()
{
return super.bb() * 0.95F;
}
protected String r()
{
if ((bJ()) && (this.random.nextInt(4) != 0)) {
return null;
}
return "mob.bat.idle";
}
protected String aO()
{
return "mob.bat.hurt";
}
protected String aP()
{
return "mob.bat.death";
}
public boolean M()
{
return false;
}
protected void n(Entity paramEntity)
{
}
protected void bj()
{
}
protected void az()
{
super.az();
getAttributeInstance(GenericAttributes.a).setValue(6.0D);
}
public boolean bJ() {
return (this.datawatcher.getByte(16) & 0x1) != 0;
}
public void a(boolean paramBoolean) {
int i = this.datawatcher.getByte(16);
if (paramBoolean)
this.datawatcher.watch(16, Byte.valueOf((byte)(i | 0x1)));
else
this.datawatcher.watch(16, Byte.valueOf((byte)(i & 0xFFFFFFFE)));
}
protected boolean bf()
{
return true;
}
public void l_()
{
super.l_();
if (Vegetated)
return;
if (bJ()) {
this.motX = (this.motY = this.motZ = 0.0D);
this.locY = (MathHelper.floor(this.locY) + 1.0D - this.length);
} else {
this.motY *= 0.6000000238418579D;
}
}
protected void bi()
{
super.bi();
if (Vegetated)
return;
if (bJ()) {
if (!this.world.u(MathHelper.floor(this.locX), (int)this.locY + 1, MathHelper.floor(this.locZ))) {
a(false);
this.world.a(null, 1015, (int)this.locX, (int)this.locY, (int)this.locZ, 0);
}
else {
if (this.random.nextInt(200) == 0) {
this.aP = this.random.nextInt(360);
}
if (this.world.findNearbyPlayer(this, 4.0D) != null) {
a(false);
this.world.a(null, 1015, (int)this.locX, (int)this.locY, (int)this.locZ, 0);
}
}
}
else
{
if ((this.h != null) && ((!this.world.isEmpty(this.h.x, this.h.y, this.h.z)) || (this.h.y < 1))) {
this.h = null;
}
if ((this.h == null) || (this.random.nextInt(30) == 0) || (this.h.e((int)this.locX, (int)this.locY, (int)this.locZ) < 4.0F)) {
this.h = new ChunkCoordinates((int)this.locX + this.random.nextInt(7) - this.random.nextInt(7), (int)this.locY + this.random.nextInt(6) - 2, (int)this.locZ + this.random.nextInt(7) - this.random.nextInt(7));
}
double d1 = this.h.x + 0.5D - this.locX;
double d2 = this.h.y + 0.1D - this.locY;
double d3 = this.h.z + 0.5D - this.locZ;
this.motX += (Math.signum(d1) * 0.5D - this.motX) * 0.1000000014901161D;
this.motY += (Math.signum(d2) * 0.699999988079071D - this.motY) * 0.1000000014901161D;
this.motZ += (Math.signum(d3) * 0.5D - this.motZ) * 0.1000000014901161D;
float f1 = (float)(Math.atan2(this.motZ, this.motX) * 180.0D / 3.141592741012573D) - 90.0F;
float f2 = MathHelper.g(f1 - this.yaw);
this.bf = 0.5F;
this.yaw += f2;
if ((this.random.nextInt(100) == 0) && (this.world.u(MathHelper.floor(this.locX), (int)this.locY + 1, MathHelper.floor(this.locZ))))
a(true);
}
}
protected boolean e_()
{
return false;
}
protected void b(float paramFloat)
{
}
protected void a(double paramDouble, boolean paramBoolean)
{
}
public boolean au()
{
return true;
}
public boolean damageEntity(DamageSource paramDamageSource, float paramFloat)
{
if (isInvulnerable()) return false;
if ((!this.world.isStatic) && bJ() && !Vegetated) {
a(false);
}
return super.damageEntity(paramDamageSource, paramFloat);
}
public void a(NBTTagCompound paramNBTTagCompound)
{
super.a(paramNBTTagCompound);
this.datawatcher.watch(16, Byte.valueOf(paramNBTTagCompound.getByte("BatFlags")));
}
public void b(NBTTagCompound paramNBTTagCompound)
{
super.b(paramNBTTagCompound);
paramNBTTagCompound.setByte("BatFlags", this.datawatcher.getByte(16));
}
public boolean canSpawn()
{
int i = MathHelper.floor(this.boundingBox.b);
if (i >= 63) return false;
int j = MathHelper.floor(this.locX);
int k = MathHelper.floor(this.locZ);
int m = this.world.getLightLevel(j, i, k);
int n = 4;
Calendar localCalendar = this.world.W();
if (((localCalendar.get(2) + 1 == 10) && (localCalendar.get(5) >= 20)) || ((localCalendar.get(2) + 1 == 11) && (localCalendar.get(5) <= 3)))
n = 7;
else if (this.random.nextBoolean()) {
return false;
}
if (m > this.random.nextInt(n)) return false;
return super.canSpawn();
}
}