Updated to latest spigot with 1.8 support.
Tweaked disguise manager for 1.8 support. Work on CUstomer support server + admin stuff.
This commit is contained in:
parent
006c7d1e65
commit
a4871b5509
Binary file not shown.
@ -2,6 +2,6 @@
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/bin/craftbukkit.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -5,8 +5,7 @@
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpcore-4.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-4.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-codec-1.6.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core.CraftBukkit"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/bin/craftbukkit.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.ServerData"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jedis-2.4.2.jar"/>
|
||||
|
@ -6,10 +6,10 @@ import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation;
|
||||
import net.minecraft.server.v1_7_R4.ChunkAddEntityEvent;
|
||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R4.Packet;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityVelocity;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package mineplex.core.disguise.disguises;
|
||||
|
||||
import org.bukkit.entity.*;
|
||||
import org.spigotmc.ProtocolData;
|
||||
|
||||
public abstract class DisguiseAgeable extends DisguiseCreature
|
||||
{
|
||||
@ -8,16 +9,23 @@ public abstract class DisguiseAgeable extends DisguiseCreature
|
||||
{
|
||||
super(disguiseType, entity);
|
||||
|
||||
DataWatcher.a(12, new Integer(0));
|
||||
DataWatcher.a(12, new ProtocolData.IntByte(0, (byte)0));
|
||||
}
|
||||
|
||||
public void UpdateDataWatcher()
|
||||
{
|
||||
super.UpdateDataWatcher();
|
||||
|
||||
DataWatcher.watch(12, DataWatcher.getIntByte(12));
|
||||
}
|
||||
|
||||
public boolean isBaby()
|
||||
{
|
||||
return DataWatcher.getInt(12) < 0;
|
||||
return DataWatcher.getIntByte(12).value < 0;
|
||||
}
|
||||
|
||||
public void setBaby()
|
||||
{
|
||||
DataWatcher.watch(12, Integer.valueOf(-24000));
|
||||
DataWatcher.watch(12, new ProtocolData.IntByte(-24000, (byte) ( -1 )));
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,9 @@ import java.util.Arrays;
|
||||
import net.minecraft.server.v1_7_R4.MobEffect;
|
||||
import net.minecraft.server.v1_7_R4.MobEffectList;
|
||||
import net.minecraft.server.v1_7_R4.PotionBrewer;
|
||||
|
||||
import org.bukkit.entity.*;
|
||||
import org.spigotmc.ProtocolData;
|
||||
|
||||
public class DisguiseEnderman extends DisguiseMonster
|
||||
{
|
||||
@ -13,7 +15,7 @@ public class DisguiseEnderman extends DisguiseMonster
|
||||
{
|
||||
super(EntityType.ENDERMAN, entity);
|
||||
|
||||
DataWatcher.a(16, new Byte((byte)0));
|
||||
DataWatcher.a(16, new ProtocolData.ByteShort( (short) 0 ) );
|
||||
DataWatcher.a(17, new Byte((byte)0));
|
||||
DataWatcher.a(18, new Byte((byte)0));
|
||||
|
||||
@ -27,11 +29,12 @@ public class DisguiseEnderman extends DisguiseMonster
|
||||
super.UpdateDataWatcher();
|
||||
|
||||
DataWatcher.watch(0, Byte.valueOf((byte)(DataWatcher.getByte(0) & ~(1 << 0))));
|
||||
DataWatcher.watch(16, new ProtocolData.ByteShort( DataWatcher.getShort(16) ));
|
||||
}
|
||||
|
||||
public void SetCarriedId(int i)
|
||||
{
|
||||
DataWatcher.watch(16, Byte.valueOf((byte)(i & 0xFF)));
|
||||
DataWatcher.watch(16, new ProtocolData.ByteShort( (short)(i & 0xFF)) );
|
||||
}
|
||||
|
||||
public int GetCarriedId()
|
||||
|
@ -1,6 +1,7 @@
|
||||
package mineplex.core.disguise.disguises;
|
||||
|
||||
import org.bukkit.entity.*;
|
||||
import org.spigotmc.ProtocolData;
|
||||
|
||||
public class DisguiseHorse extends DisguiseAnimal
|
||||
{
|
||||
|
@ -1,7 +1,10 @@
|
||||
package mineplex.core.friend.ui;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo;
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
|
||||
public class LineTracker
|
||||
{
|
||||
@ -29,13 +32,26 @@ public class LineTracker
|
||||
|
||||
if (_oldLine != null)
|
||||
{
|
||||
_clearOldPacket = new PacketPlayOutPlayerInfo(_oldLine, false, 0);
|
||||
_clearOldPacket = new PacketPlayOutPlayerInfo();
|
||||
_clearOldPacket.username = _oldLine;
|
||||
_clearOldPacket.action = PacketPlayOutPlayerInfo.REMOVE_PLAYER;
|
||||
_clearOldPacket.ping = 0;
|
||||
_clearOldPacket.player = new GameProfile(UUID.randomUUID(), _oldLine);
|
||||
}
|
||||
|
||||
if (_line != null)
|
||||
{
|
||||
_addNewPacket = new PacketPlayOutPlayerInfo(_line, true, 0);
|
||||
_clearNewPacket = new PacketPlayOutPlayerInfo(_line, false, 0);
|
||||
_addNewPacket = new PacketPlayOutPlayerInfo();
|
||||
_addNewPacket.username = _line;
|
||||
_addNewPacket.action = PacketPlayOutPlayerInfo.ADD_PLAYER;
|
||||
_addNewPacket.ping = 0;
|
||||
_addNewPacket.player = new GameProfile(UUID.randomUUID(), _line);
|
||||
|
||||
_clearNewPacket = new PacketPlayOutPlayerInfo();
|
||||
_clearNewPacket.username = _line;
|
||||
_clearNewPacket.action = PacketPlayOutPlayerInfo.REMOVE_PLAYER;
|
||||
_clearNewPacket.ping = 0;
|
||||
_clearNewPacket.player = new GameProfile(UUID.randomUUID(), _line);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -25,63 +25,6 @@ public class PacketVerifier implements IPacketVerifier
|
||||
@Override
|
||||
public boolean verify(Packet o)
|
||||
{
|
||||
if (o instanceof PacketPlayOutEntityTeleport)
|
||||
{
|
||||
PacketPlayOutEntityTeleport packet = (PacketPlayOutEntityTeleport)o;
|
||||
|
||||
//System.out.println("Packet34EntityTeleport (" + packet.b + ", " + packet.c + ", " + packet.d + ")");
|
||||
|
||||
if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a))
|
||||
{
|
||||
forceProcess(new PacketPlayOutEntityTeleport(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d, packet.e, packet.f));
|
||||
return true;
|
||||
}
|
||||
else if (_handler.IsBlocked(_owner, packet.a))
|
||||
return false;
|
||||
}
|
||||
else if (o instanceof PacketPlayOutEntityVelocity)
|
||||
{
|
||||
PacketPlayOutEntityVelocity packet = (PacketPlayOutEntityVelocity)o;
|
||||
|
||||
//System.out.println("Packet28EntityVelocity (" + packet.b / 8000.0D + ", " + packet.c / 8000.0D + ", " + packet.d / 8000.0D + ") for " + packet.a + " to " + _owner.getName());
|
||||
|
||||
if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a))
|
||||
{
|
||||
// Occasional velocity sent for player in MK jacks up karts so don't process this.
|
||||
return false;
|
||||
}
|
||||
else if (_handler.IsBlocked(_owner, packet.a))
|
||||
return false;
|
||||
}
|
||||
else if (o instanceof PacketPlayOutRelEntityMove)
|
||||
{
|
||||
PacketPlayOutRelEntityMove packet = (PacketPlayOutRelEntityMove)o;
|
||||
|
||||
//System.out.println("Packet31RelEntityMove (" + packet.b + ", " + packet.c + ", " + packet.d + ")");
|
||||
|
||||
if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a))
|
||||
{
|
||||
forceProcess(new PacketPlayOutRelEntityMove(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d));
|
||||
return true;
|
||||
}
|
||||
else if (_handler.IsBlocked(_owner, packet.a))
|
||||
return false;
|
||||
}
|
||||
else if (o instanceof PacketPlayOutRelEntityMoveLook)
|
||||
{
|
||||
PacketPlayOutRelEntityMoveLook packet = (PacketPlayOutRelEntityMoveLook)o;
|
||||
|
||||
//System.out.println("Packet33RelEntityMoveLook (" + packet.b + ", " + packet.c + ", " + packet.d + ")");
|
||||
|
||||
if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a))
|
||||
{
|
||||
forceProcess(new PacketPlayOutRelEntityMoveLook(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d, packet.e, packet.f));
|
||||
return true;
|
||||
}
|
||||
else if (_handler.IsBlocked(_owner, packet.a))
|
||||
return false;
|
||||
}
|
||||
|
||||
return _handler.FireRunnables(o, _owner, this);
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar" sourcepath="/REPO_DIR/GitHubLibraries/CraftBukkit/src"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/bukkit.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.Core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.ClassCombat"/>
|
||||
|
@ -2,10 +2,9 @@
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core.CraftBukkit"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.Core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/bin/craftbukkit.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -3,7 +3,6 @@
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core.CraftBukkit"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar" sourcepath="/REPO_DIR/GitHubLibraries/CraftBukkit/src"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
@ -10,7 +10,7 @@ public class checkCommand extends CommandBase<CustomerSupport>
|
||||
{
|
||||
public checkCommand(CustomerSupport plugin)
|
||||
{
|
||||
super(plugin, Rank.MODERATOR, "check");
|
||||
super(plugin, Rank.MODERATOR, "check", "c");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jline-2.6.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit_official.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
|
||||
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="NautilusCraftBukkit2,"/>
|
||||
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="NautilusCraftBukkit2,"/>
|
||||
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="NautilusCraftBukkit2,"/>
|
||||
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
|
||||
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
|
||||
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value=""/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${BUILD_FILES}/common.xml"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
|
||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Nautilus.Core.CraftBukkit}"/>
|
||||
</launchConfiguration>
|
@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Nautilus.Core.CraftBukkit</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
|
||||
<triggers>auto,full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>LaunchConfigHandle</key>
|
||||
<value><project>/.externalToolBuilders/CB2.launch</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>1350069218645</id>
|
||||
<name></name>
|
||||
<type>26</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-main</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>1350069218648</id>
|
||||
<name></name>
|
||||
<type>26</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-test</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
</projectDescription>
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
@ -1,11 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="craftbukkit" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
@ -1,83 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- WARNING: Eclipse auto-generated file.
|
||||
Any modifications will be overwritten.
|
||||
To include a user specific buildfile here, simply create one in the same
|
||||
directory with the processing instruction <?eclipse.ant.import?>
|
||||
as the first entry and export the buildfile again. -->
|
||||
<project basedir="." default="build" name="Nautilus.Core.CraftBukkit">
|
||||
<property environment="env"/>
|
||||
<property name="REPO_DIR" value="../../"/>
|
||||
<property name="Core.location" value="../Core"/>
|
||||
<property name="Nautilus.Game.Core.location" value="../Nautilus.Game.Core"/>
|
||||
<property name="Nautilus.Game.Dominate.location" value="../Nautilus.Game.Dominate"/>
|
||||
<property name="Nautilus.Game.Lobby.location" value="../Nautilus.Game.Lobby"/>
|
||||
<property name="ECLIPSE_HOME" value="../../../../../Program Files/eclipse"/>
|
||||
<property name="debuglevel" value="source,lines,vars"/>
|
||||
<property name="target" value="1.6"/>
|
||||
<property name="source" value="1.6"/>
|
||||
<path id="Nautilus.Core.CraftBukkit.classpath">
|
||||
<pathelement location="bin"/>
|
||||
<pathelement location="${REPO_DIR}/Plugins/Libraries/jline-2.6.jar"/>
|
||||
<pathelement location="${REPO_DIR}/Plugins/Libraries/craftbukkit.jar"/>
|
||||
</path>
|
||||
<target name="init">
|
||||
<mkdir dir="bin"/>
|
||||
<copy includeemptydirs="false" todir="bin">
|
||||
<fileset dir="src">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
<target name="clean">
|
||||
<delete dir="bin"/>
|
||||
</target>
|
||||
<target depends="clean" name="cleanall"/>
|
||||
<target depends="build-subprojects,build-project" name="build"/>
|
||||
<target name="build-subprojects"/>
|
||||
<target depends="init" name="build-project">
|
||||
<echo message="${ant.project.name}: ${ant.file}"/>
|
||||
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
|
||||
<src path="src"/>
|
||||
<classpath refid="Nautilus.Core.CraftBukkit.classpath"/>
|
||||
</javac>
|
||||
</target>
|
||||
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects">
|
||||
<ant antfile="Core.xml" dir="${Core.location}" inheritAll="false" target="clean"/>
|
||||
<ant antfile="Core.xml" dir="${Core.location}" inheritAll="false" target="build">
|
||||
<propertyset>
|
||||
<propertyref name="build.compiler"/>
|
||||
</propertyset>
|
||||
</ant>
|
||||
<ant antfile="Nautilus.Game.Core.xml" dir="${Nautilus.Game.Core.location}" inheritAll="false" target="clean"/>
|
||||
<ant antfile="Nautilus.Game.Core.xml" dir="${Nautilus.Game.Core.location}" inheritAll="false" target="build">
|
||||
<propertyset>
|
||||
<propertyref name="build.compiler"/>
|
||||
</propertyset>
|
||||
</ant>
|
||||
<ant antfile="Dominate.xml" dir="${Nautilus.Game.Dominate.location}" inheritAll="false" target="clean"/>
|
||||
<ant antfile="Dominate.xml" dir="${Nautilus.Game.Dominate.location}" inheritAll="false" target="build">
|
||||
<propertyset>
|
||||
<propertyref name="build.compiler"/>
|
||||
</propertyset>
|
||||
</ant>
|
||||
<ant antfile="Lobby.xml" dir="${Nautilus.Game.Lobby.location}" inheritAll="false" target="clean"/>
|
||||
<ant antfile="Lobby.xml" dir="${Nautilus.Game.Lobby.location}" inheritAll="false" target="build">
|
||||
<propertyset>
|
||||
<propertyref name="build.compiler"/>
|
||||
</propertyset>
|
||||
</ant>
|
||||
</target>
|
||||
<target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
|
||||
<copy todir="${ant.library.dir}">
|
||||
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
|
||||
</copy>
|
||||
<unzip dest="${ant.library.dir}">
|
||||
<patternset includes="jdtCompilerAdapter.jar"/>
|
||||
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
|
||||
</unzip>
|
||||
</target>
|
||||
<target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
|
||||
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
|
||||
<antcall target="build"/>
|
||||
</target>
|
||||
</project>
|
File diff suppressed because it is too large
Load Diff
@ -1,31 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class ChunkAddEntityEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private org.bukkit.entity.Entity _entity;
|
||||
|
||||
public ChunkAddEntityEvent(org.bukkit.entity.Entity entity)
|
||||
{
|
||||
_entity = entity;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public org.bukkit.entity.Entity GetEntity()
|
||||
{
|
||||
return _entity;
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class ChunkPreLoadEvent extends Event implements Cancellable
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean _cancelled;
|
||||
private org.bukkit.World _world;
|
||||
private int _x;
|
||||
private int _z;
|
||||
|
||||
public ChunkPreLoadEvent(org.bukkit.World world, int x, int z)
|
||||
{
|
||||
_world = world;
|
||||
_x = x;
|
||||
_z = z;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public org.bukkit.World GetWorld()
|
||||
{
|
||||
return _world;
|
||||
}
|
||||
|
||||
public int GetX()
|
||||
{
|
||||
return _x;
|
||||
}
|
||||
|
||||
public int GetZ()
|
||||
{
|
||||
return _z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean arg0)
|
||||
{
|
||||
_cancelled = arg0;
|
||||
}
|
||||
}
|
@ -1,452 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import net.minecraft.util.com.google.common.collect.Lists;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.chunkio.ChunkIOExecutor;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.util.LongHash;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.util.LongHashSet;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.util.LongObjectHashMap;
|
||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class ChunkProviderServer implements IChunkProvider {
|
||||
|
||||
private static final Logger b = LogManager.getLogger();
|
||||
// CraftBukkit start - private -> public
|
||||
public LongHashSet unloadQueue = new LongHashSet(); // LongHashSet
|
||||
public Chunk emptyChunk;
|
||||
public IChunkProvider chunkProvider;
|
||||
private IChunkLoader f;
|
||||
public boolean forceChunkLoad = false; // true -> false
|
||||
public LongObjectHashMap<Chunk> chunks = new LongObjectHashMap<Chunk>();
|
||||
public WorldServer world;
|
||||
// CraftBukkit end
|
||||
|
||||
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) {
|
||||
this.emptyChunk = new EmptyChunk(worldserver, 0, 0);
|
||||
this.world = worldserver;
|
||||
this.f = ichunkloader;
|
||||
this.chunkProvider = ichunkprovider;
|
||||
}
|
||||
|
||||
public boolean isChunkLoaded(int i, int j) {
|
||||
return this.chunks.containsKey(LongHash.toLong(i, j)); // CraftBukkit
|
||||
}
|
||||
|
||||
// CraftBukkit start - Change return type to Collection and return the values of our chunk map
|
||||
public java.util.Collection a() {
|
||||
// return this.chunkList;
|
||||
return this.chunks.values();
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public void queueUnload(int i, int j) {
|
||||
if (this.world.worldProvider.e()) {
|
||||
ChunkCoordinates chunkcoordinates = this.world.getSpawn();
|
||||
int k = i * 16 + 8 - chunkcoordinates.x;
|
||||
int l = j * 16 + 8 - chunkcoordinates.z;
|
||||
short short1 = 128;
|
||||
|
||||
// CraftBukkit start
|
||||
if (k < -short1 || k > short1 || l < -short1 || l > short1 || !(this.world.keepSpawnInMemory)) { // Added 'this.world.keepSpawnInMemory'
|
||||
this.unloadQueue.add(i, j);
|
||||
|
||||
Chunk c = this.chunks.get(LongHash.toLong(i, j));
|
||||
if (c != null) {
|
||||
c.mustSave = true;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
this.unloadQueue.add(i, j);
|
||||
|
||||
Chunk c = this.chunks.get(LongHash.toLong(i, j));
|
||||
if (c != null) {
|
||||
c.mustSave = true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
public void b() {
|
||||
Iterator iterator = this.chunks.values().iterator(); // CraftBukkit
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Chunk chunk = (Chunk) iterator.next();
|
||||
|
||||
this.queueUnload(chunk.locX, chunk.locZ);
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start - Add async variant, provide compatibility
|
||||
public Chunk getChunkIfLoaded(int x, int z) {
|
||||
return this.chunks.get(LongHash.toLong(x, z));
|
||||
}
|
||||
|
||||
public Chunk getChunkAt(int i, int j) {
|
||||
return getChunkAt(i, j, null);
|
||||
}
|
||||
|
||||
public Chunk getChunkAt(int i, int j, Runnable runnable) {
|
||||
this.unloadQueue.remove(i, j);
|
||||
Chunk chunk = this.chunks.get(LongHash.toLong(i, j));
|
||||
ChunkRegionLoader loader = null;
|
||||
|
||||
if (this.f instanceof ChunkRegionLoader) {
|
||||
loader = (ChunkRegionLoader) this.f;
|
||||
}
|
||||
|
||||
// We can only use the queue for already generated chunks
|
||||
if (chunk == null && loader != null && loader.chunkExists(this.world, i, j)) {
|
||||
if (runnable != null) {
|
||||
Server server = this.world.getServer();
|
||||
|
||||
ChunkPreLoadEvent event = new ChunkPreLoadEvent(world.getWorld(), i, j);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled())
|
||||
{
|
||||
runnable.run();
|
||||
|
||||
chunk = new EmptyChunk(world, i, j);
|
||||
chunk.done = true;
|
||||
chunks.put(LongHash.toLong(i, j), chunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
ChunkIOExecutor.queueChunkLoad(this.world, loader, this, i, j, runnable);
|
||||
}
|
||||
|
||||
return null;
|
||||
} else {
|
||||
|
||||
Server server = this.world.getServer();
|
||||
|
||||
if (server != null)
|
||||
{
|
||||
ChunkPreLoadEvent event = new ChunkPreLoadEvent(world.getWorld(), i, j);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled())
|
||||
{
|
||||
chunk = new EmptyChunk(world, i, j);
|
||||
chunk.done = true;
|
||||
chunks.put(LongHash.toLong(i, j), chunk);
|
||||
}
|
||||
else
|
||||
chunk = ChunkIOExecutor.syncChunkLoad(this.world, loader, this, i, j);
|
||||
}
|
||||
}
|
||||
} else if (chunk == null) {
|
||||
chunk = this.originalGetChunkAt(i, j);
|
||||
}
|
||||
|
||||
// If we didn't load the chunk async and have a callback run it now
|
||||
if (runnable != null) {
|
||||
runnable.run();
|
||||
}
|
||||
|
||||
return chunk;
|
||||
}
|
||||
|
||||
public Chunk originalGetChunkAt(int i, int j) {
|
||||
this.unloadQueue.remove(i, j);
|
||||
Chunk chunk = (Chunk) this.chunks.get(LongHash.toLong(i, j));
|
||||
boolean newChunk = false;
|
||||
|
||||
Server server = this.world.getServer();
|
||||
|
||||
if (chunk == null && server != null)
|
||||
{
|
||||
ChunkPreLoadEvent event = new ChunkPreLoadEvent(world.getWorld(), i, j);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled())
|
||||
{
|
||||
chunk = new EmptyChunk(world, i, j);
|
||||
chunk.done = true;
|
||||
chunks.put(LongHash.toLong(i, j), chunk);
|
||||
|
||||
return chunk;
|
||||
}
|
||||
}
|
||||
|
||||
if (chunk == null) {
|
||||
world.timings.syncChunkLoadTimer.startTiming(); // Spigot
|
||||
chunk = this.loadChunk(i, j);
|
||||
if (chunk == null) {
|
||||
if (this.chunkProvider == null) {
|
||||
chunk = this.emptyChunk;
|
||||
} else {
|
||||
try {
|
||||
chunk = this.chunkProvider.getOrCreateChunk(i, j);
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Exception generating new chunk");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Chunk to be generated");
|
||||
|
||||
crashreportsystemdetails.a("Location", String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)}));
|
||||
crashreportsystemdetails.a("Position hash", Long.valueOf(LongHash.toLong(i, j))); // CraftBukkit - Use LongHash
|
||||
crashreportsystemdetails.a("Generator", this.chunkProvider.getName());
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
}
|
||||
newChunk = true; // CraftBukkit
|
||||
}
|
||||
|
||||
this.chunks.put(LongHash.toLong(i, j), chunk); // CraftBukkit
|
||||
chunk.addEntities();
|
||||
|
||||
// CraftBukkit start
|
||||
if (server != null) {
|
||||
/*
|
||||
* If it's a new world, the first few chunks are generated inside
|
||||
* the World constructor. We can't reliably alter that, so we have
|
||||
* no way of creating a CraftWorld/CraftServer at that point.
|
||||
*/
|
||||
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, newChunk));
|
||||
}
|
||||
|
||||
// Update neighbor counts
|
||||
for (int x = -2; x < 3; x++) {
|
||||
for (int z = -2; z < 3; z++) {
|
||||
if (x == 0 && z == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborLoaded(-x, -z);
|
||||
chunk.setNeighborLoaded(x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
chunk.loadNearby(this, this, i, j);
|
||||
world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
|
||||
}
|
||||
|
||||
return chunk;
|
||||
}
|
||||
|
||||
public Chunk getOrCreateChunk(int i, int j) {
|
||||
// CraftBukkit start
|
||||
Chunk chunk = (Chunk) this.chunks.get(LongHash.toLong(i, j));
|
||||
|
||||
chunk = chunk == null ? (!this.world.isLoading && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk;
|
||||
if (chunk == this.emptyChunk) return chunk;
|
||||
if (i != chunk.locX || j != chunk.locZ) {
|
||||
b.error("Chunk (" + chunk.locX + ", " + chunk.locZ + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'");
|
||||
b.error(chunk.getClass().getName());
|
||||
Throwable ex = new Throwable();
|
||||
ex.fillInStackTrace();
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return chunk;
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public Chunk loadChunk(int i, int j) { // CraftBukkit - private -> public
|
||||
if (this.f == null) {
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
Chunk chunk = this.f.a(this.world, i, j);
|
||||
|
||||
if (chunk != null) {
|
||||
chunk.lastSaved = this.world.getTime();
|
||||
if (this.chunkProvider != null) {
|
||||
world.timings.syncChunkLoadStructuresTimer.startTiming(); // Spigot
|
||||
this.chunkProvider.recreateStructures(i, j);
|
||||
world.timings.syncChunkLoadStructuresTimer.stopTiming(); // Spigot
|
||||
}
|
||||
}
|
||||
|
||||
return chunk;
|
||||
} catch (Exception exception) {
|
||||
b.error("Couldn\'t load chunk", exception);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void saveChunkNOP(Chunk chunk) { // CraftBukkit - private -> public
|
||||
if (this.f != null) {
|
||||
try {
|
||||
this.f.b(this.world, chunk);
|
||||
} catch (Exception exception) {
|
||||
b.error("Couldn\'t save entities", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void saveChunk(Chunk chunk) { // CraftBukkit - private -> public
|
||||
if (this.f != null) {
|
||||
try {
|
||||
chunk.lastSaved = this.world.getTime();
|
||||
this.f.a(this.world, chunk);
|
||||
// CraftBukkit start - IOException to Exception
|
||||
} catch (Exception ioexception) {
|
||||
b.error("Couldn\'t save chunk", ioexception);
|
||||
/* Remove extra exception
|
||||
} catch (ExceptionWorldConflict exceptionworldconflict) {
|
||||
b.error("Couldn\'t save chunk; already in use by another instance of Minecraft?", exceptionworldconflict);
|
||||
// CraftBukkit end */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void getChunkAt(IChunkProvider ichunkprovider, int i, int j) {
|
||||
Chunk chunk = this.getOrCreateChunk(i, j);
|
||||
|
||||
if (!chunk.done) {
|
||||
chunk.p();
|
||||
if (this.chunkProvider != null) {
|
||||
this.chunkProvider.getChunkAt(ichunkprovider, i, j);
|
||||
|
||||
// CraftBukkit start
|
||||
BlockSand.instaFall = true;
|
||||
Random random = new Random();
|
||||
random.setSeed(world.getSeed());
|
||||
long xRand = random.nextLong() / 2L * 2L + 1L;
|
||||
long zRand = random.nextLong() / 2L * 2L + 1L;
|
||||
random.setSeed((long) i * xRand + (long) j * zRand ^ world.getSeed());
|
||||
|
||||
org.bukkit.World world = this.world.getWorld();
|
||||
if (world != null) {
|
||||
this.world.populating = true;
|
||||
try {
|
||||
for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) {
|
||||
populator.populate(world, random, chunk.bukkitChunk);
|
||||
}
|
||||
} finally {
|
||||
this.world.populating = false;
|
||||
}
|
||||
}
|
||||
BlockSand.instaFall = false;
|
||||
this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(chunk.bukkitChunk));
|
||||
// CraftBukkit end
|
||||
|
||||
chunk.e();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) {
|
||||
int i = 0;
|
||||
// CraftBukkit start
|
||||
Iterator iterator = this.chunks.values().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Chunk chunk = (Chunk) iterator.next();
|
||||
// CraftBukkit end
|
||||
|
||||
if (flag) {
|
||||
this.saveChunkNOP(chunk);
|
||||
}
|
||||
|
||||
if (chunk.a(flag)) {
|
||||
this.saveChunk(chunk);
|
||||
chunk.n = false;
|
||||
++i;
|
||||
if (i == 24 && !flag) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void c() {
|
||||
if (this.f != null) {
|
||||
this.f.b();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean unloadChunks() {
|
||||
if (!this.world.savingDisabled) {
|
||||
// CraftBukkit start
|
||||
Server server = this.world.getServer();
|
||||
for (int i = 0; i < 100 && !this.unloadQueue.isEmpty(); i++) {
|
||||
long chunkcoordinates = this.unloadQueue.popFirst();
|
||||
Chunk chunk = this.chunks.get(chunkcoordinates);
|
||||
if (chunk == null) continue;
|
||||
|
||||
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
if (chunk != null) {
|
||||
chunk.removeEntities();
|
||||
this.saveChunk(chunk);
|
||||
this.saveChunkNOP(chunk);
|
||||
this.chunks.remove(chunkcoordinates); // CraftBukkit
|
||||
}
|
||||
|
||||
// this.unloadQueue.remove(olong);
|
||||
// this.chunks.remove(olong.longValue());
|
||||
|
||||
// Update neighbor counts
|
||||
for (int x = -2; x < 3; x++) {
|
||||
for (int z = -2; z < 3; z++) {
|
||||
if (x == 0 && z == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborUnloaded(-x, -z);
|
||||
chunk.setNeighborUnloaded(x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.f != null) {
|
||||
this.f.a();
|
||||
}
|
||||
}
|
||||
|
||||
return this.chunkProvider.unloadChunks();
|
||||
}
|
||||
|
||||
public boolean canSave() {
|
||||
return !this.world.savingDisabled;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
// CraftBukkit - this.chunks.count() -> .values().size()
|
||||
return "ServerChunkCache: " + this.chunks.values().size() + " Drop: " + this.unloadQueue.size();
|
||||
}
|
||||
|
||||
public List getMobsFor(EnumCreatureType enumcreaturetype, int i, int j, int k) {
|
||||
return this.chunkProvider.getMobsFor(enumcreaturetype, i, j, k);
|
||||
}
|
||||
|
||||
public ChunkPosition findNearestMapFeature(World world, String s, int i, int j, int k) {
|
||||
return this.chunkProvider.findNearestMapFeature(world, s, i, j, k);
|
||||
}
|
||||
|
||||
public int getLoadedChunks() {
|
||||
// CraftBukkit - this.chunks.count() -> this.chunks.size()
|
||||
return this.chunks.size();
|
||||
}
|
||||
|
||||
public void recreateStructures(int i, int j) {}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.List;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftHumanEntity;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
// CraftBukkit end
|
||||
|
||||
public class ContainerAnvilInventory extends InventorySubcontainer { // CraftBukkit - public
|
||||
|
||||
final ContainerAnvil a;
|
||||
|
||||
// CraftBukkit start
|
||||
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||
public org.bukkit.entity.Player player;
|
||||
private int maxStack = MAX_STACK;
|
||||
|
||||
public ItemStack[] getContents() {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
public void onOpen(CraftHumanEntity who) {
|
||||
transaction.add(who);
|
||||
}
|
||||
|
||||
public void onClose(CraftHumanEntity who) {
|
||||
transaction.remove(who);
|
||||
}
|
||||
|
||||
public List<HumanEntity> getViewers() {
|
||||
return transaction;
|
||||
}
|
||||
|
||||
public org.bukkit.inventory.InventoryHolder getOwner() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
public void setMaxStackSize(int size) {
|
||||
maxStack = size;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public ContainerAnvilInventory(ContainerAnvil containeranvil, String s, boolean flag, int i) {
|
||||
super(s, flag, i);
|
||||
this.a = containeranvil;
|
||||
}
|
||||
|
||||
// CraftBukkit start - override inherited maxStack from InventorySubcontainer
|
||||
public int getMaxStackSize() {
|
||||
return maxStack;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public void update() {
|
||||
super.update();
|
||||
this.a.a((IInventory) this);
|
||||
}
|
||||
}
|
@ -1,512 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.PrintStream;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Proxy;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Handler;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.core.Appender;
|
||||
import org.apache.logging.log4j.core.appender.ConsoleAppender;
|
||||
import org.bukkit.craftbukkit.libs.joptsimple.OptionSet;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.LoggerOutputStream;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.SpigotTimings;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.command.CraftRemoteConsoleCommandSender;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.util.ForwardLogHandler;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.util.TerminalConsoleWriterThread;
|
||||
import org.bukkit.event.server.ServerCommandEvent;
|
||||
import org.bukkit.plugin.PluginLoadOrder;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.spigotmc.CustomTimingsHandler;
|
||||
import org.spigotmc.SpigotConfig;
|
||||
|
||||
public class DedicatedServer
|
||||
extends MinecraftServer
|
||||
implements IMinecraftServer
|
||||
{
|
||||
private static final org.apache.logging.log4j.Logger logger = LogManager.getLogger();
|
||||
private final List j = Collections.synchronizedList(new ArrayList());
|
||||
private RemoteStatusListener k;
|
||||
private RemoteControlListener l;
|
||||
public PropertyManager propertyManager;
|
||||
private boolean generateStructures;
|
||||
private EnumGamemode p;
|
||||
private boolean q;
|
||||
|
||||
public DedicatedServer(OptionSet options)
|
||||
{
|
||||
super(options, Proxy.NO_PROXY);
|
||||
|
||||
|
||||
new ThreadSleepForever(this, "Server Infinisleeper");
|
||||
}
|
||||
|
||||
protected boolean init()
|
||||
throws UnknownHostException
|
||||
{
|
||||
ThreadCommandReader threadcommandreader = new ThreadCommandReader(this, "Server console handler");
|
||||
|
||||
threadcommandreader.setDaemon(true);
|
||||
threadcommandreader.start();
|
||||
|
||||
|
||||
java.util.logging.Logger global = java.util.logging.Logger.getLogger("");
|
||||
global.setUseParentHandlers(false);
|
||||
for (Handler handler : global.getHandlers()) {
|
||||
global.removeHandler(handler);
|
||||
}
|
||||
global.addHandler(new ForwardLogHandler());
|
||||
|
||||
org.apache.logging.log4j.core.Logger logger = (org.apache.logging.log4j.core.Logger)LogManager.getRootLogger();
|
||||
for (Appender appender : logger.getAppenders().values()) {
|
||||
if ((appender instanceof ConsoleAppender)) {
|
||||
logger.removeAppender(appender);
|
||||
}
|
||||
}
|
||||
new Thread(new TerminalConsoleWriterThread(System.out, this.reader)).start();
|
||||
|
||||
System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true));
|
||||
System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true));
|
||||
|
||||
|
||||
logger.info("Starting minecraft server version 1.7.10");
|
||||
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
|
||||
logger.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
|
||||
}
|
||||
logger.info("Loading properties");
|
||||
this.propertyManager = new PropertyManager(this.options);
|
||||
|
||||
if (N())
|
||||
{
|
||||
c("127.0.0.1");
|
||||
}
|
||||
else
|
||||
{
|
||||
setOnlineMode(this.propertyManager.getBoolean("online-mode", true));
|
||||
c(this.propertyManager.getString("server-ip", ""));
|
||||
}
|
||||
setSpawnAnimals(this.propertyManager.getBoolean("spawn-animals", true));
|
||||
setSpawnNPCs(this.propertyManager.getBoolean("spawn-npcs", true));
|
||||
setPvP(this.propertyManager.getBoolean("pvp", true));
|
||||
setAllowFlight(this.propertyManager.getBoolean("allow-flight", false));
|
||||
setTexturePack(this.propertyManager.getString("resource-pack", ""));
|
||||
setMotd(this.propertyManager.getString("motd", "A Minecraft Server"));
|
||||
setForceGamemode(this.propertyManager.getBoolean("force-gamemode", false));
|
||||
setIdleTimeout(this.propertyManager.getInt("player-idle-timeout", 0));
|
||||
if (this.propertyManager.getInt("difficulty", 1) < 0) {
|
||||
this.propertyManager.setProperty("difficulty", Integer.valueOf(0));
|
||||
} else if (this.propertyManager.getInt("difficulty", 1) > 3) {
|
||||
this.propertyManager.setProperty("difficulty", Integer.valueOf(3));
|
||||
}
|
||||
this.generateStructures = this.propertyManager.getBoolean("generate-structures", true);
|
||||
int gamemode = this.propertyManager.getInt("gamemode", EnumGamemode.SURVIVAL.getId());
|
||||
|
||||
this.p = WorldSettings.a(gamemode);
|
||||
logger.info("Default game type: " + this.p);
|
||||
InetAddress inetaddress = null;
|
||||
if (getServerIp().length() > 0) {
|
||||
inetaddress = InetAddress.getByName(getServerIp());
|
||||
}
|
||||
if (L() < 0) {
|
||||
setPort(this.propertyManager.getInt("server-port", 25565));
|
||||
}
|
||||
a(new DedicatedPlayerList(this));
|
||||
SpigotConfig.init();
|
||||
SpigotConfig.registerCommands();
|
||||
|
||||
|
||||
logger.info("Generating keypair");
|
||||
a(MinecraftEncryption.b());
|
||||
logger.info("Starting Minecraft server on " + (getServerIp().length() == 0 ? "*" : getServerIp()) + ":" + L());
|
||||
if (!SpigotConfig.lateBind) {
|
||||
try
|
||||
{
|
||||
ai().a(inetaddress, L());
|
||||
}
|
||||
catch (Throwable ioexception)
|
||||
{
|
||||
logger.warn("**** FAILED TO BIND TO PORT!");
|
||||
logger.warn("The exception was: {}", new Object[] { ioexception.toString() });
|
||||
logger.warn("Perhaps a server is already running on that port?");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
this.server.loadPlugins();
|
||||
this.server.enablePlugins(PluginLoadOrder.STARTUP);
|
||||
if (!getOnlineMode())
|
||||
{
|
||||
logger.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
||||
logger.warn("The server will make no attempt to authenticate usernames. Beware.");
|
||||
logger.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
|
||||
logger.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
|
||||
}
|
||||
if (aE()) {
|
||||
getUserCache().c();
|
||||
}
|
||||
if (!NameReferencingFileConverter.a(this.propertyManager)) {
|
||||
return false;
|
||||
}
|
||||
this.convertable = new WorldLoaderServer(this.server.getWorldContainer());
|
||||
long j = System.nanoTime();
|
||||
if (O() == null) {
|
||||
k(this.propertyManager.getString("level-name", "world"));
|
||||
}
|
||||
String s = this.propertyManager.getString("level-seed", "");
|
||||
String s1 = this.propertyManager.getString("level-type", "DEFAULT");
|
||||
String s2 = this.propertyManager.getString("generator-settings", "");
|
||||
long k = new Random().nextLong();
|
||||
if (s.length() > 0) {
|
||||
try
|
||||
{
|
||||
long l = Long.parseLong(s);
|
||||
if (l != 0L) {
|
||||
k = l;
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException numberformatexception)
|
||||
{
|
||||
k = s.hashCode();
|
||||
}
|
||||
}
|
||||
WorldType worldtype = WorldType.getType(s1);
|
||||
if (worldtype == null) {
|
||||
worldtype = WorldType.NORMAL;
|
||||
}
|
||||
at();
|
||||
getEnableCommandBlock();
|
||||
l();
|
||||
getSnooperEnabled();
|
||||
c(this.propertyManager.getInt("max-build-height", 256));
|
||||
c((getMaxBuildHeight() + 8) / 16 * 16);
|
||||
c(MathHelper.a(getMaxBuildHeight(), 64, 256));
|
||||
this.propertyManager.setProperty("max-build-height", Integer.valueOf(getMaxBuildHeight()));
|
||||
logger.info("Preparing level \"" + O() + "\"");
|
||||
a(O(), O(), k, worldtype, s2);
|
||||
long i1 = System.nanoTime() - j;
|
||||
String s3 = String.format("%.3fs", new Object[] { Double.valueOf(i1 / 1000000000.0D) });
|
||||
|
||||
logger.info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
|
||||
if (this.propertyManager.getBoolean("enable-query", false))
|
||||
{
|
||||
logger.info("Starting GS4 status listener");
|
||||
this.k = new RemoteStatusListener(this);
|
||||
this.k.a();
|
||||
}
|
||||
if (this.propertyManager.getBoolean("enable-rcon", false))
|
||||
{
|
||||
logger.info("Starting remote control listener");
|
||||
this.l = new RemoteControlListener(this);
|
||||
this.l.a();
|
||||
this.remoteConsole = new CraftRemoteConsoleCommandSender();
|
||||
}
|
||||
if (this.server.getBukkitSpawnRadius() > -1)
|
||||
{
|
||||
logger.info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you.");
|
||||
this.propertyManager.properties.remove("spawn-protection");
|
||||
this.propertyManager.getInt("spawn-protection", this.server.getBukkitSpawnRadius());
|
||||
this.server.removeBukkitSpawnRadius();
|
||||
this.propertyManager.savePropertiesFile();
|
||||
}
|
||||
if (SpigotConfig.lateBind) {
|
||||
try
|
||||
{
|
||||
ai().a(inetaddress, L());
|
||||
}
|
||||
catch (Throwable ioexception)
|
||||
{
|
||||
logger.warn("**** FAILED TO BIND TO PORT!");
|
||||
logger.warn("The exception was: {}", new Object[] { ioexception.toString() });
|
||||
logger.warn("Perhaps a server is already running on that port?");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public PropertyManager getPropertyManager()
|
||||
{
|
||||
return this.propertyManager;
|
||||
}
|
||||
|
||||
public boolean getGenerateStructures()
|
||||
{
|
||||
return this.generateStructures;
|
||||
}
|
||||
|
||||
public EnumGamemode getGamemode()
|
||||
{
|
||||
return this.p;
|
||||
}
|
||||
|
||||
public EnumDifficulty getDifficulty()
|
||||
{
|
||||
return EnumDifficulty.getById(this.propertyManager.getInt("difficulty", 1));
|
||||
}
|
||||
|
||||
public boolean isHardcore()
|
||||
{
|
||||
return this.propertyManager.getBoolean("hardcore", false);
|
||||
}
|
||||
|
||||
protected void a(CrashReport crashreport) {}
|
||||
|
||||
public CrashReport b(CrashReport crashreport)
|
||||
{
|
||||
crashreport = super.b(crashreport);
|
||||
crashreport.g().a("Is Modded", new CrashReportModded(this));
|
||||
crashreport.g().a("Type", new CrashReportType(this));
|
||||
return crashreport;
|
||||
}
|
||||
|
||||
protected void t()
|
||||
{
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void v()
|
||||
{
|
||||
super.v();
|
||||
aB();
|
||||
}
|
||||
|
||||
public boolean getAllowNether()
|
||||
{
|
||||
return this.propertyManager.getBoolean("allow-nether", true);
|
||||
}
|
||||
|
||||
public boolean getSpawnMonsters()
|
||||
{
|
||||
return this.propertyManager.getBoolean("spawn-monsters", true);
|
||||
}
|
||||
|
||||
public void a(MojangStatisticsGenerator mojangstatisticsgenerator)
|
||||
{
|
||||
mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(aC().getHasWhitelist()));
|
||||
mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(aC().getWhitelisted().length));
|
||||
super.a(mojangstatisticsgenerator);
|
||||
}
|
||||
|
||||
public boolean getSnooperEnabled()
|
||||
{
|
||||
return this.propertyManager.getBoolean("snooper-enabled", true);
|
||||
}
|
||||
|
||||
public void issueCommand(String s, ICommandListener icommandlistener)
|
||||
{
|
||||
this.j.add(new ServerCommand(s, icommandlistener));
|
||||
}
|
||||
|
||||
public void aB()
|
||||
{
|
||||
SpigotTimings.serverCommandTimer.startTiming();
|
||||
while (!this.j.isEmpty())
|
||||
{
|
||||
ServerCommand servercommand = (ServerCommand)this.j.remove(0);
|
||||
|
||||
|
||||
ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command);
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
servercommand = new ServerCommand(event.getCommand(), servercommand.source);
|
||||
|
||||
|
||||
this.server.dispatchServerCommand(this.console, servercommand);
|
||||
}
|
||||
SpigotTimings.serverCommandTimer.stopTiming();
|
||||
}
|
||||
|
||||
public boolean X()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public DedicatedPlayerList aC()
|
||||
{
|
||||
return (DedicatedPlayerList)super.getPlayerList();
|
||||
}
|
||||
|
||||
public int a(String s, int i)
|
||||
{
|
||||
return this.propertyManager.getInt(s, i);
|
||||
}
|
||||
|
||||
public String a(String s, String s1)
|
||||
{
|
||||
return this.propertyManager.getString(s, s1);
|
||||
}
|
||||
|
||||
public boolean a(String s, boolean flag)
|
||||
{
|
||||
return this.propertyManager.getBoolean(s, flag);
|
||||
}
|
||||
|
||||
public void a(String s, Object object)
|
||||
{
|
||||
this.propertyManager.setProperty(s, object);
|
||||
}
|
||||
|
||||
public void a()
|
||||
{
|
||||
this.propertyManager.savePropertiesFile();
|
||||
}
|
||||
|
||||
public String b()
|
||||
{
|
||||
File file1 = this.propertyManager.c();
|
||||
|
||||
return file1 != null ? file1.getAbsolutePath() : "No settings file";
|
||||
}
|
||||
|
||||
public void aD()
|
||||
{
|
||||
ServerGUI.a(this);
|
||||
this.q = true;
|
||||
}
|
||||
|
||||
public boolean ak()
|
||||
{
|
||||
return this.q;
|
||||
}
|
||||
|
||||
public String a(EnumGamemode enumgamemode, boolean flag)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean getEnableCommandBlock()
|
||||
{
|
||||
return this.propertyManager.getBoolean("enable-command-block", false);
|
||||
}
|
||||
|
||||
public int getSpawnProtection()
|
||||
{
|
||||
return this.propertyManager.getInt("spawn-protection", super.getSpawnProtection());
|
||||
}
|
||||
|
||||
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman)
|
||||
{
|
||||
if (world.worldProvider.dimension != 0) {
|
||||
return false;
|
||||
}
|
||||
if (aC().getOPs().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (aC().isOp(entityhuman.getProfile())) {
|
||||
return false;
|
||||
}
|
||||
if (getSpawnProtection() <= 0) {
|
||||
return false;
|
||||
}
|
||||
ChunkCoordinates chunkcoordinates = world.getSpawn();
|
||||
int l = MathHelper.a(i - chunkcoordinates.x);
|
||||
int i1 = MathHelper.a(k - chunkcoordinates.z);
|
||||
int j1 = Math.max(l, i1);
|
||||
|
||||
return j1 <= getSpawnProtection();
|
||||
}
|
||||
|
||||
public int l()
|
||||
{
|
||||
return this.propertyManager.getInt("op-permission-level", 4);
|
||||
}
|
||||
|
||||
public void setIdleTimeout(int i)
|
||||
{
|
||||
super.setIdleTimeout(i);
|
||||
this.propertyManager.setProperty("player-idle-timeout", Integer.valueOf(i));
|
||||
a();
|
||||
}
|
||||
|
||||
public boolean m()
|
||||
{
|
||||
return this.propertyManager.getBoolean("broadcast-rcon-to-ops", true);
|
||||
}
|
||||
|
||||
public boolean at()
|
||||
{
|
||||
return this.propertyManager.getBoolean("announce-player-achievements", true);
|
||||
}
|
||||
|
||||
protected boolean aE()
|
||||
{
|
||||
this.server.getLogger().info("**** Beginning UUID conversion, this may take A LONG time ****");
|
||||
boolean flag = false;
|
||||
for (int i = 0; (!flag) && (i <= 2); i++)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
logger.warn("Encountered a problem while converting the user banlist, retrying in a few seconds");
|
||||
aG();
|
||||
}
|
||||
flag = NameReferencingFileConverter.a(this);
|
||||
}
|
||||
boolean flag1 = false;
|
||||
for (int i = 0; (!flag1) && (i <= 2); i++)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
logger.warn("Encountered a problem while converting the ip banlist, retrying in a few seconds");
|
||||
aG();
|
||||
}
|
||||
flag1 = NameReferencingFileConverter.b(this);
|
||||
}
|
||||
boolean flag2 = false;
|
||||
for (int i = 0; (!flag2) && (i <= 2); i++)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
logger.warn("Encountered a problem while converting the op list, retrying in a few seconds");
|
||||
aG();
|
||||
}
|
||||
flag2 = NameReferencingFileConverter.c(this);
|
||||
}
|
||||
boolean flag3 = false;
|
||||
for (int i = 0; (!flag3) && (i <= 2); i++)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
logger.warn("Encountered a problem while converting the whitelist, retrying in a few seconds");
|
||||
aG();
|
||||
}
|
||||
flag3 = NameReferencingFileConverter.d(this);
|
||||
}
|
||||
boolean flag4 = false;
|
||||
for (int i = 0; (!flag4) && (i <= 2); i++)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
logger.warn("Encountered a problem while converting the player save files, retrying in a few seconds");
|
||||
aG();
|
||||
}
|
||||
flag4 = NameReferencingFileConverter.a(this, this.propertyManager);
|
||||
}
|
||||
return (flag) || (flag1) || (flag2) || (flag3) || (flag4);
|
||||
}
|
||||
|
||||
private void aG()
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep(5000L);
|
||||
}
|
||||
catch (InterruptedException interruptedexception) {}
|
||||
}
|
||||
|
||||
public PlayerList getPlayerList()
|
||||
{
|
||||
return aC();
|
||||
}
|
||||
|
||||
static org.apache.logging.log4j.Logger aF()
|
||||
{
|
||||
return logger;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,251 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
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);
|
||||
setAsleep(true);
|
||||
}
|
||||
|
||||
protected void c()
|
||||
{
|
||||
super.c();
|
||||
|
||||
this.datawatcher.a(16, new Byte((byte) 0));
|
||||
}
|
||||
|
||||
protected float bf()
|
||||
{
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
protected float bg()
|
||||
{
|
||||
return super.bg() * 0.95F;
|
||||
}
|
||||
|
||||
protected String t()
|
||||
{
|
||||
if ((isAsleep()) && (this.random.nextInt(4) != 0))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return "mob.bat.idle";
|
||||
}
|
||||
|
||||
protected String aT()
|
||||
{
|
||||
return "mob.bat.hurt";
|
||||
}
|
||||
|
||||
protected String aU()
|
||||
{
|
||||
return "mob.bat.death";
|
||||
}
|
||||
|
||||
public boolean S()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void o(Entity paramEntity)
|
||||
{
|
||||
}
|
||||
|
||||
protected void bo()
|
||||
{
|
||||
}
|
||||
|
||||
protected void aD()
|
||||
{
|
||||
super.aD();
|
||||
|
||||
getAttributeInstance(GenericAttributes.maxHealth).setValue(6.0D);
|
||||
}
|
||||
|
||||
public boolean isAsleep()
|
||||
{
|
||||
return (this.datawatcher.getByte(16) & 0x1) != 0;
|
||||
}
|
||||
|
||||
public void setAsleep(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 bk()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void h()
|
||||
{
|
||||
super.h();
|
||||
|
||||
if (Vegetated)
|
||||
return;
|
||||
|
||||
if (isAsleep())
|
||||
{
|
||||
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 bn()
|
||||
{
|
||||
super.bn();
|
||||
|
||||
if (Vegetated)
|
||||
return;
|
||||
|
||||
if (isAsleep())
|
||||
{
|
||||
if (!this.world.getType(MathHelper.floor(this.locX), (int) this.locY + 1, MathHelper.floor(this.locZ)).r())
|
||||
{
|
||||
setAsleep(false);
|
||||
this.world.a(null, 1015, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.random.nextInt(200) == 0)
|
||||
{
|
||||
this.aO = this.random.nextInt(360);
|
||||
}
|
||||
if (this.world.findNearbyPlayer(this, 4.0D) != null)
|
||||
{
|
||||
setAsleep(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.be = 0.5F;
|
||||
this.yaw += f2;
|
||||
if ((this.random.nextInt(100) == 0)
|
||||
&& (this.world.getType(MathHelper.floor(this.locX), (int) this.locY + 1,
|
||||
MathHelper.floor(this.locZ)).r()))
|
||||
{
|
||||
setAsleep(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean g_()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void b(float paramFloat)
|
||||
{
|
||||
}
|
||||
|
||||
protected void a(double paramDouble, boolean paramBoolean)
|
||||
{
|
||||
}
|
||||
|
||||
public boolean az()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource paramDamageSource, float paramFloat)
|
||||
{
|
||||
if (isInvulnerable())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ((!this.world.isStatic) && (isAsleep()) && !Vegetated)
|
||||
{
|
||||
setAsleep(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.V();
|
||||
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();
|
||||
}
|
||||
}
|
@ -1,192 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class EntityBlaze extends EntityMonster
|
||||
{
|
||||
private float bp = 0.5F;
|
||||
private int bq;
|
||||
private int br;
|
||||
|
||||
public EntityBlaze(World paramWorld)
|
||||
{
|
||||
super(paramWorld);
|
||||
|
||||
this.fireProof = true;
|
||||
this.b = 10;
|
||||
}
|
||||
|
||||
protected void aD()
|
||||
{
|
||||
super.aD();
|
||||
getAttributeInstance(GenericAttributes.e).setValue(6.0D);
|
||||
}
|
||||
|
||||
protected void c()
|
||||
{
|
||||
super.c();
|
||||
|
||||
this.datawatcher.a(16, new Byte((byte) 0));
|
||||
}
|
||||
|
||||
protected String t()
|
||||
{
|
||||
return "mob.blaze.breathe";
|
||||
}
|
||||
|
||||
protected String aT()
|
||||
{
|
||||
return "mob.blaze.hit";
|
||||
}
|
||||
|
||||
protected String aU()
|
||||
{
|
||||
return "mob.blaze.death";
|
||||
}
|
||||
|
||||
public float d(float paramFloat)
|
||||
{
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
public void e()
|
||||
{
|
||||
if (!this.world.isStatic)
|
||||
{
|
||||
if (L())
|
||||
{
|
||||
damageEntity(DamageSource.DROWN, 1.0F);
|
||||
}
|
||||
this.bq -= 1;
|
||||
if (this.bq <= 0)
|
||||
{
|
||||
this.bq = 100;
|
||||
this.bp = (0.5F + (float) this.random.nextGaussian() * 3.0F);
|
||||
}
|
||||
if ((bT() != null) && (bT().locY + bT().getHeadHeight() > this.locY + getHeadHeight() + this.bp))
|
||||
{
|
||||
this.motY += (0.300000011920929D - this.motY) * 0.300000011920929D;
|
||||
}
|
||||
}
|
||||
if (this.random.nextInt(24) == 0)
|
||||
{
|
||||
this.world.makeSound(this.locX + 0.5D, this.locY + 0.5D, this.locZ + 0.5D, "fire.fire",
|
||||
1.0F + this.random.nextFloat(), this.random.nextFloat() * 0.7F + 0.3F);
|
||||
}
|
||||
if (!Vegetated && (!this.onGround) && (this.motY < 0.0D))
|
||||
{
|
||||
this.motY *= 0.6D;
|
||||
}
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
this.world.addParticle("largesmoke", this.locX + (this.random.nextDouble() - 0.5D) * this.width, this.locY
|
||||
+ this.random.nextDouble() * this.length, this.locZ + (this.random.nextDouble() - 0.5D)
|
||||
* this.width, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
super.e();
|
||||
}
|
||||
|
||||
protected void a(Entity paramEntity, float paramFloat)
|
||||
{
|
||||
if (Vegetated)
|
||||
return;
|
||||
|
||||
if ((this.attackTicks <= 0) && (paramFloat < 2.0F) && (paramEntity.boundingBox.e > this.boundingBox.b)
|
||||
&& (paramEntity.boundingBox.b < this.boundingBox.e))
|
||||
{
|
||||
this.attackTicks = 20;
|
||||
n(paramEntity);
|
||||
}
|
||||
else if (paramFloat < 30.0F)
|
||||
{
|
||||
double d1 = paramEntity.locX - this.locX;
|
||||
double d2 = paramEntity.boundingBox.b + paramEntity.length / 2.0F - (this.locY + this.length / 2.0F);
|
||||
double d3 = paramEntity.locZ - this.locZ;
|
||||
if (this.attackTicks == 0)
|
||||
{
|
||||
this.br += 1;
|
||||
if (this.br == 1)
|
||||
{
|
||||
this.attackTicks = 60;
|
||||
a(true);
|
||||
}
|
||||
else if (this.br <= 4)
|
||||
{
|
||||
this.attackTicks = 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.attackTicks = 100;
|
||||
this.br = 0;
|
||||
a(false);
|
||||
}
|
||||
if (this.br > 1)
|
||||
{
|
||||
float f = MathHelper.c(paramFloat) * 0.5F;
|
||||
|
||||
this.world.a(null, 1009, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
EntitySmallFireball localEntitySmallFireball = new EntitySmallFireball(this.world, this, d1
|
||||
+ this.random.nextGaussian() * f, d2, d3 + this.random.nextGaussian() * f);
|
||||
localEntitySmallFireball.locY = (this.locY + this.length / 2.0F + 0.5D);
|
||||
this.world.addEntity(localEntitySmallFireball);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.yaw = ((float) (Math.atan2(d3, d1) * 180.0D / 3.141592741012573D) - 90.0F);
|
||||
|
||||
this.bn = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected void b(float paramFloat)
|
||||
{
|
||||
}
|
||||
|
||||
protected Item getLoot()
|
||||
{
|
||||
return Items.BLAZE_ROD;
|
||||
}
|
||||
|
||||
public boolean isBurning()
|
||||
{
|
||||
return bZ();
|
||||
}
|
||||
|
||||
protected void dropDeathLoot(boolean paramBoolean, int paramInt)
|
||||
{
|
||||
if (paramBoolean)
|
||||
{
|
||||
int i = this.random.nextInt(2 + paramInt);
|
||||
for (int j = 0; j < i; j++)
|
||||
{
|
||||
a(Items.BLAZE_ROD, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean bZ()
|
||||
{
|
||||
return (this.datawatcher.getByte(16) & 0x1) != 0;
|
||||
}
|
||||
|
||||
public void a(boolean paramBoolean)
|
||||
{
|
||||
byte b = this.datawatcher.getByte(16);
|
||||
if (paramBoolean)
|
||||
{
|
||||
b = (byte) (b | 0x1);
|
||||
}
|
||||
else
|
||||
{
|
||||
b = (byte) (b & 0xFFFFFFFE);
|
||||
}
|
||||
this.datawatcher.watch(16, Byte.valueOf(b));
|
||||
}
|
||||
|
||||
protected boolean j_()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,698 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.util.BlockStateListPopulator;
|
||||
import org.bukkit.event.entity.EntityCreatePortalEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityEnderDragon extends EntityInsentient implements IComplex, IMonster {
|
||||
|
||||
public double h;
|
||||
public double i;
|
||||
public double bm;
|
||||
public double[][] bn = new double[64][3];
|
||||
public int bo = -1;
|
||||
public EntityComplexPart[] children;
|
||||
public EntityComplexPart bq;
|
||||
public EntityComplexPart br;
|
||||
public EntityComplexPart bs;
|
||||
public EntityComplexPart bt;
|
||||
public EntityComplexPart bu;
|
||||
public EntityComplexPart bv;
|
||||
public EntityComplexPart bw;
|
||||
public float bx;
|
||||
public float by;
|
||||
public boolean bz;
|
||||
public boolean bA;
|
||||
private Entity bD;
|
||||
public int bB;
|
||||
public EntityEnderCrystal bC;
|
||||
private Explosion explosionSource = new Explosion(null, this, Double.NaN, Double.NaN, Double.NaN, Float.NaN); // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
|
||||
|
||||
public boolean Vegetated = false;
|
||||
|
||||
public EntityEnderDragon(World world) {
|
||||
super(world);
|
||||
this.children = new EntityComplexPart[] { this.bq = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.br = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.bs = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bt = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bu = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bv = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bw = new EntityComplexPart(this, "wing", 4.0F, 4.0F)};
|
||||
this.setHealth(this.getMaxHealth());
|
||||
this.a(16.0F, 8.0F);
|
||||
this.X = true;
|
||||
this.fireProof = true;
|
||||
this.i = 100.0D;
|
||||
this.ak = true;
|
||||
}
|
||||
|
||||
protected void aD() {
|
||||
super.aD();
|
||||
this.getAttributeInstance(GenericAttributes.maxHealth).setValue(200.0D);
|
||||
}
|
||||
|
||||
protected void c() {
|
||||
super.c();
|
||||
}
|
||||
|
||||
public double[] b(int i, float f) {
|
||||
if (this.getHealth() <= 0.0F) {
|
||||
f = 0.0F;
|
||||
}
|
||||
|
||||
f = 1.0F - f;
|
||||
int j = this.bo - i * 1 & 63;
|
||||
int k = this.bo - i * 1 - 1 & 63;
|
||||
double[] adouble = new double[3];
|
||||
double d0 = this.bn[j][0];
|
||||
double d1 = MathHelper.g(this.bn[k][0] - d0);
|
||||
|
||||
adouble[0] = d0 + d1 * (double) f;
|
||||
d0 = this.bn[j][1];
|
||||
d1 = this.bn[k][1] - d0;
|
||||
adouble[1] = d0 + d1 * (double) f;
|
||||
adouble[2] = this.bn[j][2] + (this.bn[k][2] - this.bn[j][2]) * (double) f;
|
||||
return adouble;
|
||||
}
|
||||
|
||||
public void e() {
|
||||
float f;
|
||||
float f1;
|
||||
|
||||
if (this.world.isStatic) {
|
||||
f = MathHelper.cos(this.by * 3.1415927F * 2.0F);
|
||||
f1 = MathHelper.cos(this.bx * 3.1415927F * 2.0F);
|
||||
if (f1 <= -0.3F && f >= -0.3F) {
|
||||
this.world.a(this.locX, this.locY, this.locZ, "mob.enderdragon.wings", 5.0F, 0.8F + this.random.nextFloat() * 0.3F, false);
|
||||
}
|
||||
}
|
||||
|
||||
this.bx = this.by;
|
||||
float f2;
|
||||
|
||||
if (this.getHealth() <= 0.0F) {
|
||||
f = (this.random.nextFloat() - 0.5F) * 8.0F;
|
||||
f1 = (this.random.nextFloat() - 0.5F) * 4.0F;
|
||||
f2 = (this.random.nextFloat() - 0.5F) * 8.0F;
|
||||
this.world.addParticle("largeexplode", this.locX + (double) f, this.locY + 2.0D + (double) f1, this.locZ + (double) f2, 0.0D, 0.0D, 0.0D);
|
||||
} else {
|
||||
this.bP();
|
||||
f = 0.2F / (MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 10.0F + 1.0F);
|
||||
f *= (float) Math.pow(2.0D, this.motY);
|
||||
if (this.bA) {
|
||||
this.by += f * 0.5F;
|
||||
} else {
|
||||
this.by += f;
|
||||
}
|
||||
|
||||
this.yaw = MathHelper.g(this.yaw);
|
||||
if (this.bo < 0) {
|
||||
for (int d05 = 0; d05 < this.bn.length; ++d05) {
|
||||
this.bn[d05][0] = (double) this.yaw;
|
||||
this.bn[d05][1] = this.locY;
|
||||
}
|
||||
}
|
||||
|
||||
if (++this.bo == this.bn.length) {
|
||||
this.bo = 0;
|
||||
}
|
||||
|
||||
this.bn[this.bo][0] = (double) this.yaw;
|
||||
this.bn[this.bo][1] = this.locY;
|
||||
double d0;
|
||||
double d1;
|
||||
double d2;
|
||||
double d3;
|
||||
float f3;
|
||||
|
||||
if (this.world.isStatic) {
|
||||
if (this.bg > 0) {
|
||||
d0 = this.locX + (this.bh - this.locX) / (double) this.bg;
|
||||
d1 = this.locY + (this.bi - this.locY) / (double) this.bg;
|
||||
d2 = this.locZ + (this.bj - this.locZ) / (double) this.bg;
|
||||
d3 = MathHelper.g(this.bk - (double) this.yaw);
|
||||
this.yaw = (float) ((double) this.yaw + d3 / (double) this.bg);
|
||||
this.pitch = (float) ((double) this.pitch + (this.bl - (double) this.pitch) / (double) this.bg);
|
||||
--this.bg;
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.b(this.yaw, this.pitch);
|
||||
}
|
||||
} else {
|
||||
d0 = this.h - this.locX;
|
||||
d1 = this.i - this.locY;
|
||||
d2 = this.bm - this.locZ;
|
||||
d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
if (this.bD != null) {
|
||||
this.h = this.bD.locX;
|
||||
this.bm = this.bD.locZ;
|
||||
double d4 = this.h - this.locX;
|
||||
double d5 = this.bm - this.locZ;
|
||||
double d6 = Math.sqrt(d4 * d4 + d5 * d5);
|
||||
double d7 = 0.4000000059604645D + d6 / 80.0D - 1.0D;
|
||||
|
||||
if (d7 > 10.0D) {
|
||||
d7 = 10.0D;
|
||||
}
|
||||
|
||||
this.i = this.bD.boundingBox.b + d7;
|
||||
} else {
|
||||
this.h += this.random.nextGaussian() * 2.0D;
|
||||
this.bm += this.random.nextGaussian() * 2.0D;
|
||||
}
|
||||
|
||||
if (!Vegetated && this.bz || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.F) {
|
||||
this.bQ();
|
||||
}
|
||||
|
||||
d1 /= (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
|
||||
f3 = 0.6F;
|
||||
if (d1 < (double) (-f3)) {
|
||||
d1 = (double) (-f3);
|
||||
}
|
||||
|
||||
if (d1 > (double) f3) {
|
||||
d1 = (double) f3;
|
||||
}
|
||||
|
||||
this.motY += d1 * 0.10000000149011612D;
|
||||
this.yaw = MathHelper.g(this.yaw);
|
||||
double d8 = 180.0D - Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D;
|
||||
double d9 = MathHelper.g(d8 - (double) this.yaw);
|
||||
|
||||
if (d9 > 50.0D) {
|
||||
d9 = 50.0D;
|
||||
}
|
||||
|
||||
if (d9 < -50.0D) {
|
||||
d9 = -50.0D;
|
||||
}
|
||||
|
||||
Vec3D vec3d = Vec3D.a(this.h - this.locX, this.i - this.locY, this.bm - this.locZ).a();
|
||||
Vec3D vec3d1 = Vec3D.a((double) MathHelper.sin(this.yaw * 3.1415927F / 180.0F), this.motY, (double) (-MathHelper.cos(this.yaw * 3.1415927F / 180.0F))).a();
|
||||
float f4 = (float) (vec3d1.b(vec3d) + 0.5D) / 1.5F;
|
||||
|
||||
if (f4 < 0.0F) {
|
||||
f4 = 0.0F;
|
||||
}
|
||||
|
||||
this.bf *= 0.8F;
|
||||
float f5 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0F + 1.0F;
|
||||
double d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0D + 1.0D;
|
||||
|
||||
if (d10 > 40.0D) {
|
||||
d10 = 40.0D;
|
||||
}
|
||||
|
||||
this.bf = (float) ((double) this.bf + d9 * (0.699999988079071D / d10 / (double) f5));
|
||||
this.yaw += this.bf * 0.1F;
|
||||
float f6 = (float) (2.0D / (d10 + 1.0D));
|
||||
float f7 = 0.06F;
|
||||
|
||||
this.a(0.0F, -1.0F, f7 * (f4 * f6 + (1.0F - f6)));
|
||||
if (this.bA) {
|
||||
this.move(this.motX * 0.800000011920929D, this.motY * 0.800000011920929D, this.motZ * 0.800000011920929D);
|
||||
} else {
|
||||
this.move(this.motX, this.motY, this.motZ);
|
||||
}
|
||||
|
||||
Vec3D vec3d2 = Vec3D.a(this.motX, this.motY, this.motZ).a();
|
||||
float f8 = (float) (vec3d2.b(vec3d1) + 1.0D) / 2.0F;
|
||||
|
||||
f8 = 0.8F + 0.15F * f8;
|
||||
this.motX *= (double) f8;
|
||||
this.motZ *= (double) f8;
|
||||
this.motY *= 0.9100000262260437D;
|
||||
}
|
||||
|
||||
this.aM = this.yaw;
|
||||
this.bq.width = this.bq.length = 3.0F;
|
||||
this.bs.width = this.bs.length = 2.0F;
|
||||
this.bt.width = this.bt.length = 2.0F;
|
||||
this.bu.width = this.bu.length = 2.0F;
|
||||
this.br.length = 3.0F;
|
||||
this.br.width = 5.0F;
|
||||
this.bv.length = 2.0F;
|
||||
this.bv.width = 4.0F;
|
||||
this.bw.length = 3.0F;
|
||||
this.bw.width = 4.0F;
|
||||
f1 = (float) (this.b(5, 1.0F)[1] - this.b(10, 1.0F)[1]) * 10.0F / 180.0F * 3.1415927F;
|
||||
f2 = MathHelper.cos(f1);
|
||||
float f9 = -MathHelper.sin(f1);
|
||||
float f10 = this.yaw * 3.1415927F / 180.0F;
|
||||
float f11 = MathHelper.sin(f10);
|
||||
float f12 = MathHelper.cos(f10);
|
||||
|
||||
this.br.h();
|
||||
this.br.setPositionRotation(this.locX + (double) (f11 * 0.5F), this.locY, this.locZ - (double) (f12 * 0.5F), 0.0F, 0.0F);
|
||||
this.bv.h();
|
||||
this.bv.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
|
||||
this.bw.h();
|
||||
this.bw.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F);
|
||||
if (!this.world.isStatic && this.hurtTicks == 0 && !ghost) {
|
||||
this.a(this.world.getEntities(this, this.bv.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
|
||||
this.a(this.world.getEntities(this, this.bw.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
|
||||
this.b(this.world.getEntities(this, this.bq.boundingBox.grow(1.0D, 1.0D, 1.0D)));
|
||||
}
|
||||
|
||||
double[] adouble = this.b(5, 1.0F);
|
||||
double[] adouble1 = this.b(0, 1.0F);
|
||||
|
||||
f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bf * 0.01F);
|
||||
float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bf * 0.01F);
|
||||
|
||||
this.bq.h();
|
||||
this.bq.setPositionRotation(this.locX + (double) (f3 * 5.5F * f2), this.locY + (adouble1[1] - adouble[1]) * 1.0D + (double) (f9 * 5.5F), this.locZ - (double) (f13 * 5.5F * f2), 0.0F, 0.0F);
|
||||
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
EntityComplexPart entitycomplexpart = null;
|
||||
|
||||
if (j == 0) {
|
||||
entitycomplexpart = this.bs;
|
||||
}
|
||||
|
||||
if (j == 1) {
|
||||
entitycomplexpart = this.bt;
|
||||
}
|
||||
|
||||
if (j == 2) {
|
||||
entitycomplexpart = this.bu;
|
||||
}
|
||||
|
||||
double[] adouble2 = this.b(12 + j * 2, 1.0F);
|
||||
float f14 = this.yaw * 3.1415927F / 180.0F + this.b(adouble2[0] - adouble[0]) * 3.1415927F / 180.0F * 1.0F;
|
||||
float f15 = MathHelper.sin(f14);
|
||||
float f16 = MathHelper.cos(f14);
|
||||
float f17 = 1.5F;
|
||||
float f18 = (float) (j + 1) * 2.0F;
|
||||
|
||||
entitycomplexpart.h();
|
||||
entitycomplexpart.setPositionRotation(this.locX - (double) ((f11 * f17 + f15 * f18) * f2), this.locY + (adouble2[1] - adouble[1]) * 1.0D - (double) ((f18 + f17) * f9) + 1.5D, this.locZ + (double) ((f12 * f17 + f16 * f18) * f2), 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
this.bA = this.a(this.bq.boundingBox) | this.a(this.br.boundingBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void bP() {
|
||||
if (this.bC != null) {
|
||||
if (this.bC.dead) {
|
||||
if (!this.world.isStatic) {
|
||||
CraftEventFactory.entityDamage = this.bC; // CraftBukkit
|
||||
this.a(this.bq, DamageSource.explosion((Explosion) null), 10.0F);
|
||||
CraftEventFactory.entityDamage = null; // CraftBukkit
|
||||
}
|
||||
|
||||
this.bC = null;
|
||||
} else if (this.ticksLived % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
|
||||
// CraftBukkit start
|
||||
EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1.0D, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
this.setHealth((float) (this.getHealth() + event.getAmount()));
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
if (this.random.nextInt(10) == 0) {
|
||||
float f = 32.0F;
|
||||
List list = this.world.a(EntityEnderCrystal.class, this.boundingBox.grow((double) f, (double) f, (double) f));
|
||||
EntityEnderCrystal entityendercrystal = null;
|
||||
double d0 = Double.MAX_VALUE;
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityEnderCrystal entityendercrystal1 = (EntityEnderCrystal) iterator.next();
|
||||
double d1 = entityendercrystal1.f(this);
|
||||
|
||||
if (d1 < d0) {
|
||||
d0 = d1;
|
||||
entityendercrystal = entityendercrystal1;
|
||||
}
|
||||
}
|
||||
|
||||
this.bC = entityendercrystal;
|
||||
}
|
||||
}
|
||||
|
||||
private void a(List list) {
|
||||
double d0 = (this.br.boundingBox.a + this.br.boundingBox.d) / 2.0D;
|
||||
double d1 = (this.br.boundingBox.c + this.br.boundingBox.f) / 2.0D;
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
if (entity instanceof EntityLiving) {
|
||||
double d2 = entity.locX - d0;
|
||||
double d3 = entity.locZ - d1;
|
||||
double d4 = d2 * d2 + d3 * d3;
|
||||
|
||||
entity.g(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void b(List list) {
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
Entity entity = (Entity) list.get(i);
|
||||
|
||||
if (entity instanceof EntityLiving) {
|
||||
entity.damageEntity(DamageSource.mobAttack(this), 10.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setTargetBlock(int x, int y, int z)
|
||||
{
|
||||
this.h = x;
|
||||
this.i = y;
|
||||
this.bm = z;
|
||||
this.bD = null;
|
||||
}
|
||||
|
||||
public void setTargetEntity(Entity entity)
|
||||
{
|
||||
this.bD = entity;
|
||||
}
|
||||
|
||||
private void bQ() {
|
||||
this.bz = false;
|
||||
if (this.random.nextInt(2) == 0 && !this.world.players.isEmpty()) {
|
||||
// CraftBukkit start
|
||||
Entity target = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.RANDOM_TARGET);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
this.bD = null;
|
||||
} else {
|
||||
this.bD = ((org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity) event.getTarget()).getHandle();
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
boolean flag = false;
|
||||
|
||||
do {
|
||||
this.h = 0.0D;
|
||||
this.i = (double) (70.0F + this.random.nextFloat() * 50.0F);
|
||||
this.bm = 0.0D;
|
||||
this.h += (double) (this.random.nextFloat() * 120.0F - 60.0F);
|
||||
this.bm += (double) (this.random.nextFloat() * 120.0F - 60.0F);
|
||||
double d0 = this.locX - this.h;
|
||||
double d1 = this.locY - this.i;
|
||||
double d2 = this.locZ - this.bm;
|
||||
|
||||
flag = d0 * d0 + d1 * d1 + d2 * d2 > 100.0D;
|
||||
} while (!flag);
|
||||
|
||||
this.bD = null;
|
||||
}
|
||||
}
|
||||
|
||||
private float b(double d0) {
|
||||
return (float) MathHelper.g(d0);
|
||||
}
|
||||
|
||||
private boolean a(AxisAlignedBB axisalignedbb) {
|
||||
int i = MathHelper.floor(axisalignedbb.a);
|
||||
int j = MathHelper.floor(axisalignedbb.b);
|
||||
int k = MathHelper.floor(axisalignedbb.c);
|
||||
int l = MathHelper.floor(axisalignedbb.d);
|
||||
int i1 = MathHelper.floor(axisalignedbb.e);
|
||||
int j1 = MathHelper.floor(axisalignedbb.f);
|
||||
boolean flag = false;
|
||||
boolean flag1 = false;
|
||||
|
||||
// CraftBukkit start - Create a list to hold all the destroyed blocks
|
||||
List<org.bukkit.block.Block> destroyedBlocks = new java.util.ArrayList<org.bukkit.block.Block>();
|
||||
org.bukkit.craftbukkit.v1_7_R4.CraftWorld craftWorld = this.world.getWorld();
|
||||
// CraftBukkit end
|
||||
|
||||
for (int k1 = i; k1 <= l; ++k1) {
|
||||
for (int l1 = j; l1 <= i1; ++l1) {
|
||||
for (int i2 = k; i2 <= j1; ++i2) {
|
||||
Block block = this.world.getType(k1, l1, i2);
|
||||
|
||||
if (block.getMaterial() != Material.AIR) {
|
||||
if (block != Blocks.OBSIDIAN && block != Blocks.WHITESTONE && block != Blocks.BEDROCK && this.world.getGameRules().getBoolean("mobGriefing")) {
|
||||
// CraftBukkit start - Add blocks to list rather than destroying them
|
||||
// flag1 = this.world.setAir(k1, l1, i2) || flag1;
|
||||
flag1 = true;
|
||||
destroyedBlocks.add(craftWorld.getBlockAt(k1, l1, i2));
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
// CraftBukkit start - Set off an EntityExplodeEvent for the dragon exploding all these blocks
|
||||
org.bukkit.entity.Entity bukkitEntity = this.getBukkitEntity();
|
||||
EntityExplodeEvent event = new EntityExplodeEvent(bukkitEntity, bukkitEntity.getLocation(), destroyedBlocks, 0F);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
// This flag literally means 'Dragon hit something hard' (Obsidian, White Stone or Bedrock) and will cause the dragon to slow down.
|
||||
// We should consider adding an event extension for it, or perhaps returning true if the event is cancelled.
|
||||
return flag;
|
||||
} else if (event.getYield() == 0F) {
|
||||
// Yield zero ==> no drops
|
||||
for (org.bukkit.block.Block block : event.blockList()) {
|
||||
this.world.setAir(block.getX(), block.getY(), block.getZ());
|
||||
}
|
||||
} else {
|
||||
for (org.bukkit.block.Block block : event.blockList()) {
|
||||
org.bukkit.Material blockId = block.getType();
|
||||
if (blockId == org.bukkit.Material.AIR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int blockX = block.getX();
|
||||
int blockY = block.getY();
|
||||
int blockZ = block.getZ();
|
||||
|
||||
Block nmsBlock = org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers.getBlock(blockId);
|
||||
if (nmsBlock.a(explosionSource)) {
|
||||
nmsBlock.dropNaturally(this.world, blockX, blockY, blockZ, block.getData(), event.getYield(), 0);
|
||||
}
|
||||
nmsBlock.wasExploded(world, blockX, blockY, blockZ, explosionSource);
|
||||
|
||||
this.world.setAir(blockX, blockY, blockZ);
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
double d0 = axisalignedbb.a + (axisalignedbb.d - axisalignedbb.a) * (double) this.random.nextFloat();
|
||||
double d1 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) this.random.nextFloat();
|
||||
double d2 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) this.random.nextFloat();
|
||||
|
||||
this.world.addParticle("largeexplode", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
public boolean a(EntityComplexPart entitycomplexpart, DamageSource damagesource, float f) {
|
||||
if (entitycomplexpart != this.bq) {
|
||||
f = f / 4.0F + 1.0F;
|
||||
}
|
||||
|
||||
float f1 = this.yaw * 3.1415927F / 180.0F;
|
||||
float f2 = MathHelper.sin(f1);
|
||||
float f3 = MathHelper.cos(f1);
|
||||
|
||||
this.h = this.locX + (double) (f2 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
|
||||
this.i = this.locY + (double) (this.random.nextFloat() * 3.0F) + 1.0D;
|
||||
this.bm = this.locZ - (double) (f3 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
|
||||
this.bD = null;
|
||||
if (damagesource.getEntity() instanceof EntityHuman || damagesource.isExplosion()) {
|
||||
this.dealDamage(damagesource, f);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean dealDamage(DamageSource damagesource, float f) { // CraftBukkit - protected -> public
|
||||
return super.damageEntity(damagesource, f);
|
||||
}
|
||||
|
||||
protected void aF() {
|
||||
if (this.dead) return; // CraftBukkit - can't kill what's already dead
|
||||
++this.bB;
|
||||
if (this.bB >= 180 && this.bB <= 200) {
|
||||
float f = (this.random.nextFloat() - 0.5F) * 8.0F;
|
||||
float f1 = (this.random.nextFloat() - 0.5F) * 4.0F;
|
||||
float f2 = (this.random.nextFloat() - 0.5F) * 8.0F;
|
||||
|
||||
this.world.addParticle("hugeexplosion", this.locX + (double) f, this.locY + 2.0D + (double) f1, this.locZ + (double) f2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
int i;
|
||||
int j;
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
if (this.bB > 150 && this.bB % 5 == 0) {
|
||||
i = this.expToDrop / 12; // CraftBukkit - drop experience as dragon falls from sky. use experience drop from death event. This is now set in getExpReward()
|
||||
|
||||
while (i > 0) {
|
||||
j = EntityExperienceOrb.getOrbValue(i);
|
||||
i -= j;
|
||||
this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.bB == 1) {
|
||||
// CraftBukkit start - Use relative location for far away sounds
|
||||
//this.world.b(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
|
||||
int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
|
||||
for (EntityPlayer player : (List<EntityPlayer>) this.world.players) {
|
||||
double deltaX = this.locX - player.locX;
|
||||
double deltaZ = this.locZ - player.locZ;
|
||||
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
if ( world.spigotConfig.dragonDeathSoundRadius > 0 && distanceSquared > world.spigotConfig.dragonDeathSoundRadius * world.spigotConfig.dragonDeathSoundRadius ) continue; // Spigot
|
||||
if (distanceSquared > viewDistance * viewDistance) {
|
||||
double deltaLength = Math.sqrt(distanceSquared);
|
||||
double relativeX = player.locX + (deltaX / deltaLength) * viewDistance;
|
||||
double relativeZ = player.locZ + (deltaZ / deltaLength) * viewDistance;
|
||||
player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1018, (int) relativeX, (int) this.locY, (int) relativeZ, 0, true));
|
||||
} else {
|
||||
player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0, true));
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
this.move(0.0D, 0.10000000149011612D, 0.0D);
|
||||
this.aM = this.yaw += 20.0F;
|
||||
if (this.bB == 200 && !this.world.isStatic) {
|
||||
i = this.expToDrop - (10 * this.expToDrop / 12); // CraftBukkit - drop the remaining experience
|
||||
|
||||
while (i > 0) {
|
||||
j = EntityExperienceOrb.getOrbValue(i);
|
||||
i -= j;
|
||||
this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j));
|
||||
}
|
||||
|
||||
this.b(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
|
||||
this.die();
|
||||
}
|
||||
}
|
||||
|
||||
private void b(int i, int j) {
|
||||
byte b0 = 64;
|
||||
|
||||
BlockEnderPortal.a = true;
|
||||
byte b1 = 4;
|
||||
|
||||
// CraftBukkit start - Replace any "this.world" in the following with just "world"!
|
||||
BlockStateListPopulator world = new BlockStateListPopulator(this.world.getWorld());
|
||||
|
||||
for (int k = b0 - 1; k <= b0 + 32; ++k) {
|
||||
for (int l = i - b1; l <= i + b1; ++l) {
|
||||
for (int i1 = j - b1; i1 <= j + b1; ++i1) {
|
||||
double d0 = (double) (l - i);
|
||||
double d1 = (double) (i1 - j);
|
||||
double d2 = d0 * d0 + d1 * d1;
|
||||
|
||||
if (d2 <= ((double) b1 - 0.5D) * ((double) b1 - 0.5D)) {
|
||||
if (k < b0) {
|
||||
if (d2 <= ((double) (b1 - 1) - 0.5D) * ((double) (b1 - 1) - 0.5D)) {
|
||||
world.setTypeUpdate(l, k, i1, Blocks.BEDROCK);
|
||||
}
|
||||
} else if (k > b0) {
|
||||
world.setTypeUpdate(l, k, i1, Blocks.AIR);
|
||||
} else if (d2 > ((double) (b1 - 1) - 0.5D) * ((double) (b1 - 1) - 0.5D)) {
|
||||
world.setTypeUpdate(l, k, i1, Blocks.BEDROCK);
|
||||
} else {
|
||||
world.setTypeUpdate(l, k, i1, Blocks.ENDER_PORTAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
world.setType(i, b0 + 0, j, Blocks.BEDROCK);
|
||||
world.setType(i, b0 + 1, j, Blocks.BEDROCK);
|
||||
world.setType(i, b0 + 2, j, Blocks.BEDROCK);
|
||||
world.setTypeAndData(i - 1, b0 + 2, j, Blocks.TORCH, 2, 0);
|
||||
world.setTypeAndData(i + 1, b0 + 2, j, Blocks.TORCH, 1, 0);
|
||||
world.setTypeAndData(i, b0 + 2, j - 1, Blocks.TORCH, 4, 0);
|
||||
world.setTypeAndData(i, b0 + 2, j + 1, Blocks.TORCH, 3, 0);
|
||||
world.setType(i, b0 + 3, j, Blocks.BEDROCK);
|
||||
world.setType(i, b0 + 4, j, Blocks.DRAGON_EGG);
|
||||
|
||||
EntityCreatePortalEvent event = new EntityCreatePortalEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), java.util.Collections.unmodifiableList(world.getList()), org.bukkit.PortalType.ENDER);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
for (BlockState state : event.getBlocks()) {
|
||||
state.update(true);
|
||||
}
|
||||
} else {
|
||||
for (BlockState state : event.getBlocks()) {
|
||||
PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(state.getX(), state.getY(), state.getZ(), this.world);
|
||||
for (Iterator it = this.world.players.iterator(); it.hasNext();) {
|
||||
EntityHuman entity = (EntityHuman) it.next();
|
||||
if (entity instanceof EntityPlayer) {
|
||||
((EntityPlayer) entity).playerConnection.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
BlockEnderPortal.a = false;
|
||||
}
|
||||
|
||||
protected void w() {}
|
||||
|
||||
public Entity[] at() {
|
||||
return this.children;
|
||||
}
|
||||
|
||||
public boolean R() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public World a() {
|
||||
return this.world;
|
||||
}
|
||||
|
||||
protected String t() {
|
||||
return "mob.enderdragon.growl";
|
||||
}
|
||||
|
||||
protected String aT() {
|
||||
return "mob.enderdragon.hit";
|
||||
}
|
||||
|
||||
protected float bf() {
|
||||
return 5.0F;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public int getExpReward() {
|
||||
// This value is equal to the amount of experience dropped while falling from the sky (10 * 1000)
|
||||
// plus what is dropped when the dragon hits the ground (2000)
|
||||
return 12000;
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
@ -1,385 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
|
||||
import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityEnderman extends EntityMonster {
|
||||
|
||||
private static final UUID bp = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0");
|
||||
private static final AttributeModifier bq = (new AttributeModifier(bp, "Attacking speed boost", 6.199999809265137D, 0)).a(false);
|
||||
private static boolean[] br = new boolean[256];
|
||||
private int bs;
|
||||
private int bt;
|
||||
private Entity bu;
|
||||
private boolean bv;
|
||||
|
||||
public EntityEnderman(World world) {
|
||||
super(world);
|
||||
this.a(0.6F, 2.9F);
|
||||
this.W = 1.0F;
|
||||
}
|
||||
|
||||
protected void aD() {
|
||||
super.aD();
|
||||
this.getAttributeInstance(GenericAttributes.maxHealth).setValue(40.0D);
|
||||
this.getAttributeInstance(GenericAttributes.d).setValue(0.30000001192092896D);
|
||||
this.getAttributeInstance(GenericAttributes.e).setValue(7.0D);
|
||||
}
|
||||
|
||||
protected void c() {
|
||||
super.c();
|
||||
this.datawatcher.a(16, new Byte((byte) 0));
|
||||
this.datawatcher.a(17, new Byte((byte) 0));
|
||||
this.datawatcher.a(18, new Byte((byte) 0));
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.setShort("carried", (short) Block.getId(this.getCarried()));
|
||||
nbttagcompound.setShort("carriedData", (short) this.getCarriedData());
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
this.setCarried(Block.getById(nbttagcompound.getShort("carried")));
|
||||
this.setCarriedData(nbttagcompound.getShort("carriedData"));
|
||||
}
|
||||
|
||||
protected Entity findTarget() {
|
||||
if (Vegetated)
|
||||
return null;
|
||||
|
||||
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 64.0D);
|
||||
|
||||
if (entityhuman != null) {
|
||||
if (this.f(entityhuman)) {
|
||||
this.bv = true;
|
||||
if (this.bt == 0) {
|
||||
this.world.makeSound(entityhuman.locX, entityhuman.locY, entityhuman.locZ, "mob.endermen.stare", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
if (this.bt++ == 5) {
|
||||
this.bt = 0;
|
||||
this.a(true);
|
||||
return entityhuman;
|
||||
}
|
||||
} else {
|
||||
this.bt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean f(EntityHuman entityhuman) {
|
||||
ItemStack itemstack = entityhuman.inventory.armor[3];
|
||||
|
||||
if (itemstack != null && itemstack.getItem() == Item.getItemOf(Blocks.PUMPKIN)) {
|
||||
return false;
|
||||
} else {
|
||||
Vec3D vec3d = entityhuman.j(1.0F).a();
|
||||
Vec3D vec3d1 = Vec3D.a(this.locX - entityhuman.locX, this.boundingBox.b + (double) (this.length / 2.0F) - (entityhuman.locY + (double) entityhuman.getHeadHeight()), this.locZ - entityhuman.locZ);
|
||||
double d0 = vec3d1.b();
|
||||
|
||||
vec3d1 = vec3d1.a();
|
||||
double d1 = vec3d.b(vec3d1);
|
||||
|
||||
return d1 > 1.0D - 0.025D / d0 && entityhuman.hasLineOfSight(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void e() {
|
||||
if (this.L()) {
|
||||
this.damageEntity(DamageSource.DROWN, 1.0F);
|
||||
}
|
||||
|
||||
if (this.bu != this.target) {
|
||||
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.d);
|
||||
|
||||
attributeinstance.b(bq);
|
||||
if (this.target != null) {
|
||||
attributeinstance.a(bq);
|
||||
}
|
||||
}
|
||||
|
||||
this.bu = this.target;
|
||||
int i;
|
||||
|
||||
if (!this.world.isStatic && this.world.getGameRules().getBoolean("mobGriefing")) {
|
||||
int j;
|
||||
int k;
|
||||
Block block;
|
||||
|
||||
if (this.getCarried().getMaterial() == Material.AIR) {
|
||||
if (this.random.nextInt(20) == 0) {
|
||||
i = MathHelper.floor(this.locX - 2.0D + this.random.nextDouble() * 4.0D);
|
||||
j = MathHelper.floor(this.locY + this.random.nextDouble() * 3.0D);
|
||||
k = MathHelper.floor(this.locZ - 2.0D + this.random.nextDouble() * 4.0D);
|
||||
block = this.world.getType(i, j, k);
|
||||
if (br[Block.getId(block)]) {
|
||||
// CraftBukkit start - Pickup event
|
||||
if (!CraftEventFactory.callEntityChangeBlockEvent(this, this.world.getWorld().getBlockAt(i, j, k), org.bukkit.Material.AIR).isCancelled()) {
|
||||
this.setCarried(block);
|
||||
this.setCarriedData(this.world.getData(i, j, k));
|
||||
this.world.setTypeUpdate(i, j, k, Blocks.AIR);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
} else if (this.random.nextInt(2000) == 0) {
|
||||
i = MathHelper.floor(this.locX - 1.0D + this.random.nextDouble() * 2.0D);
|
||||
j = MathHelper.floor(this.locY + this.random.nextDouble() * 2.0D);
|
||||
k = MathHelper.floor(this.locZ - 1.0D + this.random.nextDouble() * 2.0D);
|
||||
block = this.world.getType(i, j, k);
|
||||
Block block1 = this.world.getType(i, j - 1, k);
|
||||
|
||||
if (block.getMaterial() == Material.AIR && block1.getMaterial() != Material.AIR && block1.d()) {
|
||||
// CraftBukkit start - Place event
|
||||
if (!CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, this.getCarried(), this.getCarriedData()).isCancelled()) {
|
||||
this.world.setTypeAndData(i, j, k, this.getCarried(), this.getCarriedData(), 3);
|
||||
this.setCarried(Blocks.AIR);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; ++i) {
|
||||
this.world.addParticle("portal", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length - 0.25D, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D);
|
||||
}
|
||||
|
||||
if (this.world.w() && !this.world.isStatic) {
|
||||
float f = this.d(1.0F);
|
||||
|
||||
if (f > 0.5F && this.world.i(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
|
||||
this.target = null;
|
||||
this.a(false);
|
||||
this.bv = false;
|
||||
this.bZ();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.L() || this.isBurning()) {
|
||||
this.target = null;
|
||||
this.a(false);
|
||||
this.bv = false;
|
||||
this.bZ();
|
||||
}
|
||||
|
||||
if (this.cd() && !this.bv && this.random.nextInt(100) == 0) {
|
||||
this.a(false);
|
||||
}
|
||||
|
||||
this.bc = false;
|
||||
if (this.target != null) {
|
||||
this.a(this.target, 100.0F, 100.0F);
|
||||
}
|
||||
|
||||
if (!this.world.isStatic && this.isAlive()) {
|
||||
if (this.target != null) {
|
||||
if (this.target instanceof EntityHuman && this.f((EntityHuman) this.target)) {
|
||||
if (this.target.f((Entity) this) < 16.0D) {
|
||||
this.bZ();
|
||||
}
|
||||
|
||||
this.bs = 0;
|
||||
} else if (this.target.f((Entity) this) > 256.0D && this.bs++ >= 30 && this.c(this.target)) {
|
||||
this.bs = 0;
|
||||
}
|
||||
} else {
|
||||
this.a(false);
|
||||
this.bs = 0;
|
||||
}
|
||||
}
|
||||
|
||||
super.e();
|
||||
}
|
||||
|
||||
protected boolean bZ() {
|
||||
double d0 = this.locX + (this.random.nextDouble() - 0.5D) * 64.0D;
|
||||
double d1 = this.locY + (double) (this.random.nextInt(64) - 32);
|
||||
double d2 = this.locZ + (this.random.nextDouble() - 0.5D) * 64.0D;
|
||||
|
||||
return this.k(d0, d1, d2);
|
||||
}
|
||||
|
||||
protected boolean c(Entity entity) {
|
||||
Vec3D vec3d = Vec3D.a(this.locX - entity.locX, this.boundingBox.b + (double) (this.length / 2.0F) - entity.locY + (double) entity.getHeadHeight(), this.locZ - entity.locZ);
|
||||
|
||||
vec3d = vec3d.a();
|
||||
double d0 = 16.0D;
|
||||
double d1 = this.locX + (this.random.nextDouble() - 0.5D) * 8.0D - vec3d.a * d0;
|
||||
double d2 = this.locY + (double) (this.random.nextInt(16) - 8) - vec3d.b * d0;
|
||||
double d3 = this.locZ + (this.random.nextDouble() - 0.5D) * 8.0D - vec3d.c * d0;
|
||||
|
||||
return this.k(d1, d2, d3);
|
||||
}
|
||||
|
||||
protected boolean k(double d0, double d1, double d2) {
|
||||
double d3 = this.locX;
|
||||
double d4 = this.locY;
|
||||
double d5 = this.locZ;
|
||||
|
||||
this.locX = d0;
|
||||
this.locY = d1;
|
||||
this.locZ = d2;
|
||||
boolean flag = false;
|
||||
int i = MathHelper.floor(this.locX);
|
||||
int j = MathHelper.floor(this.locY);
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
|
||||
if (this.world.isLoaded(i, j, k)) {
|
||||
boolean flag1 = false;
|
||||
|
||||
while (!flag1 && j > 0) {
|
||||
Block block = this.world.getType(i, j - 1, k);
|
||||
|
||||
if (block.getMaterial().isSolid()) {
|
||||
flag1 = true;
|
||||
} else {
|
||||
--this.locY;
|
||||
--j;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
// CraftBukkit start - Teleport event
|
||||
EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.world.getWorld(), d3, d4, d5), new Location(this.world.getWorld(), this.locX, this.locY, this.locZ));
|
||||
this.world.getServer().getPluginManager().callEvent(teleport);
|
||||
if (teleport.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Location to = teleport.getTo();
|
||||
this.setPosition(to.getX(), to.getY(), to.getZ());
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox)) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
this.setPosition(d3, d4, d5);
|
||||
return false;
|
||||
} else {
|
||||
short short1 = 128;
|
||||
|
||||
for (int l = 0; l < short1; ++l) {
|
||||
double d6 = (double) l / ((double) short1 - 1.0D);
|
||||
float f = (this.random.nextFloat() - 0.5F) * 0.2F;
|
||||
float f1 = (this.random.nextFloat() - 0.5F) * 0.2F;
|
||||
float f2 = (this.random.nextFloat() - 0.5F) * 0.2F;
|
||||
double d7 = d3 + (this.locX - d3) * d6 + (this.random.nextDouble() - 0.5D) * (double) this.width * 2.0D;
|
||||
double d8 = d4 + (this.locY - d4) * d6 + this.random.nextDouble() * (double) this.length;
|
||||
double d9 = d5 + (this.locZ - d5) * d6 + (this.random.nextDouble() - 0.5D) * (double) this.width * 2.0D;
|
||||
|
||||
this.world.addParticle("portal", d7, d8, d9, (double) f, (double) f1, (double) f2);
|
||||
}
|
||||
|
||||
this.world.makeSound(d3, d4, d5, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
this.makeSound("mob.endermen.portal", 1.0F, 1.0F);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected String t() {
|
||||
return this.cd() ? "mob.endermen.scream" : "mob.endermen.idle";
|
||||
}
|
||||
|
||||
protected String aT() {
|
||||
return "mob.endermen.hit";
|
||||
}
|
||||
|
||||
protected String aU() {
|
||||
return "mob.endermen.death";
|
||||
}
|
||||
|
||||
protected Item getLoot() {
|
||||
return Items.ENDER_PEARL;
|
||||
}
|
||||
|
||||
protected void dropDeathLoot(boolean flag, int i) {
|
||||
Item item = this.getLoot();
|
||||
|
||||
if (item != null) {
|
||||
int j = this.random.nextInt(2 + i);
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
this.a(item, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setCarried(Block block) {
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte) (Block.getId(block) & 255)));
|
||||
}
|
||||
|
||||
public Block getCarried() {
|
||||
return Block.getById(this.datawatcher.getByte(16));
|
||||
}
|
||||
|
||||
public void setCarriedData(int i) {
|
||||
this.datawatcher.watch(17, Byte.valueOf((byte) (i & 255)));
|
||||
}
|
||||
|
||||
public int getCarriedData() {
|
||||
return this.datawatcher.getByte(17);
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||
if (this.isInvulnerable()) {
|
||||
return false;
|
||||
} else {
|
||||
this.a(true);
|
||||
if (damagesource instanceof EntityDamageSource && damagesource.getEntity() instanceof EntityHuman) {
|
||||
this.bv = true;
|
||||
}
|
||||
|
||||
if (damagesource instanceof EntityDamageSourceIndirect) {
|
||||
this.bv = false;
|
||||
|
||||
for (int i = 0; i < 64; ++i) {
|
||||
if (this.bZ()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return super.damageEntity(damagesource, f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean cd() {
|
||||
return this.datawatcher.getByte(18) > 0;
|
||||
}
|
||||
|
||||
public void a(boolean flag) {
|
||||
this.datawatcher.watch(18, Byte.valueOf((byte) (flag ? 1 : 0)));
|
||||
}
|
||||
|
||||
static {
|
||||
br[Block.getId(Blocks.GRASS)] = true;
|
||||
br[Block.getId(Blocks.DIRT)] = true;
|
||||
br[Block.getId(Blocks.SAND)] = true;
|
||||
br[Block.getId(Blocks.GRAVEL)] = true;
|
||||
br[Block.getId(Blocks.YELLOW_FLOWER)] = true;
|
||||
br[Block.getId(Blocks.RED_ROSE)] = true;
|
||||
br[Block.getId(Blocks.BROWN_MUSHROOM)] = true;
|
||||
br[Block.getId(Blocks.RED_MUSHROOM)] = true;
|
||||
br[Block.getId(Blocks.TNT)] = true;
|
||||
br[Block.getId(Blocks.CACTUS)] = true;
|
||||
br[Block.getId(Blocks.CLAY)] = true;
|
||||
br[Block.getId(Blocks.PUMPKIN)] = true;
|
||||
br[Block.getId(Blocks.MELON)] = true;
|
||||
br[Block.getId(Blocks.MYCEL)] = true;
|
||||
}
|
||||
}
|
@ -1,246 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory; // CraftBukkit
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
public class EntityFallingBlock extends Entity {
|
||||
|
||||
public Block id; // CraftBukkit - private -> public
|
||||
public int data;
|
||||
public int ticksLived;
|
||||
public boolean dropItem;
|
||||
private boolean f;
|
||||
private boolean hurtEntities;
|
||||
private int fallHurtMax;
|
||||
private float fallHurtAmount;
|
||||
public NBTTagCompound tileEntityData;
|
||||
|
||||
public boolean spectating;
|
||||
|
||||
public EntityFallingBlock(World world) {
|
||||
super(world);
|
||||
this.dropItem = true;
|
||||
this.fallHurtMax = 40;
|
||||
this.fallHurtAmount = 2.0F;
|
||||
}
|
||||
|
||||
public EntityFallingBlock(World world, double d0, double d1, double d2, Block block) {
|
||||
this(world, d0, d1, d2, block, 0);
|
||||
}
|
||||
|
||||
public EntityFallingBlock(World world, double d0, double d1, double d2, Block block, int i) {
|
||||
super(world);
|
||||
this.dropItem = true;
|
||||
this.fallHurtMax = 40;
|
||||
this.fallHurtAmount = 2.0F;
|
||||
this.id = block;
|
||||
this.data = i;
|
||||
this.k = true;
|
||||
this.a(0.98F, 0.98F);
|
||||
this.height = this.length / 2.0F;
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.motX = 0.0D;
|
||||
this.motY = 0.0D;
|
||||
this.motZ = 0.0D;
|
||||
this.lastX = d0;
|
||||
this.lastY = d1;
|
||||
this.lastZ = d2;
|
||||
}
|
||||
|
||||
protected boolean g_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void c() {}
|
||||
|
||||
public boolean R() {
|
||||
return !this.dead && !spectating;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean damageEntity(DamageSource damagesource, float f)
|
||||
{
|
||||
CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void h() {
|
||||
if (this.id.getMaterial() == Material.AIR) {
|
||||
this.die();
|
||||
} else {
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
++this.ticksLived;
|
||||
this.motY -= 0.03999999910593033D;
|
||||
this.move(this.motX, this.motY, this.motZ);
|
||||
this.motX *= 0.9800000190734863D;
|
||||
this.motY *= 0.9800000190734863D;
|
||||
this.motZ *= 0.9800000190734863D;
|
||||
if (!this.world.isStatic) {
|
||||
int i = MathHelper.floor(this.locX);
|
||||
int j = MathHelper.floor(this.locY);
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
|
||||
if (this.ticksLived == 1) {
|
||||
// CraftBukkit - compare data and call event
|
||||
if (this.ticksLived != 1 || this.world.getType(i, j, k) != this.id || this.world.getData(i, j, k) != this.data || CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, Blocks.AIR, 0).isCancelled()) {
|
||||
this.die();
|
||||
return;
|
||||
}
|
||||
|
||||
this.world.setAir(i, j, k);
|
||||
world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot
|
||||
}
|
||||
|
||||
if (this.onGround) {
|
||||
this.motX *= 0.699999988079071D;
|
||||
this.motZ *= 0.699999988079071D;
|
||||
this.motY *= -0.5D;
|
||||
if (this.world.getType(i, j, k) != Blocks.PISTON_MOVING) {
|
||||
this.die();
|
||||
// CraftBukkit start - fire EntityChangeBlockEvent
|
||||
if (!this.f && this.world.mayPlace(this.id, i, j, k, true, 1, (Entity) null, (ItemStack) null) && !BlockFalling.canFall(this.world, i, j - 1, k) /* mimic the false conditions of setTypeIdAndData */ && i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000 && j > 0 && j < 256 && !(this.world.getType(i, j, k) == this.id && this.world.getData(i, j, k) == this.data)) {
|
||||
if (CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, this.id, this.data).isCancelled()) {
|
||||
return;
|
||||
}
|
||||
this.world.setTypeAndData(i, j, k, this.id, this.data, 3);
|
||||
// CraftBukkit end
|
||||
world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot
|
||||
|
||||
if (this.id instanceof BlockFalling) {
|
||||
((BlockFalling) this.id).a(this.world, i, j, k, this.data);
|
||||
}
|
||||
|
||||
if (this.tileEntityData != null && this.id instanceof IContainer) {
|
||||
TileEntity tileentity = this.world.getTileEntity(i, j, k);
|
||||
|
||||
if (tileentity != null) {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
|
||||
tileentity.b(nbttagcompound);
|
||||
Iterator iterator = this.tileEntityData.c().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
String s = (String) iterator.next();
|
||||
NBTBase nbtbase = this.tileEntityData.get(s);
|
||||
|
||||
if (!s.equals("x") && !s.equals("y") && !s.equals("z")) {
|
||||
nbttagcompound.set(s, nbtbase.clone());
|
||||
}
|
||||
}
|
||||
|
||||
tileentity.a(nbttagcompound);
|
||||
tileentity.update();
|
||||
}
|
||||
}
|
||||
} else if (this.dropItem && !this.f) {
|
||||
this.a(new ItemStack(this.id, 1, this.id.getDropData(this.data)), 0.0F);
|
||||
}
|
||||
}
|
||||
} else if (this.ticksLived > 100 && !this.world.isStatic && (j < 1 || j > 256) || this.ticksLived > 600) {
|
||||
if (this.dropItem) {
|
||||
this.a(new ItemStack(this.id, 1, this.id.getDropData(this.data)), 0.0F);
|
||||
}
|
||||
|
||||
this.die();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void b(float f) {
|
||||
if (this.hurtEntities) {
|
||||
int i = MathHelper.f(f - 1.0F);
|
||||
|
||||
if (i > 0) {
|
||||
ArrayList arraylist = new ArrayList(this.world.getEntities(this, this.boundingBox));
|
||||
boolean flag = this.id == Blocks.ANVIL;
|
||||
DamageSource damagesource = flag ? DamageSource.ANVIL : DamageSource.FALLING_BLOCK;
|
||||
Iterator iterator = arraylist.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
CraftEventFactory.entityDamage = this; // CraftBukkit
|
||||
entity.damageEntity(damagesource, (float) Math.min(MathHelper.d((float) i * this.fallHurtAmount), this.fallHurtMax));
|
||||
CraftEventFactory.entityDamage = null; // CraftBukkit
|
||||
}
|
||||
|
||||
if (flag && (double) this.random.nextFloat() < 0.05000000074505806D + (double) i * 0.05D) {
|
||||
int j = this.data >> 2;
|
||||
int k = this.data & 3;
|
||||
|
||||
++j;
|
||||
if (j > 2) {
|
||||
this.f = true;
|
||||
} else {
|
||||
this.data = k | j << 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void b(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setByte("Tile", (byte) Block.getId(this.id));
|
||||
nbttagcompound.setInt("TileID", Block.getId(this.id));
|
||||
nbttagcompound.setByte("Data", (byte) this.data);
|
||||
nbttagcompound.setByte("Time", (byte) this.ticksLived);
|
||||
nbttagcompound.setBoolean("DropItem", this.dropItem);
|
||||
nbttagcompound.setBoolean("HurtEntities", this.hurtEntities);
|
||||
nbttagcompound.setFloat("FallHurtAmount", this.fallHurtAmount);
|
||||
nbttagcompound.setInt("FallHurtMax", this.fallHurtMax);
|
||||
if (this.tileEntityData != null) {
|
||||
nbttagcompound.set("TileEntityData", this.tileEntityData);
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
if (nbttagcompound.hasKeyOfType("TileID", 99)) {
|
||||
this.id = Block.getById(nbttagcompound.getInt("TileID"));
|
||||
} else {
|
||||
this.id = Block.getById(nbttagcompound.getByte("Tile") & 255);
|
||||
}
|
||||
|
||||
this.data = nbttagcompound.getByte("Data") & 255;
|
||||
this.ticksLived = nbttagcompound.getByte("Time") & 255;
|
||||
if (nbttagcompound.hasKeyOfType("HurtEntities", 99)) {
|
||||
this.hurtEntities = nbttagcompound.getBoolean("HurtEntities");
|
||||
this.fallHurtAmount = nbttagcompound.getFloat("FallHurtAmount");
|
||||
this.fallHurtMax = nbttagcompound.getInt("FallHurtMax");
|
||||
} else if (this.id == Blocks.ANVIL) {
|
||||
this.hurtEntities = true;
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("DropItem", 99)) {
|
||||
this.dropItem = nbttagcompound.getBoolean("DropItem");
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("TileEntityData", 10)) {
|
||||
this.tileEntityData = nbttagcompound.getCompound("TileEntityData");
|
||||
}
|
||||
|
||||
if (this.id.getMaterial() == Material.AIR) {
|
||||
this.id = Blocks.SAND;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(boolean flag) {
|
||||
this.hurtEntities = flag;
|
||||
}
|
||||
|
||||
public void a(CrashReportSystemDetails crashreportsystemdetails) {
|
||||
super.a(crashreportsystemdetails);
|
||||
crashreportsystemdetails.a("Immitating block ID", Integer.valueOf(Block.getId(this.id)));
|
||||
crashreportsystemdetails.a("Immitating block data", Integer.valueOf(this.data));
|
||||
}
|
||||
|
||||
public Block f() {
|
||||
return this.id;
|
||||
}
|
||||
}
|
@ -1,257 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityGhast extends EntityFlying implements IMonster {
|
||||
|
||||
public int h;
|
||||
public double i;
|
||||
public double bm;
|
||||
public double bn;
|
||||
private Entity target;
|
||||
private int br;
|
||||
public int bo;
|
||||
public int bp;
|
||||
private int explosionPower = 1;
|
||||
|
||||
public EntityGhast(World world) {
|
||||
super(world);
|
||||
this.a(4.0F, 4.0F);
|
||||
this.fireProof = true;
|
||||
this.b = 5;
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||
if (this.isInvulnerable()) {
|
||||
return false;
|
||||
} else if ("fireball".equals(damagesource.p()) && damagesource.getEntity() instanceof EntityHuman) {
|
||||
super.damageEntity(damagesource, 1000.0F);
|
||||
((EntityHuman) damagesource.getEntity()).a((Statistic) AchievementList.z);
|
||||
return true;
|
||||
} else {
|
||||
return super.damageEntity(damagesource, f);
|
||||
}
|
||||
}
|
||||
|
||||
protected void c() {
|
||||
super.c();
|
||||
this.datawatcher.a(16, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
protected void aD() {
|
||||
super.aD();
|
||||
this.getAttributeInstance(GenericAttributes.maxHealth).setValue(10.0D);
|
||||
}
|
||||
|
||||
protected void bq() {
|
||||
if (!this.world.isStatic && this.world.difficulty == EnumDifficulty.PEACEFUL) {
|
||||
this.die();
|
||||
}
|
||||
|
||||
if (Vegetated)
|
||||
{
|
||||
double d0 = this.i - this.locX;
|
||||
double d1 = this.bm - this.locY;
|
||||
double d2 = this.bn - this.locZ;
|
||||
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
|
||||
this.motX += d0 / d3 * 0.1D;
|
||||
this.motY += d1 / d3 * 0.1D;
|
||||
this.motZ += d2 / d3 * 0.1D;
|
||||
|
||||
double d5 = this.i - this.locX;
|
||||
double d6 = this.bn - this.locZ;
|
||||
|
||||
this.aN = this.yaw = -((float) Math.atan2(d5, d6)) * 180.0F / 3.1415927F;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.w();
|
||||
this.bo = this.bp;
|
||||
double d0 = this.i - this.locX;
|
||||
double d1 = this.bm - this.locY;
|
||||
double d2 = this.bn - this.locZ;
|
||||
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
|
||||
if (d3 < 1.0D || d3 > 3600.0D) {
|
||||
this.i = this.locX + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.bm = this.locY + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.bn = this.locZ + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
}
|
||||
|
||||
if (this.h-- <= 0) {
|
||||
this.h += this.random.nextInt(5) + 2;
|
||||
d3 = (double) MathHelper.sqrt(d3);
|
||||
if (this.a(this.i, this.bm, this.bn, d3)) {
|
||||
this.motX += d0 / d3 * 0.1D;
|
||||
this.motY += d1 / d3 * 0.1D;
|
||||
this.motZ += d2 / d3 * 0.1D;
|
||||
} else {
|
||||
this.i = this.locX;
|
||||
this.bm = this.locY;
|
||||
this.bn = this.locZ;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.target != null && this.target.dead) {
|
||||
// CraftBukkit start - fire EntityTargetEvent
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
this.target = null;
|
||||
} else {
|
||||
this.target = ((CraftEntity) event.getTarget()).getHandle();
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
if (this.target == null || this.br-- <= 0) {
|
||||
// CraftBukkit start - fire EntityTargetEvent
|
||||
Entity target = this.world.findNearbyVulnerablePlayer(this, 100.0D);
|
||||
if (target != null) {
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
this.target = null;
|
||||
} else {
|
||||
this.target = ((CraftEntity) event.getTarget()).getHandle();
|
||||
}
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.target != null) {
|
||||
this.br = 20;
|
||||
}
|
||||
}
|
||||
|
||||
double d4 = 64.0D;
|
||||
|
||||
if (this.target != null && this.target.f((Entity) this) < d4 * d4) {
|
||||
double d5 = this.target.locX - this.locX;
|
||||
double d6 = this.target.boundingBox.b + (double) (this.target.length / 2.0F) - (this.locY + (double) (this.length / 2.0F));
|
||||
double d7 = this.target.locZ - this.locZ;
|
||||
|
||||
this.aM = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
|
||||
if (this.hasLineOfSight(this.target)) {
|
||||
if (this.bp == 10) {
|
||||
this.world.a((EntityHuman) null, 1007, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
|
||||
}
|
||||
|
||||
++this.bp;
|
||||
if (this.bp == 20) {
|
||||
this.world.a((EntityHuman) null, 1008, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.world, this, d5, d6, d7);
|
||||
|
||||
// CraftBukkit - set bukkitYield when setting explosionpower
|
||||
entitylargefireball.bukkitYield = entitylargefireball.yield = this.explosionPower;
|
||||
double d8 = 4.0D;
|
||||
Vec3D vec3d = this.j(1.0F);
|
||||
|
||||
entitylargefireball.locX = this.locX + vec3d.a * d8;
|
||||
entitylargefireball.locY = this.locY + (double) (this.length / 2.0F) + 0.5D;
|
||||
entitylargefireball.locZ = this.locZ + vec3d.c * d8;
|
||||
this.world.addEntity(entitylargefireball);
|
||||
this.bp = -40;
|
||||
}
|
||||
} else if (this.bp > 0) {
|
||||
--this.bp;
|
||||
}
|
||||
} else {
|
||||
this.aM = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
|
||||
if (this.bp > 0) {
|
||||
--this.bp;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
byte b0 = this.datawatcher.getByte(16);
|
||||
byte b1 = (byte) (this.bp > 10 ? 1 : 0);
|
||||
|
||||
if (b0 != b1) {
|
||||
this.datawatcher.watch(16, Byte.valueOf(b1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean a(double d0, double d1, double d2, double d3) {
|
||||
double d4 = (this.i - this.locX) / d3;
|
||||
double d5 = (this.bm - this.locY) / d3;
|
||||
double d6 = (this.bn - this.locZ) / d3;
|
||||
AxisAlignedBB axisalignedbb = this.boundingBox.clone();
|
||||
|
||||
for (int i = 1; (double) i < d3; ++i) {
|
||||
axisalignedbb.d(d4, d5, d6);
|
||||
if (!this.world.getCubes(this, axisalignedbb).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String t() {
|
||||
return "mob.ghast.moan";
|
||||
}
|
||||
|
||||
protected String aT() {
|
||||
return "mob.ghast.scream";
|
||||
}
|
||||
|
||||
protected String aU() {
|
||||
return "mob.ghast.death";
|
||||
}
|
||||
|
||||
protected Item getLoot() {
|
||||
return Items.SULPHUR;
|
||||
}
|
||||
|
||||
protected void dropDeathLoot(boolean flag, int i) {
|
||||
int j = this.random.nextInt(2) + this.random.nextInt(1 + i);
|
||||
|
||||
int k;
|
||||
|
||||
for (k = 0; k < j; ++k) {
|
||||
this.a(Items.GHAST_TEAR, 1);
|
||||
}
|
||||
|
||||
j = this.random.nextInt(3) + this.random.nextInt(1 + i);
|
||||
|
||||
for (k = 0; k < j; ++k) {
|
||||
this.a(Items.SULPHUR, 1);
|
||||
}
|
||||
}
|
||||
|
||||
protected float bf() {
|
||||
return 10.0F;
|
||||
}
|
||||
|
||||
public boolean canSpawn() {
|
||||
return this.random.nextInt(20) == 0 && super.canSpawn() && this.world.difficulty != EnumDifficulty.PEACEFUL;
|
||||
}
|
||||
|
||||
public int bB() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.setInt("ExplosionPower", this.explosionPower);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
if (nbttagcompound.hasKeyOfType("ExplosionPower", 99)) {
|
||||
this.explosionPower = nbttagcompound.getInt("ExplosionPower");
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,902 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
|
||||
import org.bukkit.event.entity.EntityUnleashEvent;
|
||||
import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
|
||||
// CraftBukkit end
|
||||
|
||||
public abstract class EntityInsentient extends EntityLiving {
|
||||
|
||||
public int a_;
|
||||
protected int b;
|
||||
private ControllerLook lookController;
|
||||
private ControllerMove moveController;
|
||||
private ControllerJump bm;
|
||||
private EntityAIBodyControl bn;
|
||||
private Navigation navigation;
|
||||
protected final PathfinderGoalSelector goalSelector;
|
||||
protected final PathfinderGoalSelector targetSelector;
|
||||
private EntityLiving goalTarget;
|
||||
private EntitySenses bq;
|
||||
private ItemStack[] equipment = new ItemStack[5];
|
||||
public float[] dropChances = new float[5]; // CraftBukkit - protected -> public
|
||||
public boolean canPickUpLoot; // CraftBukkit - private -> public
|
||||
public boolean persistent = !isTypeNotPersistent(); // CraftBukkit - private -> public
|
||||
protected float f;
|
||||
private Entity bu;
|
||||
protected int g;
|
||||
private boolean bv;
|
||||
private Entity bw;
|
||||
private NBTTagCompound bx;
|
||||
|
||||
public boolean Vegetated;
|
||||
public boolean BreakLeash = true;
|
||||
public boolean PullWhileLeashed = true;
|
||||
|
||||
public EntityInsentient(World world) {
|
||||
super(world);
|
||||
this.goalSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null);
|
||||
this.targetSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null);
|
||||
this.lookController = new ControllerLook(this);
|
||||
this.moveController = new ControllerMove(this);
|
||||
this.bm = new ControllerJump(this);
|
||||
this.bn = new EntityAIBodyControl(this);
|
||||
this.navigation = new Navigation(this, world);
|
||||
this.bq = new EntitySenses(this);
|
||||
|
||||
for (int i = 0; i < this.dropChances.length; ++i) {
|
||||
this.dropChances[i] = 0.085F;
|
||||
}
|
||||
}
|
||||
|
||||
protected void aD() {
|
||||
super.aD();
|
||||
this.getAttributeMap().b(GenericAttributes.b).setValue(16.0D);
|
||||
}
|
||||
|
||||
public ControllerLook getControllerLook() {
|
||||
return this.lookController;
|
||||
}
|
||||
|
||||
public ControllerMove getControllerMove() {
|
||||
return this.moveController;
|
||||
}
|
||||
|
||||
public ControllerJump getControllerJump() {
|
||||
return this.bm;
|
||||
}
|
||||
|
||||
public Navigation getNavigation() {
|
||||
return this.navigation;
|
||||
}
|
||||
|
||||
public EntitySenses getEntitySenses() {
|
||||
return this.bq;
|
||||
}
|
||||
|
||||
public EntityLiving getGoalTarget() {
|
||||
return this.goalTarget;
|
||||
}
|
||||
|
||||
public void setGoalTarget(EntityLiving entityliving) {
|
||||
this.goalTarget = entityliving;
|
||||
}
|
||||
|
||||
public boolean a(Class oclass) {
|
||||
return EntityCreeper.class != oclass && EntityGhast.class != oclass;
|
||||
}
|
||||
|
||||
public void p() {}
|
||||
|
||||
protected void c() {
|
||||
super.c();
|
||||
this.datawatcher.a(11, Byte.valueOf((byte) 0));
|
||||
this.datawatcher.a(10, "");
|
||||
}
|
||||
|
||||
public int q() {
|
||||
return 80;
|
||||
}
|
||||
|
||||
public void r() {
|
||||
String s = this.t();
|
||||
|
||||
if (s != null) {
|
||||
this.makeSound(s, this.bf(), this.bg());
|
||||
}
|
||||
}
|
||||
|
||||
public void C() {
|
||||
super.C();
|
||||
this.world.methodProfiler.a("mobBaseTick");
|
||||
if (this.isAlive() && !Silent && this.random.nextInt(1000) < this.a_++) {
|
||||
this.a_ = -this.q();
|
||||
this.r();
|
||||
}
|
||||
|
||||
this.world.methodProfiler.b();
|
||||
}
|
||||
|
||||
protected int getExpValue(EntityHuman entityhuman) {
|
||||
if (this.b > 0) {
|
||||
int i = this.b;
|
||||
ItemStack[] aitemstack = this.getEquipment();
|
||||
|
||||
for (int j = 0; j < aitemstack.length; ++j) {
|
||||
if (aitemstack[j] != null && this.dropChances[j] <= 1.0F) {
|
||||
i += 1 + this.random.nextInt(3);
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
} else {
|
||||
return this.b;
|
||||
}
|
||||
}
|
||||
|
||||
public void s() {
|
||||
for (int i = 0; i < 20; ++i) {
|
||||
double d0 = this.random.nextGaussian() * 0.02D;
|
||||
double d1 = this.random.nextGaussian() * 0.02D;
|
||||
double d2 = this.random.nextGaussian() * 0.02D;
|
||||
double d3 = 10.0D;
|
||||
|
||||
this.world.addParticle("explode", this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width - d0 * d3, this.locY + (double) (this.random.nextFloat() * this.length) - d1 * d3, this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width - d2 * d3, d0, d1, d2);
|
||||
}
|
||||
}
|
||||
|
||||
public void h() {
|
||||
super.h();
|
||||
if (!this.world.isStatic) {
|
||||
this.bL();
|
||||
}
|
||||
}
|
||||
|
||||
protected float f(float f, float f1) {
|
||||
if (this.bk()) {
|
||||
this.bn.a();
|
||||
return f1;
|
||||
} else {
|
||||
return super.f(f, f1);
|
||||
}
|
||||
}
|
||||
|
||||
protected String t() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Item getLoot() {
|
||||
return Item.getById(0);
|
||||
}
|
||||
|
||||
protected void dropDeathLoot(boolean flag, int i) {
|
||||
Item item = this.getLoot();
|
||||
|
||||
if (item != null) {
|
||||
int j = this.random.nextInt(3);
|
||||
|
||||
if (i > 0) {
|
||||
j += this.random.nextInt(i + 1);
|
||||
}
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
this.a(item, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.setBoolean("CanPickUpLoot", this.bJ());
|
||||
nbttagcompound.setBoolean("PersistenceRequired", this.persistent);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
NBTTagCompound nbttagcompound1;
|
||||
|
||||
for (int i = 0; i < this.equipment.length; ++i) {
|
||||
nbttagcompound1 = new NBTTagCompound();
|
||||
if (this.equipment[i] != null) {
|
||||
this.equipment[i].save(nbttagcompound1);
|
||||
}
|
||||
|
||||
nbttaglist.add(nbttagcompound1);
|
||||
}
|
||||
|
||||
nbttagcompound.set("Equipment", nbttaglist);
|
||||
NBTTagList nbttaglist1 = new NBTTagList();
|
||||
|
||||
for (int j = 0; j < this.dropChances.length; ++j) {
|
||||
nbttaglist1.add(new NBTTagFloat(this.dropChances[j]));
|
||||
}
|
||||
|
||||
nbttagcompound.set("DropChances", nbttaglist1);
|
||||
nbttagcompound.setString("CustomName", this.getCustomName());
|
||||
nbttagcompound.setBoolean("CustomNameVisible", this.getCustomNameVisible());
|
||||
nbttagcompound.setBoolean("Leashed", this.bv);
|
||||
if (this.bw != null) {
|
||||
nbttagcompound1 = new NBTTagCompound();
|
||||
if (this.bw instanceof EntityLiving) {
|
||||
nbttagcompound1.setLong("UUIDMost", this.bw.getUniqueID().getMostSignificantBits());
|
||||
nbttagcompound1.setLong("UUIDLeast", this.bw.getUniqueID().getLeastSignificantBits());
|
||||
} else if (this.bw instanceof EntityHanging) {
|
||||
EntityHanging entityhanging = (EntityHanging) this.bw;
|
||||
|
||||
nbttagcompound1.setInt("X", entityhanging.x);
|
||||
nbttagcompound1.setInt("Y", entityhanging.y);
|
||||
nbttagcompound1.setInt("Z", entityhanging.z);
|
||||
}
|
||||
|
||||
nbttagcompound.set("Leash", nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
|
||||
// CraftBukkit start - If looting or persistence is false only use it if it was set after we started using it
|
||||
boolean data = nbttagcompound.getBoolean("CanPickUpLoot");
|
||||
if (isLevelAtLeast(nbttagcompound, 1) || data) {
|
||||
this.canPickUpLoot = data;
|
||||
}
|
||||
|
||||
data = nbttagcompound.getBoolean("PersistenceRequired");
|
||||
if (isLevelAtLeast(nbttagcompound, 1) || data) {
|
||||
this.persistent = data;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("CustomName", 8) && nbttagcompound.getString("CustomName").length() > 0) {
|
||||
this.setCustomName(nbttagcompound.getString("CustomName"));
|
||||
}
|
||||
|
||||
this.setCustomNameVisible(nbttagcompound.getBoolean("CustomNameVisible"));
|
||||
NBTTagList nbttaglist;
|
||||
int i;
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("Equipment", 9)) {
|
||||
nbttaglist = nbttagcompound.getList("Equipment", 10);
|
||||
|
||||
for (i = 0; i < this.equipment.length; ++i) {
|
||||
this.equipment[i] = ItemStack.createStack(nbttaglist.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKeyOfType("DropChances", 9)) {
|
||||
nbttaglist = nbttagcompound.getList("DropChances", 5);
|
||||
|
||||
for (i = 0; i < nbttaglist.size(); ++i) {
|
||||
this.dropChances[i] = nbttaglist.e(i);
|
||||
}
|
||||
}
|
||||
|
||||
this.bv = nbttagcompound.getBoolean("Leashed");
|
||||
if (this.bv && nbttagcompound.hasKeyOfType("Leash", 10)) {
|
||||
this.bx = nbttagcompound.getCompound("Leash");
|
||||
}
|
||||
}
|
||||
|
||||
public void n(float f) {
|
||||
this.be = f;
|
||||
}
|
||||
|
||||
public void i(float f) {
|
||||
super.i(f);
|
||||
this.n(f);
|
||||
}
|
||||
|
||||
public void e() {
|
||||
super.e();
|
||||
this.world.methodProfiler.a("looting");
|
||||
if (!this.world.isStatic && this.bJ() && !this.aT && this.world.getGameRules().getBoolean("mobGriefing")) {
|
||||
List list = this.world.a(EntityItem.class, this.boundingBox.grow(1.0D, 0.0D, 1.0D));
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityItem entityitem = (EntityItem) iterator.next();
|
||||
|
||||
if (!entityitem.dead && entityitem.getItemStack() != null) {
|
||||
ItemStack itemstack = entityitem.getItemStack();
|
||||
int i = b(itemstack);
|
||||
|
||||
if (i > -1) {
|
||||
boolean flag = true;
|
||||
ItemStack itemstack1 = this.getEquipment(i);
|
||||
|
||||
if (itemstack1 != null) {
|
||||
if (i == 0) {
|
||||
if (itemstack.getItem() instanceof ItemSword && !(itemstack1.getItem() instanceof ItemSword)) {
|
||||
flag = true;
|
||||
} else if (itemstack.getItem() instanceof ItemSword && itemstack1.getItem() instanceof ItemSword) {
|
||||
ItemSword itemsword = (ItemSword) itemstack.getItem();
|
||||
ItemSword itemsword1 = (ItemSword) itemstack1.getItem();
|
||||
|
||||
if (itemsword.i() == itemsword1.i()) {
|
||||
flag = itemstack.getData() > itemstack1.getData() || itemstack.hasTag() && !itemstack1.hasTag();
|
||||
} else {
|
||||
flag = itemsword.i() > itemsword1.i();
|
||||
}
|
||||
} else {
|
||||
flag = false;
|
||||
}
|
||||
} else if (itemstack.getItem() instanceof ItemArmor && !(itemstack1.getItem() instanceof ItemArmor)) {
|
||||
flag = true;
|
||||
} else if (itemstack.getItem() instanceof ItemArmor && itemstack1.getItem() instanceof ItemArmor) {
|
||||
ItemArmor itemarmor = (ItemArmor) itemstack.getItem();
|
||||
ItemArmor itemarmor1 = (ItemArmor) itemstack1.getItem();
|
||||
|
||||
if (itemarmor.c == itemarmor1.c) {
|
||||
flag = itemstack.getData() > itemstack1.getData() || itemstack.hasTag() && !itemstack1.hasTag();
|
||||
} else {
|
||||
flag = itemarmor.c > itemarmor1.c;
|
||||
}
|
||||
} else {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
if (itemstack1 != null && this.random.nextFloat() - 0.1F < this.dropChances[i]) {
|
||||
this.a(itemstack1, 0.0F);
|
||||
}
|
||||
|
||||
if (itemstack.getItem() == Items.DIAMOND && entityitem.j() != null) {
|
||||
EntityHuman entityhuman = this.world.a(entityitem.j());
|
||||
|
||||
if (entityhuman != null) {
|
||||
entityhuman.a((Statistic) AchievementList.x);
|
||||
}
|
||||
}
|
||||
|
||||
this.setEquipment(i, itemstack);
|
||||
this.dropChances[i] = 2.0F;
|
||||
this.persistent = true;
|
||||
this.receive(entityitem, 1);
|
||||
entityitem.die();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.world.methodProfiler.b();
|
||||
}
|
||||
|
||||
protected boolean bk() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isTypeNotPersistent() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void w() {
|
||||
if (this.persistent) {
|
||||
this.aU = 0;
|
||||
} else {
|
||||
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
|
||||
|
||||
if (entityhuman != null) {
|
||||
double d0 = entityhuman.locX - this.locX;
|
||||
double d1 = entityhuman.locY - this.locY;
|
||||
double d2 = entityhuman.locZ - this.locZ;
|
||||
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
|
||||
if (d3 > 16384.0D) { // CraftBukkit - remove isTypeNotPersistent() check
|
||||
this.die();
|
||||
}
|
||||
|
||||
if (this.aU > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check
|
||||
this.die();
|
||||
} else if (d3 < 1024.0D) {
|
||||
this.aU = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void bn() {
|
||||
++this.aU;
|
||||
this.world.methodProfiler.a("checkDespawn");
|
||||
this.w();
|
||||
this.world.methodProfiler.b();
|
||||
// Spigot Start
|
||||
if ( this.fromMobSpawner )
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Spigot End
|
||||
this.world.methodProfiler.a("sensing");
|
||||
this.bq.a();
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("targetSelector");
|
||||
this.targetSelector.a();
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("goalSelector");
|
||||
this.goalSelector.a();
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("navigation");
|
||||
this.navigation.f();
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("mob tick");
|
||||
this.bp();
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("controls");
|
||||
this.world.methodProfiler.a("move");
|
||||
this.moveController.c();
|
||||
this.world.methodProfiler.c("look");
|
||||
this.lookController.a();
|
||||
this.world.methodProfiler.c("jump");
|
||||
this.bm.b();
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.b();
|
||||
}
|
||||
|
||||
protected void bq() {
|
||||
super.bq();
|
||||
this.bd = 0.0F;
|
||||
this.be = 0.0F;
|
||||
this.w();
|
||||
float f = 8.0F;
|
||||
|
||||
if (this.random.nextFloat() < 0.02F) {
|
||||
EntityHuman entityhuman = this.world.findNearbyPlayer(this, (double) f);
|
||||
|
||||
if (entityhuman != null) {
|
||||
this.bu = entityhuman;
|
||||
this.g = 10 + this.random.nextInt(20);
|
||||
} else {
|
||||
this.bf = (this.random.nextFloat() - 0.5F) * 20.0F;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.bu != null) {
|
||||
this.a(this.bu, 10.0F, (float) this.x());
|
||||
if (this.g-- <= 0 || this.bu.dead || this.bu.f((Entity) this) > (double) (f * f)) {
|
||||
this.bu = null;
|
||||
}
|
||||
} else {
|
||||
if (this.random.nextFloat() < 0.05F) {
|
||||
this.bf = (this.random.nextFloat() - 0.5F) * 20.0F;
|
||||
}
|
||||
|
||||
this.yaw += this.bf;
|
||||
this.pitch = this.f;
|
||||
}
|
||||
|
||||
boolean flag = this.M();
|
||||
boolean flag1 = this.P();
|
||||
|
||||
if (flag || flag1) {
|
||||
this.bc = this.random.nextFloat() < 0.8F;
|
||||
}
|
||||
}
|
||||
|
||||
public int x() {
|
||||
return 40;
|
||||
}
|
||||
|
||||
public void a(Entity entity, float f, float f1) {
|
||||
double d0 = entity.locX - this.locX;
|
||||
double d1 = entity.locZ - this.locZ;
|
||||
double d2;
|
||||
|
||||
if (entity instanceof EntityLiving) {
|
||||
EntityLiving entityliving = (EntityLiving) entity;
|
||||
|
||||
d2 = entityliving.locY + (double) entityliving.getHeadHeight() - (this.locY + (double) this.getHeadHeight());
|
||||
} else {
|
||||
d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.getHeadHeight());
|
||||
}
|
||||
|
||||
double d3 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1);
|
||||
float f2 = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
float f3 = (float) (-(Math.atan2(d2, d3) * 180.0D / 3.1415927410125732D));
|
||||
|
||||
this.pitch = this.b(this.pitch, f3, f1);
|
||||
this.yaw = this.b(this.yaw, f2, f);
|
||||
}
|
||||
|
||||
private float b(float f, float f1, float f2) {
|
||||
float f3 = MathHelper.g(f1 - f);
|
||||
|
||||
if (f3 > f2) {
|
||||
f3 = f2;
|
||||
}
|
||||
|
||||
if (f3 < -f2) {
|
||||
f3 = -f2;
|
||||
}
|
||||
|
||||
return f + f3;
|
||||
}
|
||||
|
||||
public boolean canSpawn() {
|
||||
return this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
|
||||
}
|
||||
|
||||
public int bB() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
public int ax() {
|
||||
if (this.getGoalTarget() == null) {
|
||||
return 3;
|
||||
} else {
|
||||
int i = (int) (this.getHealth() - this.getMaxHealth() * 0.33F);
|
||||
|
||||
i -= (3 - this.world.difficulty.a()) * 4;
|
||||
if (i < 0) {
|
||||
i = 0;
|
||||
}
|
||||
|
||||
return i + 3;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack be() {
|
||||
return this.equipment[0];
|
||||
}
|
||||
|
||||
public ItemStack getEquipment(int i) {
|
||||
return this.equipment[i];
|
||||
}
|
||||
|
||||
public ItemStack r(int i) {
|
||||
return this.equipment[i + 1];
|
||||
}
|
||||
|
||||
public void setEquipment(int i, ItemStack itemstack) {
|
||||
this.equipment[i] = itemstack;
|
||||
}
|
||||
|
||||
public ItemStack[] getEquipment() {
|
||||
return this.equipment;
|
||||
}
|
||||
|
||||
protected void dropEquipment(boolean flag, int i) {
|
||||
for (int j = 0; j < this.getEquipment().length; ++j) {
|
||||
ItemStack itemstack = this.getEquipment(j);
|
||||
boolean flag1 = this.dropChances[j] > 1.0F;
|
||||
|
||||
if (itemstack != null && (flag || flag1) && this.random.nextFloat() - (float) i * 0.01F < this.dropChances[j]) {
|
||||
if (!flag1 && itemstack.g()) {
|
||||
int k = Math.max(itemstack.l() - 25, 1);
|
||||
int l = itemstack.l() - this.random.nextInt(this.random.nextInt(k) + 1);
|
||||
|
||||
if (l > k) {
|
||||
l = k;
|
||||
}
|
||||
|
||||
if (l < 1) {
|
||||
l = 1;
|
||||
}
|
||||
|
||||
itemstack.setData(l);
|
||||
}
|
||||
|
||||
this.a(itemstack, 0.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void bC() {
|
||||
if (this.random.nextFloat() < 0.15F * this.world.b(this.locX, this.locY, this.locZ)) {
|
||||
int i = this.random.nextInt(2);
|
||||
float f = this.world.difficulty == EnumDifficulty.HARD ? 0.1F : 0.25F;
|
||||
|
||||
if (this.random.nextFloat() < 0.095F) {
|
||||
++i;
|
||||
}
|
||||
|
||||
if (this.random.nextFloat() < 0.095F) {
|
||||
++i;
|
||||
}
|
||||
|
||||
if (this.random.nextFloat() < 0.095F) {
|
||||
++i;
|
||||
}
|
||||
|
||||
for (int j = 3; j >= 0; --j) {
|
||||
ItemStack itemstack = this.r(j);
|
||||
|
||||
if (j < 3 && this.random.nextFloat() < f) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (itemstack == null) {
|
||||
Item item = a(j + 1, i);
|
||||
|
||||
if (item != null) {
|
||||
this.setEquipment(j + 1, new ItemStack(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int b(ItemStack itemstack) {
|
||||
if (itemstack.getItem() != Item.getItemOf(Blocks.PUMPKIN) && itemstack.getItem() != Items.SKULL) {
|
||||
if (itemstack.getItem() instanceof ItemArmor) {
|
||||
switch (((ItemArmor) itemstack.getItem()).b) {
|
||||
case 0:
|
||||
return 4;
|
||||
|
||||
case 1:
|
||||
return 3;
|
||||
|
||||
case 2:
|
||||
return 2;
|
||||
|
||||
case 3:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
public static Item a(int i, int j) {
|
||||
switch (i) {
|
||||
case 4:
|
||||
if (j == 0) {
|
||||
return Items.LEATHER_HELMET;
|
||||
} else if (j == 1) {
|
||||
return Items.GOLD_HELMET;
|
||||
} else if (j == 2) {
|
||||
return Items.CHAINMAIL_HELMET;
|
||||
} else if (j == 3) {
|
||||
return Items.IRON_HELMET;
|
||||
} else if (j == 4) {
|
||||
return Items.DIAMOND_HELMET;
|
||||
}
|
||||
|
||||
case 3:
|
||||
if (j == 0) {
|
||||
return Items.LEATHER_CHESTPLATE;
|
||||
} else if (j == 1) {
|
||||
return Items.GOLD_CHESTPLATE;
|
||||
} else if (j == 2) {
|
||||
return Items.CHAINMAIL_CHESTPLATE;
|
||||
} else if (j == 3) {
|
||||
return Items.IRON_CHESTPLATE;
|
||||
} else if (j == 4) {
|
||||
return Items.DIAMOND_CHESTPLATE;
|
||||
}
|
||||
|
||||
case 2:
|
||||
if (j == 0) {
|
||||
return Items.LEATHER_LEGGINGS;
|
||||
} else if (j == 1) {
|
||||
return Items.GOLD_LEGGINGS;
|
||||
} else if (j == 2) {
|
||||
return Items.CHAINMAIL_LEGGINGS;
|
||||
} else if (j == 3) {
|
||||
return Items.IRON_LEGGINGS;
|
||||
} else if (j == 4) {
|
||||
return Items.DIAMOND_LEGGINGS;
|
||||
}
|
||||
|
||||
case 1:
|
||||
if (j == 0) {
|
||||
return Items.LEATHER_BOOTS;
|
||||
} else if (j == 1) {
|
||||
return Items.GOLD_BOOTS;
|
||||
} else if (j == 2) {
|
||||
return Items.CHAINMAIL_BOOTS;
|
||||
} else if (j == 3) {
|
||||
return Items.IRON_BOOTS;
|
||||
} else if (j == 4) {
|
||||
return Items.DIAMOND_BOOTS;
|
||||
}
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void bD() {
|
||||
float f = this.world.b(this.locX, this.locY, this.locZ);
|
||||
|
||||
if (this.be() != null && this.random.nextFloat() < 0.25F * f) {
|
||||
EnchantmentManager.a(this.random, this.be(), (int) (5.0F + f * (float) this.random.nextInt(18)));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
ItemStack itemstack = this.r(i);
|
||||
|
||||
if (itemstack != null && this.random.nextFloat() < 0.5F * f) {
|
||||
EnchantmentManager.a(this.random, itemstack, (int) (5.0F + f * (float) this.random.nextInt(18)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GroupDataEntity prepare(GroupDataEntity groupdataentity) {
|
||||
this.getAttributeInstance(GenericAttributes.b).a(new AttributeModifier("Random spawn bonus", this.random.nextGaussian() * 0.05D, 1));
|
||||
return groupdataentity;
|
||||
}
|
||||
|
||||
public boolean bE() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.hasCustomName() ? this.getCustomName() : super.getName();
|
||||
}
|
||||
|
||||
public void bF() {
|
||||
this.persistent = true;
|
||||
}
|
||||
|
||||
public void setCustomName(String s) {
|
||||
this.datawatcher.watch(10, s);
|
||||
}
|
||||
|
||||
public String getCustomName() {
|
||||
return this.datawatcher.getString(10);
|
||||
}
|
||||
|
||||
public boolean hasCustomName() {
|
||||
return this.datawatcher.getString(10).length() > 0;
|
||||
}
|
||||
|
||||
public void setCustomNameVisible(boolean flag) {
|
||||
this.datawatcher.watch(11, Byte.valueOf((byte) (flag ? 1 : 0)));
|
||||
}
|
||||
|
||||
public boolean getCustomNameVisible() {
|
||||
return this.datawatcher.getByte(11) == 1;
|
||||
}
|
||||
|
||||
public void a(int i, float f) {
|
||||
this.dropChances[i] = f;
|
||||
}
|
||||
|
||||
public boolean bJ() {
|
||||
return this.canPickUpLoot;
|
||||
}
|
||||
|
||||
public void h(boolean flag) {
|
||||
this.canPickUpLoot = flag;
|
||||
}
|
||||
|
||||
public boolean isPersistent() {
|
||||
return this.persistent;
|
||||
}
|
||||
|
||||
public final boolean c(EntityHuman entityhuman) {
|
||||
if (this.bN() && this.getLeashHolder() == entityhuman && BreakLeash) {
|
||||
// CraftBukkit start - fire PlayerUnleashEntityEvent
|
||||
if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) {
|
||||
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder()));
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.unleash(true, !entityhuman.abilities.canInstantlyBuild);
|
||||
return true;
|
||||
} else {
|
||||
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
||||
|
||||
if (itemstack != null && itemstack.getItem() == Items.LEASH && this.bM()) {
|
||||
if (!(this instanceof EntityTameableAnimal) || !((EntityTameableAnimal) this).isTamed()) {
|
||||
// CraftBukkit start - fire PlayerLeashEntityEvent
|
||||
if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman).isCancelled()) {
|
||||
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder()));
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.setLeashHolder(entityhuman, true);
|
||||
--itemstack.count;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (((EntityTameableAnimal) this).e(entityhuman)) {
|
||||
// CraftBukkit start - fire PlayerLeashEntityEvent
|
||||
if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman).isCancelled()) {
|
||||
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder()));
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.setLeashHolder(entityhuman, true);
|
||||
--itemstack.count;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return this.a(entityhuman) ? true : super.c(entityhuman);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean a(EntityHuman entityhuman) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void bL() {
|
||||
if (this.bx != null) {
|
||||
this.bP();
|
||||
}
|
||||
|
||||
if (this.bv) {
|
||||
if (this.bw == null || this.bw.dead) {
|
||||
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.HOLDER_GONE)); // CraftBukkit
|
||||
this.unleash(true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void unleash(boolean flag, boolean flag1) {
|
||||
if (this.bv && BreakLeash) {
|
||||
this.bv = false;
|
||||
this.bw = null;
|
||||
if (!this.world.isStatic && flag1) {
|
||||
this.a(Items.LEASH, 1);
|
||||
}
|
||||
|
||||
if (!this.world.isStatic && flag && this.world instanceof WorldServer) {
|
||||
((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new PacketPlayOutAttachEntity(1, this, (Entity) null)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean bM() {
|
||||
return !this.bN() && !(this instanceof IMonster);
|
||||
}
|
||||
|
||||
public boolean bN() {
|
||||
return this.bv;
|
||||
}
|
||||
|
||||
public Entity getLeashHolder() {
|
||||
return this.bw;
|
||||
}
|
||||
|
||||
public void setLeashHolder(Entity entity, boolean flag) {
|
||||
this.bv = true;
|
||||
this.bw = entity;
|
||||
if (!this.world.isStatic && flag && this.world instanceof WorldServer) {
|
||||
((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new PacketPlayOutAttachEntity(1, this, this.bw)));
|
||||
}
|
||||
}
|
||||
|
||||
private void bP() {
|
||||
if (this.bv && this.bx != null) {
|
||||
if (this.bx.hasKeyOfType("UUIDMost", 4) && this.bx.hasKeyOfType("UUIDLeast", 4)) {
|
||||
UUID uuid = new UUID(this.bx.getLong("UUIDMost"), this.bx.getLong("UUIDLeast"));
|
||||
List list = this.world.a(EntityLiving.class, this.boundingBox.grow(10.0D, 10.0D, 10.0D));
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityLiving entityliving = (EntityLiving) iterator.next();
|
||||
|
||||
if (entityliving.getUniqueID().equals(uuid)) {
|
||||
this.bw = entityliving;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (this.bx.hasKeyOfType("X", 99) && this.bx.hasKeyOfType("Y", 99) && this.bx.hasKeyOfType("Z", 99)) {
|
||||
int i = this.bx.getInt("X");
|
||||
int j = this.bx.getInt("Y");
|
||||
int k = this.bx.getInt("Z");
|
||||
EntityLeash entityleash = EntityLeash.b(this.world, i, j, k);
|
||||
|
||||
if (entityleash == null) {
|
||||
entityleash = EntityLeash.a(this.world, i, j, k);
|
||||
}
|
||||
|
||||
this.bw = entityleash;
|
||||
} else {
|
||||
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
this.unleash(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
this.bx = null;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,269 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.SlimeSplitEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntitySlime extends EntityInsentient implements IMonster {
|
||||
|
||||
public float h;
|
||||
public float i;
|
||||
public float bm;
|
||||
private int jumpDelay;
|
||||
private Entity lastTarget; // CraftBukkit
|
||||
|
||||
public EntitySlime(World world) {
|
||||
super(world);
|
||||
int i = 1 << this.random.nextInt(3);
|
||||
|
||||
this.height = 0.0F;
|
||||
this.jumpDelay = this.random.nextInt(20) + 10;
|
||||
this.setSize(i);
|
||||
}
|
||||
|
||||
protected void c() {
|
||||
super.c();
|
||||
this.datawatcher.a(16, new Byte((byte) 1));
|
||||
}
|
||||
|
||||
// CraftBukkit - protected -> public
|
||||
public void setSize(int i) {
|
||||
this.datawatcher.watch(16, new Byte((byte) i));
|
||||
this.a(0.6F * (float) i, 0.6F * (float) i);
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
this.getAttributeInstance(GenericAttributes.maxHealth).setValue((double) (i * i));
|
||||
this.setHealth(this.getMaxHealth());
|
||||
this.b = i;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return this.datawatcher.getByte(16);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.setInt("Size", this.getSize() - 1);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
int i = nbttagcompound.getInt("Size");
|
||||
|
||||
if (i < 0) {
|
||||
i = 0;
|
||||
}
|
||||
|
||||
this.setSize(i + 1);
|
||||
}
|
||||
|
||||
protected String bP() {
|
||||
return "slime";
|
||||
}
|
||||
|
||||
protected String bV() {
|
||||
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
|
||||
}
|
||||
|
||||
public void h() {
|
||||
if (!this.world.isStatic && this.world.difficulty == EnumDifficulty.PEACEFUL && this.getSize() > 0) {
|
||||
this.dead = true;
|
||||
}
|
||||
|
||||
this.i += (this.h - this.i) * 0.5F;
|
||||
this.bm = this.i;
|
||||
boolean flag = this.onGround;
|
||||
|
||||
super.h();
|
||||
int i;
|
||||
|
||||
if (this.onGround && !flag) {
|
||||
i = this.getSize();
|
||||
|
||||
for (int j = 0; j < i * 8; ++j) {
|
||||
float f = this.random.nextFloat() * 3.1415927F * 2.0F;
|
||||
float f1 = this.random.nextFloat() * 0.5F + 0.5F;
|
||||
float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1;
|
||||
float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1;
|
||||
|
||||
this.world.addParticle(this.bP(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
if (this.bW()) {
|
||||
this.makeSound(this.bV(), this.bf(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
|
||||
}
|
||||
|
||||
this.h = -0.5F;
|
||||
} else if (!this.onGround && flag) {
|
||||
this.h = 1.0F;
|
||||
}
|
||||
|
||||
this.bS();
|
||||
if (this.world.isStatic) {
|
||||
i = this.getSize();
|
||||
this.a(0.6F * (float) i, 0.6F * (float) i);
|
||||
}
|
||||
}
|
||||
|
||||
protected void bq() {
|
||||
this.w();
|
||||
|
||||
if (Vegetated)
|
||||
return;
|
||||
|
||||
// CraftBukkit start
|
||||
Entity entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D); // EntityHuman -> Entity
|
||||
EntityTargetEvent event = null;
|
||||
|
||||
if (entityhuman != null && !entityhuman.equals(lastTarget)) {
|
||||
event = CraftEventFactory.callEntityTargetEvent(this, entityhuman, EntityTargetEvent.TargetReason.CLOSEST_PLAYER);
|
||||
} else if (lastTarget != null && entityhuman == null) {
|
||||
event = CraftEventFactory.callEntityTargetEvent(this, entityhuman, EntityTargetEvent.TargetReason.FORGOT_TARGET);
|
||||
}
|
||||
|
||||
if (event != null && !event.isCancelled()) {
|
||||
entityhuman = event.getTarget() == null ? null : ((CraftEntity) event.getTarget()).getHandle();
|
||||
}
|
||||
|
||||
this.lastTarget = entityhuman;
|
||||
// CraftBukkit end
|
||||
|
||||
if (entityhuman != null) {
|
||||
this.a(entityhuman, 10.0F, 20.0F);
|
||||
}
|
||||
|
||||
if (this.onGround && this.jumpDelay-- <= 0) {
|
||||
this.jumpDelay = this.bR();
|
||||
if (entityhuman != null) {
|
||||
this.jumpDelay /= 3;
|
||||
}
|
||||
|
||||
this.bc = true;
|
||||
if (this.bY()) {
|
||||
this.makeSound(this.bV(), this.bf(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
|
||||
}
|
||||
|
||||
this.bd = 1.0F - this.random.nextFloat() * 2.0F;
|
||||
this.be = (float) (1 * this.getSize());
|
||||
} else {
|
||||
this.bc = false;
|
||||
if (this.onGround) {
|
||||
this.bd = this.be = 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void bS() {
|
||||
this.h *= 0.6F;
|
||||
}
|
||||
|
||||
protected int bR() {
|
||||
return this.random.nextInt(20) + 10;
|
||||
}
|
||||
|
||||
protected EntitySlime bQ() {
|
||||
return new EntitySlime(this.world);
|
||||
}
|
||||
|
||||
public void die() {
|
||||
int i = this.getSize();
|
||||
|
||||
if (!this.world.isStatic && i > 1 && this.getHealth() <= 0.0F) {
|
||||
int j = 2 + this.random.nextInt(3);
|
||||
|
||||
// CraftBukkit start
|
||||
SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), j);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled() && event.getCount() > 0) {
|
||||
j = event.getCount();
|
||||
} else {
|
||||
super.die();
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
|
||||
float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
|
||||
EntitySlime entityslime = this.bQ();
|
||||
|
||||
entityslime.setSize(i / 2);
|
||||
entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
|
||||
this.world.addEntity(entityslime, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
|
||||
}
|
||||
}
|
||||
|
||||
super.die();
|
||||
}
|
||||
|
||||
public void b_(EntityHuman entityhuman) {
|
||||
if (this.bT()) {
|
||||
int i = this.getSize();
|
||||
|
||||
if (this.hasLineOfSight(entityhuman) && this.f(entityhuman) < 0.6D * (double) i * 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), (float) this.bU())) {
|
||||
this.makeSound("mob.attack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean bT() {
|
||||
return this.getSize() > 1;
|
||||
}
|
||||
|
||||
protected int bU() {
|
||||
return this.getSize();
|
||||
}
|
||||
|
||||
protected String aT() {
|
||||
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
|
||||
}
|
||||
|
||||
protected String aU() {
|
||||
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
|
||||
}
|
||||
|
||||
protected Item getLoot() {
|
||||
return this.getSize() == 1 ? Items.SLIME_BALL : Item.getById(0);
|
||||
}
|
||||
|
||||
public boolean canSpawn() {
|
||||
Chunk chunk = this.world.getChunkAtWorldCoords(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
|
||||
|
||||
if (this.world.getWorldData().getType() == WorldType.FLAT && this.random.nextInt(4) != 1) {
|
||||
return false;
|
||||
} else {
|
||||
if (this.getSize() == 1 || this.world.difficulty != EnumDifficulty.PEACEFUL) {
|
||||
BiomeBase biomebase = this.world.getBiome(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
|
||||
|
||||
if (biomebase == BiomeBase.SWAMPLAND && this.locY > 50.0D && this.locY < 70.0D && this.random.nextFloat() < 0.5F && this.random.nextFloat() < this.world.y() && this.world.getLightLevel(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) <= this.random.nextInt(8)) {
|
||||
return super.canSpawn();
|
||||
}
|
||||
|
||||
if (this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 40.0D) {
|
||||
return super.canSpawn();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected float bf() {
|
||||
return 0.4F * (float) this.getSize();
|
||||
}
|
||||
|
||||
public int x() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected boolean bY() {
|
||||
return this.getSize() > 0;
|
||||
}
|
||||
|
||||
protected boolean bW() {
|
||||
return this.getSize() > 2;
|
||||
}
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
||||
|
||||
public class EntityTNTPrimed extends Entity {
|
||||
|
||||
public int fuseTicks;
|
||||
private EntityLiving source;
|
||||
public float yield = 4; // CraftBukkit - add field
|
||||
public boolean isIncendiary = false; // CraftBukkit - add field
|
||||
|
||||
public boolean spectating = false;
|
||||
|
||||
public EntityTNTPrimed(World world) {
|
||||
super(world);
|
||||
this.k = true;
|
||||
this.a(0.98F, 0.98F);
|
||||
this.height = this.length / 2.0F;
|
||||
}
|
||||
|
||||
public EntityTNTPrimed(World world, double d0, double d1, double d2, EntityLiving entityliving) {
|
||||
this(world);
|
||||
this.setPosition(d0, d1, d2);
|
||||
float f = (float) (Math.random() * 3.1415927410125732D * 2.0D);
|
||||
|
||||
this.motX = (double) (-((float) Math.sin((double) f)) * 0.02F);
|
||||
this.motY = 0.20000000298023224D;
|
||||
this.motZ = (double) (-((float) Math.cos((double) f)) * 0.02F);
|
||||
this.fuseTicks = 80;
|
||||
this.lastX = d0;
|
||||
this.lastY = d1;
|
||||
this.lastZ = d2;
|
||||
this.source = entityliving;
|
||||
}
|
||||
|
||||
protected void c() {}
|
||||
|
||||
protected boolean g_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean R() {
|
||||
return !this.dead && !spectating;
|
||||
}
|
||||
|
||||
public void h() {
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
this.motY -= 0.03999999910593033D;
|
||||
this.move(this.motX, this.motY, this.motZ);
|
||||
this.motX *= 0.9800000190734863D;
|
||||
this.motY *= 0.9800000190734863D;
|
||||
this.motZ *= 0.9800000190734863D;
|
||||
if (this.onGround) {
|
||||
this.motX *= 0.699999988079071D;
|
||||
this.motZ *= 0.699999988079071D;
|
||||
this.motY *= -0.5D;
|
||||
}
|
||||
|
||||
if (this.fuseTicks-- <= 0) {
|
||||
// CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
|
||||
if (!this.world.isStatic) {
|
||||
this.explode();
|
||||
}
|
||||
this.die();
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
this.world.addParticle("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
private void explode() {
|
||||
// CraftBukkit start
|
||||
// float f = 4.0F;
|
||||
|
||||
org.bukkit.craftbukkit.v1_7_R4.CraftServer server = this.world.getServer();
|
||||
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity.getEntity(server, this));
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
// give 'this' instead of (Entity) null so we know what causes the damage
|
||||
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), true);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected void b(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setByte("Fuse", (byte) this.fuseTicks);
|
||||
}
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
this.fuseTicks = nbttagcompound.getByte("Fuse");
|
||||
}
|
||||
|
||||
public EntityLiving getSource() {
|
||||
return this.source;
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
public interface IPacketVerifier
|
||||
{
|
||||
boolean verify(Packet packet);
|
||||
}
|
@ -1,308 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.net.SocketAddress;
|
||||
import java.util.Queue;
|
||||
import javax.crypto.SecretKey;
|
||||
|
||||
import net.minecraft.util.com.google.common.collect.Queues;
|
||||
import net.minecraft.util.com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import net.minecraft.util.com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.util.io.netty.channel.Channel;
|
||||
import net.minecraft.util.io.netty.channel.ChannelFutureListener;
|
||||
import net.minecraft.util.io.netty.channel.ChannelHandlerContext;
|
||||
import net.minecraft.util.io.netty.channel.SimpleChannelInboundHandler;
|
||||
import net.minecraft.util.io.netty.channel.local.LocalChannel;
|
||||
import net.minecraft.util.io.netty.channel.local.LocalServerChannel;
|
||||
import net.minecraft.util.io.netty.channel.nio.NioEventLoopGroup;
|
||||
import net.minecraft.util.io.netty.handler.timeout.TimeoutException;
|
||||
import net.minecraft.util.io.netty.util.AttributeKey;
|
||||
import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
|
||||
import net.minecraft.util.org.apache.commons.lang3.Validate;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.Marker;
|
||||
import org.apache.logging.log4j.MarkerManager;
|
||||
// Spigot start
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
// Spigot end
|
||||
|
||||
public class NetworkManager extends SimpleChannelInboundHandler
|
||||
{
|
||||
|
||||
private static final Logger i = LogManager.getLogger();
|
||||
public static final Marker a = MarkerManager.getMarker("NETWORK");
|
||||
public static final Marker b = MarkerManager.getMarker("NETWORK_PACKETS", a);
|
||||
public static final Marker c = MarkerManager.getMarker("NETWORK_STAT", a);
|
||||
public static final AttributeKey d = new AttributeKey("protocol");
|
||||
public static final AttributeKey e = new AttributeKey("receivable_packets");
|
||||
public static final AttributeKey f = new AttributeKey("sendable_packets");
|
||||
public static final NioEventLoopGroup g = new NioEventLoopGroup(0, (new ThreadFactoryBuilder())
|
||||
.setNameFormat("Netty Client IO #%d").setDaemon(true).build());
|
||||
public static final NetworkStatistics h = new NetworkStatistics();
|
||||
private final boolean j;
|
||||
private final Queue k = Queues.newConcurrentLinkedQueue();
|
||||
private final Queue l = Queues.newConcurrentLinkedQueue();
|
||||
private Channel m;
|
||||
// Spigot Start
|
||||
public SocketAddress n;
|
||||
public java.util.UUID spoofedUUID;
|
||||
public Property[] spoofedProfile;
|
||||
public boolean preparing = true;
|
||||
// Spigot End
|
||||
private PacketListener o;
|
||||
private EnumProtocol p;
|
||||
private IChatBaseComponent q;
|
||||
private boolean r;
|
||||
// Spigot Start
|
||||
public static final AttributeKey<Integer> protocolVersion = new AttributeKey<Integer>("protocol_version");
|
||||
public static final ImmutableSet<Integer> SUPPORTED_VERSIONS = ImmutableSet.of(4, 5);
|
||||
public static final int CURRENT_VERSION = 5;
|
||||
|
||||
public static int getVersion(Channel attr)
|
||||
{
|
||||
Integer ver = attr.attr(protocolVersion).get();
|
||||
return (ver != null) ? ver : CURRENT_VERSION;
|
||||
}
|
||||
|
||||
public int getVersion()
|
||||
{
|
||||
return getVersion(this.m);
|
||||
}
|
||||
|
||||
// Spigot End
|
||||
|
||||
public NetworkManager(boolean flag)
|
||||
{
|
||||
this.j = flag;
|
||||
}
|
||||
|
||||
public void channelActive(ChannelHandlerContext channelhandlercontext) throws Exception
|
||||
{ // CraftBukkit - throws Exception
|
||||
super.channelActive(channelhandlercontext);
|
||||
this.m = channelhandlercontext.channel();
|
||||
this.n = this.m.remoteAddress();
|
||||
// Spigot Start
|
||||
this.preparing = false;
|
||||
// Spigot End
|
||||
this.a(EnumProtocol.HANDSHAKING);
|
||||
}
|
||||
|
||||
public void a(EnumProtocol enumprotocol)
|
||||
{
|
||||
this.p = (EnumProtocol) this.m.attr(d).getAndSet(enumprotocol);
|
||||
this.m.attr(e).set(enumprotocol.a(this.j));
|
||||
this.m.attr(f).set(enumprotocol.b(this.j));
|
||||
this.m.config().setAutoRead(true);
|
||||
i.debug("Enabled auto read");
|
||||
}
|
||||
|
||||
public void channelInactive(ChannelHandlerContext channelhandlercontext)
|
||||
{
|
||||
this.close(new ChatMessage("disconnect.endOfStream", new Object[0]));
|
||||
}
|
||||
|
||||
public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable)
|
||||
{
|
||||
ChatMessage chatmessage;
|
||||
|
||||
if (throwable instanceof TimeoutException)
|
||||
{
|
||||
chatmessage = new ChatMessage("disconnect.timeout", new Object[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
chatmessage = new ChatMessage("disconnect.genericReason",
|
||||
new Object[] { "Internal Exception: " + throwable });
|
||||
}
|
||||
|
||||
this.close(chatmessage);
|
||||
if (MinecraftServer.getServer().isDebugging())
|
||||
{
|
||||
throwable.printStackTrace(); // Spigot
|
||||
System.out.println("------------");
|
||||
for (StackTraceElement trace : Thread.currentThread().getStackTrace())
|
||||
{
|
||||
System.out.println(trace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(ChannelHandlerContext channelhandlercontext, Packet packet)
|
||||
{
|
||||
if (this.m.isOpen())
|
||||
{
|
||||
if (packet.a())
|
||||
{
|
||||
packet.handle(this.o);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.k.add(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(PacketListener packetlistener)
|
||||
{
|
||||
Validate.notNull(packetlistener, "packetListener", new Object[0]);
|
||||
i.debug("Set listener of {} to {}", new Object[] { this, packetlistener });
|
||||
this.o = packetlistener;
|
||||
}
|
||||
|
||||
public void handle(Packet packet, GenericFutureListener... agenericfuturelistener)
|
||||
{
|
||||
if (this.m != null && this.m.isOpen())
|
||||
{
|
||||
this.i();
|
||||
this.b(packet, agenericfuturelistener);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.l.add(new QueuedPacket(packet, agenericfuturelistener));
|
||||
}
|
||||
}
|
||||
|
||||
private void b(Packet packet, GenericFutureListener[] agenericfuturelistener)
|
||||
{
|
||||
EnumProtocol enumprotocol = EnumProtocol.a(packet);
|
||||
EnumProtocol enumprotocol1 = (EnumProtocol) this.m.attr(d).get();
|
||||
|
||||
if (enumprotocol1 != enumprotocol)
|
||||
{
|
||||
i.debug("Disabled auto read");
|
||||
this.m.config().setAutoRead(false);
|
||||
}
|
||||
|
||||
if (this.m.eventLoop().inEventLoop())
|
||||
{
|
||||
if (enumprotocol != enumprotocol1)
|
||||
{
|
||||
this.a(enumprotocol);
|
||||
}
|
||||
|
||||
this.m.writeAndFlush(packet).addListeners(agenericfuturelistener)
|
||||
.addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.m.eventLoop().execute(
|
||||
new QueuedProtocolSwitch(this, enumprotocol, enumprotocol1, packet, agenericfuturelistener));
|
||||
}
|
||||
}
|
||||
|
||||
private void i()
|
||||
{
|
||||
if (this.m != null && this.m.isOpen())
|
||||
{
|
||||
while (!this.l.isEmpty())
|
||||
{
|
||||
QueuedPacket queuedpacket = (QueuedPacket) this.l.poll();
|
||||
|
||||
this.b(QueuedPacket.a(queuedpacket), QueuedPacket.b(queuedpacket));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a()
|
||||
{
|
||||
this.i();
|
||||
EnumProtocol enumprotocol = (EnumProtocol) this.m.attr(d).get();
|
||||
|
||||
if (this.p != enumprotocol)
|
||||
{
|
||||
if (this.p != null)
|
||||
{
|
||||
this.o.a(this.p, enumprotocol);
|
||||
}
|
||||
|
||||
this.p = enumprotocol;
|
||||
}
|
||||
|
||||
if (this.o != null)
|
||||
{
|
||||
for (int i = 1000; !this.k.isEmpty() && i >= 0; --i)
|
||||
{
|
||||
Packet packet = (Packet) this.k.poll();
|
||||
|
||||
// CraftBukkit start
|
||||
if (!this.isConnected() || !this.m.config().isAutoRead())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// CraftBukkit end
|
||||
packet.handle(this.o);
|
||||
}
|
||||
|
||||
this.o.a();
|
||||
}
|
||||
|
||||
this.m.flush();
|
||||
}
|
||||
|
||||
public SocketAddress getSocketAddress()
|
||||
{
|
||||
return this.n;
|
||||
}
|
||||
|
||||
public void close(IChatBaseComponent ichatbasecomponent)
|
||||
{
|
||||
// Spigot Start
|
||||
this.preparing = false;
|
||||
// Spigot End
|
||||
if (this.m.isOpen())
|
||||
{
|
||||
this.m.close();
|
||||
this.q = ichatbasecomponent;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean c()
|
||||
{
|
||||
return this.m instanceof LocalChannel || this.m instanceof LocalServerChannel;
|
||||
}
|
||||
|
||||
public void a(SecretKey secretkey)
|
||||
{
|
||||
this.m.pipeline().addBefore("splitter", "decrypt", new PacketDecrypter(MinecraftEncryption.a(2, secretkey)));
|
||||
this.m.pipeline().addBefore("prepender", "encrypt", new PacketEncrypter(MinecraftEncryption.a(1, secretkey)));
|
||||
this.r = true;
|
||||
}
|
||||
|
||||
public boolean isConnected()
|
||||
{
|
||||
return this.m != null && this.m.isOpen();
|
||||
}
|
||||
|
||||
public PacketListener getPacketListener()
|
||||
{
|
||||
return this.o;
|
||||
}
|
||||
|
||||
public IChatBaseComponent f()
|
||||
{
|
||||
return this.q;
|
||||
}
|
||||
|
||||
public void g()
|
||||
{
|
||||
this.m.config().setAutoRead(false);
|
||||
}
|
||||
|
||||
protected void channelRead0(ChannelHandlerContext channelhandlercontext, Object object)
|
||||
{
|
||||
this.a(channelhandlercontext, (Packet) object);
|
||||
}
|
||||
|
||||
static Channel a(NetworkManager networkmanager)
|
||||
{
|
||||
return networkmanager.m;
|
||||
}
|
||||
|
||||
// Spigot Start
|
||||
public SocketAddress getRawAddress()
|
||||
{
|
||||
return this.m.remoteAddress();
|
||||
}
|
||||
// Spigot End
|
||||
}
|
@ -1,922 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.channels.GatheringByteChannel;
|
||||
import java.nio.channels.ScatteringByteChannel;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import net.minecraft.util.com.google.common.base.Charsets;
|
||||
import net.minecraft.util.io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.util.io.netty.buffer.ByteBufAllocator;
|
||||
import net.minecraft.util.io.netty.buffer.ByteBufProcessor;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack; // CraftBukkit
|
||||
|
||||
public class PacketDataSerializer extends ByteBuf
|
||||
{
|
||||
|
||||
private final ByteBuf a;
|
||||
// Spigot Start
|
||||
public final int version;
|
||||
|
||||
public PacketDataSerializer(ByteBuf bytebuf)
|
||||
{
|
||||
this(bytebuf, NetworkManager.CURRENT_VERSION);
|
||||
}
|
||||
|
||||
public PacketDataSerializer(ByteBuf bytebuf, int version)
|
||||
{
|
||||
this.a = bytebuf;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
// Spigot End
|
||||
|
||||
public static int a(int i)
|
||||
{
|
||||
return (i & -128) == 0 ? 1 : ((i & -16384) == 0 ? 2 : ((i & -2097152) == 0 ? 3
|
||||
: ((i & -268435456) == 0 ? 4 : 5)));
|
||||
}
|
||||
|
||||
public int a()
|
||||
{
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
|
||||
byte b0;
|
||||
|
||||
do
|
||||
{
|
||||
b0 = this.readByte();
|
||||
i |= (b0 & 127) << j++ * 7;
|
||||
if (j > 5)
|
||||
{
|
||||
throw new RuntimeException("VarInt too big");
|
||||
}
|
||||
}
|
||||
while ((b0 & 128) == 128);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public void b(int i)
|
||||
{
|
||||
while ((i & -128) != 0)
|
||||
{
|
||||
this.writeByte(i & 127 | 128);
|
||||
i >>>= 7;
|
||||
}
|
||||
|
||||
this.writeByte(i);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
if (nbttagcompound == null)
|
||||
{
|
||||
this.writeShort(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] abyte = NBTCompressedStreamTools.a(nbttagcompound);
|
||||
|
||||
this.writeShort((short) abyte.length);
|
||||
this.writeBytes(abyte);
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound b()
|
||||
{
|
||||
short short1 = this.readShort();
|
||||
|
||||
if (short1 < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] abyte = new byte[short1];
|
||||
|
||||
this.readBytes(abyte);
|
||||
return NBTCompressedStreamTools.a(abyte, new NBTReadLimiter(2097152L));
|
||||
}
|
||||
}
|
||||
|
||||
public void a(ItemStack itemstack)
|
||||
{
|
||||
if (itemstack == null || itemstack.getItem() == null)
|
||||
{ // CraftBukkit - NPE fix itemstack.getItem()
|
||||
this.writeShort(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.writeShort(Item.getId(itemstack.getItem()));
|
||||
this.writeByte(itemstack.count);
|
||||
this.writeShort(itemstack.getData());
|
||||
NBTTagCompound nbttagcompound = null;
|
||||
|
||||
if (itemstack.getItem().usesDurability() || itemstack.getItem().s())
|
||||
{
|
||||
nbttagcompound = itemstack.tag;
|
||||
}
|
||||
|
||||
this.a(nbttagcompound);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack c()
|
||||
{
|
||||
ItemStack itemstack = null;
|
||||
short short1 = this.readShort();
|
||||
|
||||
if (short1 >= 0)
|
||||
{
|
||||
byte b0 = this.readByte();
|
||||
short short2 = this.readShort();
|
||||
|
||||
itemstack = new ItemStack(Item.getById(short1), b0, short2);
|
||||
itemstack.tag = this.b();
|
||||
// CraftBukkit start
|
||||
if (itemstack.tag != null)
|
||||
{
|
||||
CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
public String c(int i) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
int j = this.a();
|
||||
|
||||
if (j > i * 4)
|
||||
{
|
||||
throw new IOException("The received encoded string buffer length is longer than maximum allowed (" + j
|
||||
+ " > " + i * 4 + ")");
|
||||
}
|
||||
else if (j < 0)
|
||||
{
|
||||
throw new IOException("The received encoded string buffer length is less than zero! Weird string!");
|
||||
}
|
||||
else
|
||||
{
|
||||
String s = new String(this.readBytes(j).array(), Charsets.UTF_8);
|
||||
|
||||
if (s.length() > i)
|
||||
{
|
||||
throw new IOException("The received string length is longer than maximum allowed (" + j + " > " + i
|
||||
+ ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(String s) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
byte[] abyte = s.getBytes(Charsets.UTF_8);
|
||||
|
||||
if (abyte.length > 32767)
|
||||
{
|
||||
throw new IOException("String too big (was " + s.length() + " bytes encoded, max " + 32767 + ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.b(abyte.length);
|
||||
this.writeBytes(abyte);
|
||||
}
|
||||
}
|
||||
|
||||
public int capacity()
|
||||
{
|
||||
return this.a.capacity();
|
||||
}
|
||||
|
||||
public ByteBuf capacity(int i)
|
||||
{
|
||||
return this.a.capacity(i);
|
||||
}
|
||||
|
||||
public int maxCapacity()
|
||||
{
|
||||
return this.a.maxCapacity();
|
||||
}
|
||||
|
||||
public ByteBufAllocator alloc()
|
||||
{
|
||||
return this.a.alloc();
|
||||
}
|
||||
|
||||
public ByteOrder order()
|
||||
{
|
||||
return this.a.order();
|
||||
}
|
||||
|
||||
public ByteBuf order(ByteOrder byteorder)
|
||||
{
|
||||
return this.a.order(byteorder);
|
||||
}
|
||||
|
||||
public ByteBuf unwrap()
|
||||
{
|
||||
return this.a.unwrap();
|
||||
}
|
||||
|
||||
public boolean isDirect()
|
||||
{
|
||||
return this.a.isDirect();
|
||||
}
|
||||
|
||||
public int readerIndex()
|
||||
{
|
||||
return this.a.readerIndex();
|
||||
}
|
||||
|
||||
public ByteBuf readerIndex(int i)
|
||||
{
|
||||
return this.a.readerIndex(i);
|
||||
}
|
||||
|
||||
public int writerIndex()
|
||||
{
|
||||
return this.a.writerIndex();
|
||||
}
|
||||
|
||||
public ByteBuf writerIndex(int i)
|
||||
{
|
||||
return this.a.writerIndex(i);
|
||||
}
|
||||
|
||||
public ByteBuf setIndex(int i, int j)
|
||||
{
|
||||
return this.a.setIndex(i, j);
|
||||
}
|
||||
|
||||
public int readableBytes()
|
||||
{
|
||||
return this.a.readableBytes();
|
||||
}
|
||||
|
||||
public int writableBytes()
|
||||
{
|
||||
return this.a.writableBytes();
|
||||
}
|
||||
|
||||
public int maxWritableBytes()
|
||||
{
|
||||
return this.a.maxWritableBytes();
|
||||
}
|
||||
|
||||
public boolean isReadable()
|
||||
{
|
||||
return this.a.isReadable();
|
||||
}
|
||||
|
||||
public boolean isReadable(int i)
|
||||
{
|
||||
return this.a.isReadable(i);
|
||||
}
|
||||
|
||||
public boolean isWritable()
|
||||
{
|
||||
return this.a.isWritable();
|
||||
}
|
||||
|
||||
public boolean isWritable(int i)
|
||||
{
|
||||
return this.a.isWritable(i);
|
||||
}
|
||||
|
||||
public ByteBuf clear()
|
||||
{
|
||||
return this.a.clear();
|
||||
}
|
||||
|
||||
public ByteBuf markReaderIndex()
|
||||
{
|
||||
return this.a.markReaderIndex();
|
||||
}
|
||||
|
||||
public ByteBuf resetReaderIndex()
|
||||
{
|
||||
return this.a.resetReaderIndex();
|
||||
}
|
||||
|
||||
public ByteBuf markWriterIndex()
|
||||
{
|
||||
return this.a.markWriterIndex();
|
||||
}
|
||||
|
||||
public ByteBuf resetWriterIndex()
|
||||
{
|
||||
return this.a.resetWriterIndex();
|
||||
}
|
||||
|
||||
public ByteBuf discardReadBytes()
|
||||
{
|
||||
return this.a.discardReadBytes();
|
||||
}
|
||||
|
||||
public ByteBuf discardSomeReadBytes()
|
||||
{
|
||||
return this.a.discardSomeReadBytes();
|
||||
}
|
||||
|
||||
public ByteBuf ensureWritable(int i)
|
||||
{
|
||||
return this.a.ensureWritable(i);
|
||||
}
|
||||
|
||||
public int ensureWritable(int i, boolean flag)
|
||||
{
|
||||
return this.a.ensureWritable(i, flag);
|
||||
}
|
||||
|
||||
public boolean getBoolean(int i)
|
||||
{
|
||||
return this.a.getBoolean(i);
|
||||
}
|
||||
|
||||
public byte getByte(int i)
|
||||
{
|
||||
return this.a.getByte(i);
|
||||
}
|
||||
|
||||
public short getUnsignedByte(int i)
|
||||
{
|
||||
return this.a.getUnsignedByte(i);
|
||||
}
|
||||
|
||||
public short getShort(int i)
|
||||
{
|
||||
return this.a.getShort(i);
|
||||
}
|
||||
|
||||
public int getUnsignedShort(int i)
|
||||
{
|
||||
return this.a.getUnsignedShort(i);
|
||||
}
|
||||
|
||||
public int getMedium(int i)
|
||||
{
|
||||
return this.a.getMedium(i);
|
||||
}
|
||||
|
||||
public int getUnsignedMedium(int i)
|
||||
{
|
||||
return this.a.getUnsignedMedium(i);
|
||||
}
|
||||
|
||||
public int getInt(int i)
|
||||
{
|
||||
return this.a.getInt(i);
|
||||
}
|
||||
|
||||
public long getUnsignedInt(int i)
|
||||
{
|
||||
return this.a.getUnsignedInt(i);
|
||||
}
|
||||
|
||||
public long getLong(int i)
|
||||
{
|
||||
return this.a.getLong(i);
|
||||
}
|
||||
|
||||
public char getChar(int i)
|
||||
{
|
||||
return this.a.getChar(i);
|
||||
}
|
||||
|
||||
public float getFloat(int i)
|
||||
{
|
||||
return this.a.getFloat(i);
|
||||
}
|
||||
|
||||
public double getDouble(int i)
|
||||
{
|
||||
return this.a.getDouble(i);
|
||||
}
|
||||
|
||||
public ByteBuf getBytes(int i, ByteBuf bytebuf)
|
||||
{
|
||||
return this.a.getBytes(i, bytebuf);
|
||||
}
|
||||
|
||||
public ByteBuf getBytes(int i, ByteBuf bytebuf, int j)
|
||||
{
|
||||
return this.a.getBytes(i, bytebuf, j);
|
||||
}
|
||||
|
||||
public ByteBuf getBytes(int i, ByteBuf bytebuf, int j, int k)
|
||||
{
|
||||
return this.a.getBytes(i, bytebuf, j, k);
|
||||
}
|
||||
|
||||
public ByteBuf getBytes(int i, byte[] abyte)
|
||||
{
|
||||
return this.a.getBytes(i, abyte);
|
||||
}
|
||||
|
||||
public ByteBuf getBytes(int i, byte[] abyte, int j, int k)
|
||||
{
|
||||
return this.a.getBytes(i, abyte, j, k);
|
||||
}
|
||||
|
||||
public ByteBuf getBytes(int i, ByteBuffer bytebuffer)
|
||||
{
|
||||
return this.a.getBytes(i, bytebuffer);
|
||||
}
|
||||
|
||||
public ByteBuf getBytes(int i, OutputStream outputstream, int j) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
return this.a.getBytes(i, outputstream, j);
|
||||
}
|
||||
|
||||
public int getBytes(int i, GatheringByteChannel gatheringbytechannel, int j) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
return this.a.getBytes(i, gatheringbytechannel, j);
|
||||
}
|
||||
|
||||
public ByteBuf setBoolean(int i, boolean flag)
|
||||
{
|
||||
return this.a.setBoolean(i, flag);
|
||||
}
|
||||
|
||||
public ByteBuf setByte(int i, int j)
|
||||
{
|
||||
return this.a.setByte(i, j);
|
||||
}
|
||||
|
||||
public ByteBuf setShort(int i, int j)
|
||||
{
|
||||
return this.a.setShort(i, j);
|
||||
}
|
||||
|
||||
public ByteBuf setMedium(int i, int j)
|
||||
{
|
||||
return this.a.setMedium(i, j);
|
||||
}
|
||||
|
||||
public ByteBuf setInt(int i, int j)
|
||||
{
|
||||
return this.a.setInt(i, j);
|
||||
}
|
||||
|
||||
public ByteBuf setLong(int i, long j)
|
||||
{
|
||||
return this.a.setLong(i, j);
|
||||
}
|
||||
|
||||
public ByteBuf setChar(int i, int j)
|
||||
{
|
||||
return this.a.setChar(i, j);
|
||||
}
|
||||
|
||||
public ByteBuf setFloat(int i, float f)
|
||||
{
|
||||
return this.a.setFloat(i, f);
|
||||
}
|
||||
|
||||
public ByteBuf setDouble(int i, double d0)
|
||||
{
|
||||
return this.a.setDouble(i, d0);
|
||||
}
|
||||
|
||||
public ByteBuf setBytes(int i, ByteBuf bytebuf)
|
||||
{
|
||||
return this.a.setBytes(i, bytebuf);
|
||||
}
|
||||
|
||||
public ByteBuf setBytes(int i, ByteBuf bytebuf, int j)
|
||||
{
|
||||
return this.a.setBytes(i, bytebuf, j);
|
||||
}
|
||||
|
||||
public ByteBuf setBytes(int i, ByteBuf bytebuf, int j, int k)
|
||||
{
|
||||
return this.a.setBytes(i, bytebuf, j, k);
|
||||
}
|
||||
|
||||
public ByteBuf setBytes(int i, byte[] abyte)
|
||||
{
|
||||
return this.a.setBytes(i, abyte);
|
||||
}
|
||||
|
||||
public ByteBuf setBytes(int i, byte[] abyte, int j, int k)
|
||||
{
|
||||
return this.a.setBytes(i, abyte, j, k);
|
||||
}
|
||||
|
||||
public ByteBuf setBytes(int i, ByteBuffer bytebuffer)
|
||||
{
|
||||
return this.a.setBytes(i, bytebuffer);
|
||||
}
|
||||
|
||||
public int setBytes(int i, InputStream inputstream, int j) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
return this.a.setBytes(i, inputstream, j);
|
||||
}
|
||||
|
||||
public int setBytes(int i, ScatteringByteChannel scatteringbytechannel, int j) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
return this.a.setBytes(i, scatteringbytechannel, j);
|
||||
}
|
||||
|
||||
public ByteBuf setZero(int i, int j)
|
||||
{
|
||||
return this.a.setZero(i, j);
|
||||
}
|
||||
|
||||
public boolean readBoolean()
|
||||
{
|
||||
return this.a.readBoolean();
|
||||
}
|
||||
|
||||
public byte readByte()
|
||||
{
|
||||
return this.a.readByte();
|
||||
}
|
||||
|
||||
public short readUnsignedByte()
|
||||
{
|
||||
return this.a.readUnsignedByte();
|
||||
}
|
||||
|
||||
public short readShort()
|
||||
{
|
||||
return this.a.readShort();
|
||||
}
|
||||
|
||||
public int readUnsignedShort()
|
||||
{
|
||||
return this.a.readUnsignedShort();
|
||||
}
|
||||
|
||||
public int readMedium()
|
||||
{
|
||||
return this.a.readMedium();
|
||||
}
|
||||
|
||||
public int readUnsignedMedium()
|
||||
{
|
||||
return this.a.readUnsignedMedium();
|
||||
}
|
||||
|
||||
public int readInt()
|
||||
{
|
||||
return this.a.readInt();
|
||||
}
|
||||
|
||||
public long readUnsignedInt()
|
||||
{
|
||||
return this.a.readUnsignedInt();
|
||||
}
|
||||
|
||||
public long readLong()
|
||||
{
|
||||
return this.a.readLong();
|
||||
}
|
||||
|
||||
public char readChar()
|
||||
{
|
||||
return this.a.readChar();
|
||||
}
|
||||
|
||||
public float readFloat()
|
||||
{
|
||||
return this.a.readFloat();
|
||||
}
|
||||
|
||||
public double readDouble()
|
||||
{
|
||||
return this.a.readDouble();
|
||||
}
|
||||
|
||||
public ByteBuf readBytes(int i)
|
||||
{
|
||||
return this.a.readBytes(i);
|
||||
}
|
||||
|
||||
public ByteBuf readSlice(int i)
|
||||
{
|
||||
return this.a.readSlice(i);
|
||||
}
|
||||
|
||||
public ByteBuf readBytes(ByteBuf bytebuf)
|
||||
{
|
||||
return this.a.readBytes(bytebuf);
|
||||
}
|
||||
|
||||
public ByteBuf readBytes(ByteBuf bytebuf, int i)
|
||||
{
|
||||
return this.a.readBytes(bytebuf, i);
|
||||
}
|
||||
|
||||
public ByteBuf readBytes(ByteBuf bytebuf, int i, int j)
|
||||
{
|
||||
return this.a.readBytes(bytebuf, i, j);
|
||||
}
|
||||
|
||||
public ByteBuf readBytes(byte[] abyte)
|
||||
{
|
||||
return this.a.readBytes(abyte);
|
||||
}
|
||||
|
||||
public ByteBuf readBytes(byte[] abyte, int i, int j)
|
||||
{
|
||||
return this.a.readBytes(abyte, i, j);
|
||||
}
|
||||
|
||||
public ByteBuf readBytes(ByteBuffer bytebuffer)
|
||||
{
|
||||
return this.a.readBytes(bytebuffer);
|
||||
}
|
||||
|
||||
public ByteBuf readBytes(OutputStream outputstream, int i) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
return this.a.readBytes(outputstream, i);
|
||||
}
|
||||
|
||||
public int readBytes(GatheringByteChannel gatheringbytechannel, int i) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
return this.a.readBytes(gatheringbytechannel, i);
|
||||
}
|
||||
|
||||
public ByteBuf skipBytes(int i)
|
||||
{
|
||||
return this.a.skipBytes(i);
|
||||
}
|
||||
|
||||
public ByteBuf writeBoolean(boolean flag)
|
||||
{
|
||||
return this.a.writeBoolean(flag);
|
||||
}
|
||||
|
||||
public ByteBuf writeByte(int i)
|
||||
{
|
||||
return this.a.writeByte(i);
|
||||
}
|
||||
|
||||
public ByteBuf writeShort(int i)
|
||||
{
|
||||
return this.a.writeShort(i);
|
||||
}
|
||||
|
||||
public ByteBuf writeMedium(int i)
|
||||
{
|
||||
return this.a.writeMedium(i);
|
||||
}
|
||||
|
||||
public ByteBuf writeInt(int i)
|
||||
{
|
||||
return this.a.writeInt(i);
|
||||
}
|
||||
|
||||
public ByteBuf writeLong(long i)
|
||||
{
|
||||
return this.a.writeLong(i);
|
||||
}
|
||||
|
||||
public ByteBuf writeChar(int i)
|
||||
{
|
||||
return this.a.writeChar(i);
|
||||
}
|
||||
|
||||
public ByteBuf writeFloat(float f)
|
||||
{
|
||||
return this.a.writeFloat(f);
|
||||
}
|
||||
|
||||
public ByteBuf writeDouble(double d0)
|
||||
{
|
||||
return this.a.writeDouble(d0);
|
||||
}
|
||||
|
||||
public ByteBuf writeBytes(ByteBuf bytebuf)
|
||||
{
|
||||
return this.a.writeBytes(bytebuf);
|
||||
}
|
||||
|
||||
public ByteBuf writeBytes(ByteBuf bytebuf, int i)
|
||||
{
|
||||
return this.a.writeBytes(bytebuf, i);
|
||||
}
|
||||
|
||||
public ByteBuf writeBytes(ByteBuf bytebuf, int i, int j)
|
||||
{
|
||||
return this.a.writeBytes(bytebuf, i, j);
|
||||
}
|
||||
|
||||
public ByteBuf writeBytes(byte[] abyte)
|
||||
{
|
||||
return this.a.writeBytes(abyte);
|
||||
}
|
||||
|
||||
public ByteBuf writeBytes(byte[] abyte, int i, int j)
|
||||
{
|
||||
return this.a.writeBytes(abyte, i, j);
|
||||
}
|
||||
|
||||
public ByteBuf writeBytes(ByteBuffer bytebuffer)
|
||||
{
|
||||
return this.a.writeBytes(bytebuffer);
|
||||
}
|
||||
|
||||
public int writeBytes(InputStream inputstream, int i) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
return this.a.writeBytes(inputstream, i);
|
||||
}
|
||||
|
||||
public int writeBytes(ScatteringByteChannel scatteringbytechannel, int i) throws IOException
|
||||
{ // CraftBukkit - throws IOException
|
||||
return this.a.writeBytes(scatteringbytechannel, i);
|
||||
}
|
||||
|
||||
public ByteBuf writeZero(int i)
|
||||
{
|
||||
return this.a.writeZero(i);
|
||||
}
|
||||
|
||||
public int indexOf(int i, int j, byte b0)
|
||||
{
|
||||
return this.a.indexOf(i, j, b0);
|
||||
}
|
||||
|
||||
public int bytesBefore(byte b0)
|
||||
{
|
||||
return this.a.bytesBefore(b0);
|
||||
}
|
||||
|
||||
public int bytesBefore(int i, byte b0)
|
||||
{
|
||||
return this.a.bytesBefore(i, b0);
|
||||
}
|
||||
|
||||
public int bytesBefore(int i, int j, byte b0)
|
||||
{
|
||||
return this.a.bytesBefore(i, j, b0);
|
||||
}
|
||||
|
||||
public int forEachByte(ByteBufProcessor bytebufprocessor)
|
||||
{
|
||||
return this.a.forEachByte(bytebufprocessor);
|
||||
}
|
||||
|
||||
public int forEachByte(int i, int j, ByteBufProcessor bytebufprocessor)
|
||||
{
|
||||
return this.a.forEachByte(i, j, bytebufprocessor);
|
||||
}
|
||||
|
||||
public int forEachByteDesc(ByteBufProcessor bytebufprocessor)
|
||||
{
|
||||
return this.a.forEachByteDesc(bytebufprocessor);
|
||||
}
|
||||
|
||||
public int forEachByteDesc(int i, int j, ByteBufProcessor bytebufprocessor)
|
||||
{
|
||||
return this.a.forEachByteDesc(i, j, bytebufprocessor);
|
||||
}
|
||||
|
||||
public ByteBuf copy()
|
||||
{
|
||||
return this.a.copy();
|
||||
}
|
||||
|
||||
public ByteBuf copy(int i, int j)
|
||||
{
|
||||
return this.a.copy(i, j);
|
||||
}
|
||||
|
||||
public ByteBuf slice()
|
||||
{
|
||||
return this.a.slice();
|
||||
}
|
||||
|
||||
public ByteBuf slice(int i, int j)
|
||||
{
|
||||
return this.a.slice(i, j);
|
||||
}
|
||||
|
||||
public ByteBuf duplicate()
|
||||
{
|
||||
return this.a.duplicate();
|
||||
}
|
||||
|
||||
public int nioBufferCount()
|
||||
{
|
||||
return this.a.nioBufferCount();
|
||||
}
|
||||
|
||||
public ByteBuffer nioBuffer()
|
||||
{
|
||||
return this.a.nioBuffer();
|
||||
}
|
||||
|
||||
public ByteBuffer nioBuffer(int i, int j)
|
||||
{
|
||||
return this.a.nioBuffer(i, j);
|
||||
}
|
||||
|
||||
public ByteBuffer internalNioBuffer(int i, int j)
|
||||
{
|
||||
return this.a.internalNioBuffer(i, j);
|
||||
}
|
||||
|
||||
public ByteBuffer[] nioBuffers()
|
||||
{
|
||||
return this.a.nioBuffers();
|
||||
}
|
||||
|
||||
public ByteBuffer[] nioBuffers(int i, int j)
|
||||
{
|
||||
return this.a.nioBuffers(i, j);
|
||||
}
|
||||
|
||||
public boolean hasArray()
|
||||
{
|
||||
return this.a.hasArray();
|
||||
}
|
||||
|
||||
public byte[] array()
|
||||
{
|
||||
return this.a.array();
|
||||
}
|
||||
|
||||
public int arrayOffset()
|
||||
{
|
||||
return this.a.arrayOffset();
|
||||
}
|
||||
|
||||
public boolean hasMemoryAddress()
|
||||
{
|
||||
return this.a.hasMemoryAddress();
|
||||
}
|
||||
|
||||
public long memoryAddress()
|
||||
{
|
||||
return this.a.memoryAddress();
|
||||
}
|
||||
|
||||
public String toString(Charset charset)
|
||||
{
|
||||
return this.a.toString(charset);
|
||||
}
|
||||
|
||||
public String toString(int i, int j, Charset charset)
|
||||
{
|
||||
return this.a.toString(i, j, charset);
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
return this.a.hashCode();
|
||||
}
|
||||
|
||||
public boolean equals(Object object)
|
||||
{
|
||||
return this.a.equals(object);
|
||||
}
|
||||
|
||||
public int compareTo(ByteBuf bytebuf)
|
||||
{
|
||||
return this.a.compareTo(bytebuf);
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.a.toString();
|
||||
}
|
||||
|
||||
public ByteBuf retain(int i)
|
||||
{
|
||||
return this.a.retain(i);
|
||||
}
|
||||
|
||||
public ByteBuf retain()
|
||||
{
|
||||
return this.a.retain();
|
||||
}
|
||||
|
||||
public int refCnt()
|
||||
{
|
||||
return this.a.refCnt();
|
||||
}
|
||||
|
||||
public boolean release()
|
||||
{
|
||||
return this.a.release();
|
||||
}
|
||||
|
||||
public boolean release(int i)
|
||||
{
|
||||
return this.a.release(i);
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
public class PacketPlayInCloseWindow
|
||||
extends Packet
|
||||
{
|
||||
public int a;
|
||||
|
||||
public PacketPlayInCloseWindow() {}
|
||||
|
||||
public PacketPlayInCloseWindow(int id)
|
||||
{
|
||||
this.a = id;
|
||||
}
|
||||
|
||||
public void a(PacketPlayInListener packetplayinlistener)
|
||||
{
|
||||
packetplayinlistener.a(this);
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer packetdataserializer)
|
||||
{
|
||||
this.a = packetdataserializer.readByte();
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer packetdataserializer)
|
||||
{
|
||||
packetdataserializer.writeByte(this.a);
|
||||
}
|
||||
|
||||
public void handle(PacketListener packetlistener)
|
||||
{
|
||||
a((PacketPlayInListener)packetlistener);
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
public class PacketPlayOutAnimation extends Packet
|
||||
{
|
||||
public int a;
|
||||
public int b;
|
||||
|
||||
public PacketPlayOutAnimation() {}
|
||||
|
||||
public PacketPlayOutAnimation(Entity paramEntity, int paramInt)
|
||||
{
|
||||
this.a = paramEntity.getId();
|
||||
this.b = paramInt;
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
this.a = paramPacketDataSerializer.a();
|
||||
this.b = paramPacketDataSerializer.readUnsignedByte();
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
paramPacketDataSerializer.b(this.a);
|
||||
paramPacketDataSerializer.writeByte(this.b);
|
||||
}
|
||||
|
||||
public void a(PacketPlayOutListener paramPacketPlayOutListener)
|
||||
{
|
||||
paramPacketPlayOutListener.a(this);
|
||||
}
|
||||
|
||||
public String b()
|
||||
{
|
||||
return String.format("id=%d, type=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b) });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketListener arg0)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
public class PacketPlayOutAttachEntity extends Packet
|
||||
{
|
||||
public int a;
|
||||
public int b;
|
||||
public int c;
|
||||
|
||||
public PacketPlayOutAttachEntity() {}
|
||||
|
||||
public PacketPlayOutAttachEntity(int paramInt, Entity paramEntity1, Entity paramEntity2)
|
||||
{
|
||||
this.a = paramInt;
|
||||
this.b = paramEntity1.getId();
|
||||
this.c = (paramEntity2 != null ? paramEntity2.getId() : -1);
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
this.b = paramPacketDataSerializer.readInt();
|
||||
this.c = paramPacketDataSerializer.readInt();
|
||||
this.a = paramPacketDataSerializer.readUnsignedByte();
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
paramPacketDataSerializer.writeInt(this.b);
|
||||
paramPacketDataSerializer.writeInt(this.c);
|
||||
paramPacketDataSerializer.writeByte(this.a);
|
||||
}
|
||||
|
||||
public void a(PacketPlayOutListener paramPacketPlayOutListener)
|
||||
{
|
||||
paramPacketPlayOutListener.a(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketListener arg0)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
public class PacketPlayOutEntity
|
||||
extends Packet
|
||||
{
|
||||
public int a;
|
||||
public byte b;
|
||||
public byte c;
|
||||
public byte d;
|
||||
public byte e;
|
||||
public byte f;
|
||||
public boolean g;
|
||||
|
||||
public PacketPlayOutEntity() {}
|
||||
|
||||
public PacketPlayOutEntity(int paramInt)
|
||||
{
|
||||
this.a = paramInt;
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
this.a = paramPacketDataSerializer.readInt();
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
paramPacketDataSerializer.writeInt(this.a);
|
||||
}
|
||||
|
||||
public void a(PacketPlayOutListener paramPacketPlayOutListener)
|
||||
{
|
||||
paramPacketPlayOutListener.a(this);
|
||||
}
|
||||
|
||||
public String b()
|
||||
{
|
||||
return String.format("id=%d", new Object[] { Integer.valueOf(this.a) });
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Entity_" + super.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketListener arg0)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
public class PacketPlayOutEntityEquipment extends Packet
|
||||
{
|
||||
public int a;
|
||||
public int b;
|
||||
private ItemStack c;
|
||||
|
||||
public PacketPlayOutEntityEquipment() {}
|
||||
|
||||
public PacketPlayOutEntityEquipment(int paramInt1, int paramInt2, ItemStack paramItemStack)
|
||||
{
|
||||
this.a = paramInt1;
|
||||
this.b = paramInt2;
|
||||
this.c = (paramItemStack == null ? null : paramItemStack.cloneItemStack());
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
this.a = paramPacketDataSerializer.readInt();
|
||||
this.b = paramPacketDataSerializer.readShort();
|
||||
this.c = paramPacketDataSerializer.c();
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
paramPacketDataSerializer.writeInt(this.a);
|
||||
paramPacketDataSerializer.writeShort(this.b);
|
||||
paramPacketDataSerializer.a(this.c);
|
||||
}
|
||||
|
||||
public void a(PacketPlayOutListener paramPacketPlayOutListener)
|
||||
{
|
||||
paramPacketPlayOutListener.a(this);
|
||||
}
|
||||
|
||||
public String b()
|
||||
{
|
||||
return String.format("entity=%d, slot=%d, item=%s", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b), this.c });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketListener paramPacketListener)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PacketPlayOutEntityMetadata extends Packet
|
||||
{
|
||||
public int a;
|
||||
public List b;
|
||||
|
||||
public PacketPlayOutEntityMetadata() {}
|
||||
|
||||
public PacketPlayOutEntityMetadata(int paramInt, DataWatcher paramDataWatcher, boolean paramBoolean)
|
||||
{
|
||||
this.a = paramInt;
|
||||
if (paramBoolean) {
|
||||
this.b = paramDataWatcher.c();
|
||||
} else {
|
||||
this.b = paramDataWatcher.b();
|
||||
}
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
this.a = paramPacketDataSerializer.readInt();
|
||||
this.b = DataWatcher.b(paramPacketDataSerializer);
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
paramPacketDataSerializer.writeInt(this.a);
|
||||
DataWatcher.a(this.b, paramPacketDataSerializer);
|
||||
}
|
||||
|
||||
public void a(PacketPlayOutListener paramPacketPlayOutListener)
|
||||
{
|
||||
paramPacketPlayOutListener.a(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketListener arg0)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
public class PacketPlayOutEntityTeleport extends Packet
|
||||
{
|
||||
public int a;
|
||||
public int b;
|
||||
public int c;
|
||||
public int d;
|
||||
public byte e;
|
||||
public byte f;
|
||||
|
||||
public PacketPlayOutEntityTeleport()
|
||||
{
|
||||
}
|
||||
|
||||
public PacketPlayOutEntityTeleport(Entity paramEntity)
|
||||
{
|
||||
this.a = paramEntity.getId();
|
||||
this.b = MathHelper.floor(paramEntity.locX * 32.0D);
|
||||
this.c = MathHelper.floor(paramEntity.locY * 32.0D);
|
||||
this.d = MathHelper.floor(paramEntity.locZ * 32.0D);
|
||||
this.e = ((byte) (int) (paramEntity.yaw * 256.0F / 360.0F));
|
||||
this.f = ((byte) (int) (paramEntity.pitch * 256.0F / 360.0F));
|
||||
}
|
||||
|
||||
public PacketPlayOutEntityTeleport(int paramInt1, int paramInt2, int paramInt3, int paramInt4, byte paramByte1,
|
||||
byte paramByte2)
|
||||
{
|
||||
this.a = paramInt1;
|
||||
this.b = paramInt2;
|
||||
this.c = paramInt3;
|
||||
this.d = paramInt4;
|
||||
this.e = paramByte1;
|
||||
this.f = paramByte2;
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
this.a = paramPacketDataSerializer.readInt();
|
||||
this.b = paramPacketDataSerializer.readInt();
|
||||
this.c = paramPacketDataSerializer.readInt();
|
||||
this.d = paramPacketDataSerializer.readInt();
|
||||
this.e = paramPacketDataSerializer.readByte();
|
||||
this.f = paramPacketDataSerializer.readByte();
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
paramPacketDataSerializer.writeInt(this.a);
|
||||
paramPacketDataSerializer.writeInt(this.b);
|
||||
paramPacketDataSerializer.writeInt(this.c);
|
||||
paramPacketDataSerializer.writeInt(this.d);
|
||||
paramPacketDataSerializer.writeByte(this.e);
|
||||
paramPacketDataSerializer.writeByte(this.f);
|
||||
}
|
||||
|
||||
public void a(PacketPlayOutListener paramPacketPlayOutListener)
|
||||
{
|
||||
paramPacketPlayOutListener.a(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketListener arg0)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
public class PacketPlayOutEntityVelocity
|
||||
extends Packet
|
||||
{
|
||||
public int a;
|
||||
public int b;
|
||||
public int c;
|
||||
public int d;
|
||||
|
||||
public PacketPlayOutEntityVelocity() {}
|
||||
|
||||
public PacketPlayOutEntityVelocity(Entity paramEntity)
|
||||
{
|
||||
this(paramEntity.getId(), paramEntity.motX, paramEntity.motY, paramEntity.motZ);
|
||||
}
|
||||
|
||||
public PacketPlayOutEntityVelocity(int paramInt, double paramDouble1, double paramDouble2, double paramDouble3)
|
||||
{
|
||||
this.a = paramInt;
|
||||
double d1 = 3.9D;
|
||||
if (paramDouble1 < -d1) {
|
||||
paramDouble1 = -d1;
|
||||
}
|
||||
if (paramDouble2 < -d1) {
|
||||
paramDouble2 = -d1;
|
||||
}
|
||||
if (paramDouble3 < -d1) {
|
||||
paramDouble3 = -d1;
|
||||
}
|
||||
if (paramDouble1 > d1) {
|
||||
paramDouble1 = d1;
|
||||
}
|
||||
if (paramDouble2 > d1) {
|
||||
paramDouble2 = d1;
|
||||
}
|
||||
if (paramDouble3 > d1) {
|
||||
paramDouble3 = d1;
|
||||
}
|
||||
this.b = ((int)(paramDouble1 * 8000.0D));
|
||||
this.c = ((int)(paramDouble2 * 8000.0D));
|
||||
this.d = ((int)(paramDouble3 * 8000.0D));
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
this.a = paramPacketDataSerializer.readInt();
|
||||
this.b = paramPacketDataSerializer.readShort();
|
||||
this.c = paramPacketDataSerializer.readShort();
|
||||
this.d = paramPacketDataSerializer.readShort();
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
paramPacketDataSerializer.writeInt(this.a);
|
||||
paramPacketDataSerializer.writeShort(this.b);
|
||||
paramPacketDataSerializer.writeShort(this.c);
|
||||
paramPacketDataSerializer.writeShort(this.d);
|
||||
}
|
||||
|
||||
public void a(PacketPlayOutListener paramPacketPlayOutListener)
|
||||
{
|
||||
paramPacketPlayOutListener.a(this);
|
||||
}
|
||||
|
||||
public String b()
|
||||
{
|
||||
return String.format("id=%d, x=%.2f, y=%.2f, z=%.2f", new Object[] { Integer.valueOf(this.a), Float.valueOf(this.b / 8000.0F), Float.valueOf(this.c / 8000.0F), Float.valueOf(this.d / 8000.0F) });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketListener arg0)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.util.com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
|
||||
import java.io.IOException; // CraftBukkit
|
||||
|
||||
public class PacketPlayOutNamedEntitySpawn extends Packet {
|
||||
|
||||
public int a;
|
||||
public GameProfile b;
|
||||
public int c;
|
||||
public int d;
|
||||
public int e;
|
||||
public byte f;
|
||||
public byte g;
|
||||
public int h;
|
||||
public DataWatcher i;
|
||||
public List j;
|
||||
|
||||
public PacketPlayOutNamedEntitySpawn() {}
|
||||
|
||||
public PacketPlayOutNamedEntitySpawn(EntityHuman entityhuman) {
|
||||
this.a = entityhuman.getId();
|
||||
this.b = entityhuman.getProfile();
|
||||
this.c = MathHelper.floor(entityhuman.locX * 32.0D);
|
||||
this.d = MathHelper.floor(entityhuman.locY * 32.0D);
|
||||
this.e = MathHelper.floor(entityhuman.locZ * 32.0D);
|
||||
this.f = (byte) ((int) (entityhuman.yaw * 256.0F / 360.0F));
|
||||
this.g = (byte) ((int) (entityhuman.pitch * 256.0F / 360.0F));
|
||||
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
||||
|
||||
this.h = itemstack == null ? 0 : Item.getId(itemstack.getItem());
|
||||
this.i = entityhuman.getDataWatcher();
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws
|
||||
this.a = packetdataserializer.a();
|
||||
UUID uuid = UUID.fromString(packetdataserializer.c(36));
|
||||
|
||||
this.b = new GameProfile(uuid, packetdataserializer.c(16));
|
||||
int i = packetdataserializer.a();
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
String s = packetdataserializer.c(32767);
|
||||
String s1 = packetdataserializer.c(32767);
|
||||
String s2 = packetdataserializer.c(32767);
|
||||
|
||||
this.b.getProperties().put(s, new Property(s, s1, s2));
|
||||
}
|
||||
this.c = packetdataserializer.readInt();
|
||||
this.d = packetdataserializer.readInt();
|
||||
this.e = packetdataserializer.readInt();
|
||||
this.f = packetdataserializer.readByte();
|
||||
this.g = packetdataserializer.readByte();
|
||||
this.h = packetdataserializer.readShort();
|
||||
this.j = DataWatcher.b(packetdataserializer);
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws
|
||||
packetdataserializer.b(this.a);
|
||||
UUID uuid = this.b.getId();
|
||||
|
||||
packetdataserializer.a( uuid == null ? "" : ( ( packetdataserializer.version >= 5 ) ? uuid.toString() : uuid.toString().replaceAll( "-", "" ) ) ); // Spigot
|
||||
packetdataserializer.a(this.b.getName().length() > 16 ? this.b.getName().substring(0, 16) : this.b.getName()); // CraftBukkit - Limit name length to 16 characters
|
||||
if (packetdataserializer.version >= 5 )
|
||||
{ // Spigot
|
||||
packetdataserializer.b(this.b.getProperties().size());
|
||||
Iterator iterator = this.b.getProperties().values().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Property property = (Property) iterator.next();
|
||||
|
||||
packetdataserializer.a(property.getName());
|
||||
packetdataserializer.a(property.getValue());
|
||||
packetdataserializer.a(property.getSignature());
|
||||
}
|
||||
} // Spigot
|
||||
packetdataserializer.writeInt(this.c);
|
||||
packetdataserializer.writeInt(this.d);
|
||||
packetdataserializer.writeInt(this.e);
|
||||
packetdataserializer.writeByte(this.f);
|
||||
packetdataserializer.writeByte(this.g);
|
||||
packetdataserializer.writeShort(this.h);
|
||||
this.i.a(packetdataserializer);
|
||||
}
|
||||
|
||||
public void a(PacketPlayOutListener packetplayoutlistener) {
|
||||
packetplayoutlistener.a(this);
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return String.format("id=%d, gameProfile=\'%s\', x=%.2f, y=%.2f, z=%.2f, carried=%d", new Object[] { Integer.valueOf(this.a), this.b, Float.valueOf((float) this.c / 32.0F), Float.valueOf((float) this.d / 32.0F), Float.valueOf((float) this.e / 32.0F), Integer.valueOf(this.h)});
|
||||
}
|
||||
|
||||
public void handle(PacketListener packetlistener) {
|
||||
this.a((PacketPlayOutListener) packetlistener);
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
public class PacketPlayOutRelEntityMove
|
||||
extends PacketPlayOutEntity
|
||||
{
|
||||
public PacketPlayOutRelEntityMove() {}
|
||||
|
||||
public PacketPlayOutRelEntityMove(int paramInt, byte paramByte1, byte paramByte2, byte paramByte3)
|
||||
{
|
||||
super(paramInt);
|
||||
this.b = paramByte1;
|
||||
this.c = paramByte2;
|
||||
this.d = paramByte3;
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
super.a(paramPacketDataSerializer);
|
||||
this.b = paramPacketDataSerializer.readByte();
|
||||
this.c = paramPacketDataSerializer.readByte();
|
||||
this.d = paramPacketDataSerializer.readByte();
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
super.b(paramPacketDataSerializer);
|
||||
paramPacketDataSerializer.writeByte(this.b);
|
||||
paramPacketDataSerializer.writeByte(this.c);
|
||||
paramPacketDataSerializer.writeByte(this.d);
|
||||
}
|
||||
|
||||
public String b()
|
||||
{
|
||||
return super.b() + String.format(", xa=%d, ya=%d, za=%d", new Object[] { Byte.valueOf(this.b), Byte.valueOf(this.c), Byte.valueOf(this.d) });
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
public class PacketPlayOutRelEntityMoveLook
|
||||
extends PacketPlayOutEntity
|
||||
{
|
||||
public PacketPlayOutRelEntityMoveLook()
|
||||
{
|
||||
this.g = true;
|
||||
}
|
||||
|
||||
public PacketPlayOutRelEntityMoveLook(int paramInt, byte paramByte1, byte paramByte2, byte paramByte3, byte paramByte4, byte paramByte5)
|
||||
{
|
||||
super(paramInt);
|
||||
this.b = paramByte1;
|
||||
this.c = paramByte2;
|
||||
this.d = paramByte3;
|
||||
this.e = paramByte4;
|
||||
this.f = paramByte5;
|
||||
this.g = true;
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
super.a(paramPacketDataSerializer);
|
||||
this.b = paramPacketDataSerializer.readByte();
|
||||
this.c = paramPacketDataSerializer.readByte();
|
||||
this.d = paramPacketDataSerializer.readByte();
|
||||
this.e = paramPacketDataSerializer.readByte();
|
||||
this.f = paramPacketDataSerializer.readByte();
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
super.b(paramPacketDataSerializer);
|
||||
paramPacketDataSerializer.writeByte(this.b);
|
||||
paramPacketDataSerializer.writeByte(this.c);
|
||||
paramPacketDataSerializer.writeByte(this.d);
|
||||
paramPacketDataSerializer.writeByte(this.e);
|
||||
paramPacketDataSerializer.writeByte(this.f);
|
||||
}
|
||||
|
||||
public String b()
|
||||
{
|
||||
return super.b() + String.format(", xa=%d, ya=%d, za=%d, yRot=%d, xRot=%d", new Object[] { Byte.valueOf(this.b), Byte.valueOf(this.c), Byte.valueOf(this.d), Byte.valueOf(this.e), Byte.valueOf(this.f) });
|
||||
}
|
||||
}
|
@ -1,144 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
public class PacketPlayOutSpawnEntity extends Packet
|
||||
{
|
||||
public int a;
|
||||
public int b;
|
||||
public int c;
|
||||
public int d;
|
||||
public int e;
|
||||
public int f;
|
||||
public int g;
|
||||
public int h;
|
||||
public int i;
|
||||
public int j;
|
||||
public int k;
|
||||
|
||||
public PacketPlayOutSpawnEntity() {}
|
||||
|
||||
public PacketPlayOutSpawnEntity(Entity paramEntity, int paramInt)
|
||||
{
|
||||
this(paramEntity, paramInt, 0);
|
||||
}
|
||||
|
||||
public PacketPlayOutSpawnEntity(Entity paramEntity, int paramInt1, int paramInt2)
|
||||
{
|
||||
this.a = paramEntity.getId();
|
||||
this.b = MathHelper.floor(paramEntity.locX * 32.0D);
|
||||
this.c = MathHelper.floor(paramEntity.locY * 32.0D);
|
||||
this.d = MathHelper.floor(paramEntity.locZ * 32.0D);
|
||||
this.h = MathHelper.d(paramEntity.pitch * 256.0F / 360.0F);
|
||||
this.i = MathHelper.d(paramEntity.yaw * 256.0F / 360.0F);
|
||||
this.j = paramInt1;
|
||||
this.k = paramInt2;
|
||||
if (paramInt2 > 0)
|
||||
{
|
||||
double d1 = paramEntity.motX;
|
||||
double d2 = paramEntity.motY;
|
||||
double d3 = paramEntity.motZ;
|
||||
double d4 = 3.9D;
|
||||
if (d1 < -d4) {
|
||||
d1 = -d4;
|
||||
}
|
||||
if (d2 < -d4) {
|
||||
d2 = -d4;
|
||||
}
|
||||
if (d3 < -d4) {
|
||||
d3 = -d4;
|
||||
}
|
||||
if (d1 > d4) {
|
||||
d1 = d4;
|
||||
}
|
||||
if (d2 > d4) {
|
||||
d2 = d4;
|
||||
}
|
||||
if (d3 > d4) {
|
||||
d3 = d4;
|
||||
}
|
||||
this.e = ((int)(d1 * 8000.0D));
|
||||
this.f = ((int)(d2 * 8000.0D));
|
||||
this.g = ((int)(d3 * 8000.0D));
|
||||
}
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
this.a = paramPacketDataSerializer.a();
|
||||
this.j = paramPacketDataSerializer.readByte();
|
||||
this.b = paramPacketDataSerializer.readInt();
|
||||
this.c = paramPacketDataSerializer.readInt();
|
||||
this.d = paramPacketDataSerializer.readInt();
|
||||
this.h = paramPacketDataSerializer.readByte();
|
||||
this.i = paramPacketDataSerializer.readByte();
|
||||
this.k = paramPacketDataSerializer.readInt();
|
||||
if (this.k > 0)
|
||||
{
|
||||
this.e = paramPacketDataSerializer.readShort();
|
||||
this.f = paramPacketDataSerializer.readShort();
|
||||
this.g = paramPacketDataSerializer.readShort();
|
||||
}
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
paramPacketDataSerializer.b(this.a);
|
||||
paramPacketDataSerializer.writeByte(this.j);
|
||||
paramPacketDataSerializer.writeInt(this.b);
|
||||
paramPacketDataSerializer.writeInt(this.c);
|
||||
paramPacketDataSerializer.writeInt(this.d);
|
||||
paramPacketDataSerializer.writeByte(this.h);
|
||||
paramPacketDataSerializer.writeByte(this.i);
|
||||
paramPacketDataSerializer.writeInt(this.k);
|
||||
if (this.k > 0)
|
||||
{
|
||||
paramPacketDataSerializer.writeShort(this.e);
|
||||
paramPacketDataSerializer.writeShort(this.f);
|
||||
paramPacketDataSerializer.writeShort(this.g);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(PacketPlayOutListener paramPacketPlayOutListener)
|
||||
{
|
||||
paramPacketPlayOutListener.a(this);
|
||||
}
|
||||
|
||||
public String b()
|
||||
{
|
||||
return String.format("id=%d, type=%d, x=%.2f, y=%.2f, z=%.2f", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.j), Float.valueOf(this.b / 32.0F), Float.valueOf(this.c / 32.0F), Float.valueOf(this.d / 32.0F) });
|
||||
}
|
||||
|
||||
public void a(int paramInt)
|
||||
{
|
||||
this.b = paramInt;
|
||||
}
|
||||
|
||||
public void b(int paramInt)
|
||||
{
|
||||
this.c = paramInt;
|
||||
}
|
||||
|
||||
public void c(int paramInt)
|
||||
{
|
||||
this.d = paramInt;
|
||||
}
|
||||
|
||||
public void d(int paramInt)
|
||||
{
|
||||
this.e = paramInt;
|
||||
}
|
||||
|
||||
public void e(int paramInt)
|
||||
{
|
||||
this.f = paramInt;
|
||||
}
|
||||
|
||||
public void f(int paramInt)
|
||||
{
|
||||
this.g = paramInt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketListener arg0)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,122 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PacketPlayOutSpawnEntityLiving extends Packet
|
||||
{
|
||||
public int a;
|
||||
public int b;
|
||||
public int c;
|
||||
public int d;
|
||||
public int e;
|
||||
public int f;
|
||||
public int g;
|
||||
public int h;
|
||||
public byte i;
|
||||
public byte j;
|
||||
public byte k;
|
||||
public DataWatcher l;
|
||||
public List m;
|
||||
|
||||
public PacketPlayOutSpawnEntityLiving()
|
||||
{
|
||||
}
|
||||
|
||||
public PacketPlayOutSpawnEntityLiving(EntityLiving paramEntityLiving)
|
||||
{
|
||||
this.a = paramEntityLiving.getId();
|
||||
|
||||
this.b = ((byte) EntityTypes.a(paramEntityLiving));
|
||||
this.c = paramEntityLiving.as.a(paramEntityLiving.locX);
|
||||
this.d = MathHelper.floor(paramEntityLiving.locY * 32.0D);
|
||||
this.e = paramEntityLiving.as.a(paramEntityLiving.locZ);
|
||||
this.i = ((byte) (int) (paramEntityLiving.yaw * 256.0F / 360.0F));
|
||||
this.j = ((byte) (int) (paramEntityLiving.pitch * 256.0F / 360.0F));
|
||||
this.k = ((byte) (int) (paramEntityLiving.aP * 256.0F / 360.0F));
|
||||
|
||||
double d1 = 3.9D;
|
||||
double d2 = paramEntityLiving.motX;
|
||||
double d3 = paramEntityLiving.motY;
|
||||
double d4 = paramEntityLiving.motZ;
|
||||
if (d2 < -d1)
|
||||
{
|
||||
d2 = -d1;
|
||||
}
|
||||
if (d3 < -d1)
|
||||
{
|
||||
d3 = -d1;
|
||||
}
|
||||
if (d4 < -d1)
|
||||
{
|
||||
d4 = -d1;
|
||||
}
|
||||
if (d2 > d1)
|
||||
{
|
||||
d2 = d1;
|
||||
}
|
||||
if (d3 > d1)
|
||||
{
|
||||
d3 = d1;
|
||||
}
|
||||
if (d4 > d1)
|
||||
{
|
||||
d4 = d1;
|
||||
}
|
||||
this.f = ((int) (d2 * 8000.0D));
|
||||
this.g = ((int) (d3 * 8000.0D));
|
||||
this.h = ((int) (d4 * 8000.0D));
|
||||
|
||||
this.l = paramEntityLiving.getDataWatcher();
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
this.a = paramPacketDataSerializer.a();
|
||||
this.b = (paramPacketDataSerializer.readByte() & 0xFF);
|
||||
this.c = paramPacketDataSerializer.readInt();
|
||||
this.d = paramPacketDataSerializer.readInt();
|
||||
this.e = paramPacketDataSerializer.readInt();
|
||||
this.i = paramPacketDataSerializer.readByte();
|
||||
this.j = paramPacketDataSerializer.readByte();
|
||||
this.k = paramPacketDataSerializer.readByte();
|
||||
this.f = paramPacketDataSerializer.readShort();
|
||||
this.g = paramPacketDataSerializer.readShort();
|
||||
this.h = paramPacketDataSerializer.readShort();
|
||||
this.m = DataWatcher.b(paramPacketDataSerializer);
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
paramPacketDataSerializer.b(this.a);
|
||||
paramPacketDataSerializer.writeByte(this.b & 0xFF);
|
||||
paramPacketDataSerializer.writeInt(this.c);
|
||||
paramPacketDataSerializer.writeInt(this.d);
|
||||
paramPacketDataSerializer.writeInt(this.e);
|
||||
paramPacketDataSerializer.writeByte(this.i);
|
||||
paramPacketDataSerializer.writeByte(this.j);
|
||||
paramPacketDataSerializer.writeByte(this.k);
|
||||
paramPacketDataSerializer.writeShort(this.f);
|
||||
paramPacketDataSerializer.writeShort(this.g);
|
||||
paramPacketDataSerializer.writeShort(this.h);
|
||||
this.l.a(paramPacketDataSerializer);
|
||||
}
|
||||
|
||||
public void a(PacketPlayOutListener paramPacketPlayOutListener)
|
||||
{
|
||||
paramPacketPlayOutListener.a(this);
|
||||
}
|
||||
|
||||
public String b()
|
||||
{
|
||||
return String.format(
|
||||
"id=%d, type=%d, x=%.2f, y=%.2f, z=%.2f, xd=%.2f, yd=%.2f, zd=%.2f",
|
||||
new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b), Float.valueOf(this.c / 32.0F),
|
||||
Float.valueOf(this.d / 32.0F), Float.valueOf(this.e / 32.0F), Float.valueOf(this.f / 8000.0F),
|
||||
Float.valueOf(this.g / 8000.0F), Float.valueOf(this.h / 8000.0F) });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketListener arg0)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
|
||||
|
||||
public class PacketProcessor
|
||||
{
|
||||
private List<IPacketVerifier> _packetVerifiers;
|
||||
|
||||
public PacketProcessor()
|
||||
{
|
||||
_packetVerifiers = new ArrayList<IPacketVerifier>();
|
||||
}
|
||||
|
||||
public void addPacketVerifier(IPacketVerifier verifier)
|
||||
{
|
||||
_packetVerifiers.add(verifier);
|
||||
}
|
||||
|
||||
public void processPacket(Packet packet, NetworkManager networkManager)
|
||||
{
|
||||
boolean addDefaultPacket = true;
|
||||
|
||||
for (IPacketVerifier verifier : _packetVerifiers)
|
||||
{
|
||||
if (!verifier.verify(packet))
|
||||
{
|
||||
addDefaultPacket = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (addDefaultPacket)
|
||||
{
|
||||
networkManager.handle(packet, new GenericFutureListener[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearVerifiers()
|
||||
{
|
||||
_packetVerifiers.clear();
|
||||
}
|
||||
}
|
@ -1,215 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.v1_7_R4.chunkio.ChunkIOExecutor;
|
||||
import java.util.HashMap;
|
||||
// CraftBukkit end
|
||||
|
||||
class PlayerChunk {
|
||||
|
||||
private final List b;
|
||||
private final ChunkCoordIntPair location;
|
||||
private short[] dirtyBlocks;
|
||||
private int dirtyCount;
|
||||
private int f;
|
||||
private long g;
|
||||
final PlayerChunkMap playerChunkMap;
|
||||
// CraftBukkit start - add fields
|
||||
private final HashMap<EntityPlayer, Runnable> players = new HashMap<EntityPlayer, Runnable>();
|
||||
private boolean loaded = false;
|
||||
private Runnable loadedRunnable = new Runnable() {
|
||||
public void run() {
|
||||
PlayerChunk.this.loaded = true;
|
||||
}
|
||||
};
|
||||
// CraftBukkit end
|
||||
|
||||
public PlayerChunk(PlayerChunkMap playerchunkmap, int i, int j) {
|
||||
this.playerChunkMap = playerchunkmap;
|
||||
this.b = new ArrayList();
|
||||
this.dirtyBlocks = new short[64];
|
||||
this.location = new ChunkCoordIntPair(i, j);
|
||||
playerchunkmap.a().chunkProviderServer.getChunkAt(i, j, this.loadedRunnable); // CraftBukkit
|
||||
}
|
||||
|
||||
public void a(final EntityPlayer entityplayer) { // CraftBukkit - added final to argument
|
||||
if (this.b.contains(entityplayer)) {
|
||||
PlayerChunkMap.c().debug("Failed to add player. {} already is in chunk {}, {}", new Object[] { entityplayer, Integer.valueOf(this.location.x), Integer.valueOf(this.location.z)});
|
||||
} else {
|
||||
if (this.b.isEmpty()) {
|
||||
this.g = PlayerChunkMap.a(this.playerChunkMap).getTime();
|
||||
}
|
||||
|
||||
this.b.add(entityplayer);
|
||||
// CraftBukkit start - use async chunk io
|
||||
Runnable playerRunnable;
|
||||
if (this.loaded) {
|
||||
playerRunnable = null;
|
||||
entityplayer.chunkCoordIntPairQueue.add(this.location);
|
||||
} else {
|
||||
playerRunnable = new Runnable() {
|
||||
public void run() {
|
||||
entityplayer.chunkCoordIntPairQueue.add(PlayerChunk.this.location);
|
||||
}
|
||||
};
|
||||
this.playerChunkMap.a().chunkProviderServer.getChunkAt(this.location.x, this.location.z, playerRunnable);
|
||||
}
|
||||
|
||||
this.players.put(entityplayer, playerRunnable);
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
public void b(EntityPlayer entityplayer) {
|
||||
if (this.b.contains(entityplayer)) {
|
||||
// CraftBukkit start - If we haven't loaded yet don't load the chunk just so we can clean it up
|
||||
if (!this.loaded) {
|
||||
ChunkIOExecutor.dropQueuedChunkLoad(this.playerChunkMap.a(), this.location.x, this.location.z, this.players.get(entityplayer));
|
||||
this.b.remove(entityplayer);
|
||||
this.players.remove(entityplayer);
|
||||
|
||||
if (this.b.isEmpty()) {
|
||||
ChunkIOExecutor.dropQueuedChunkLoad(this.playerChunkMap.a(), this.location.x, this.location.z, this.loadedRunnable);
|
||||
long i = (long) this.location.x + 2147483647L | (long) this.location.z + 2147483647L << 32;
|
||||
PlayerChunkMap.b(this.playerChunkMap).remove(i);
|
||||
PlayerChunkMap.c(this.playerChunkMap).remove(this);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
Chunk chunk = PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z);
|
||||
|
||||
if (chunk.isReady()) {
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutMapChunk(chunk, true, 0));
|
||||
}
|
||||
|
||||
this.players.remove(entityplayer); // CraftBukkit
|
||||
this.b.remove(entityplayer);
|
||||
entityplayer.chunkCoordIntPairQueue.remove(this.location);
|
||||
if (this.b.isEmpty()) {
|
||||
long i = (long) this.location.x + 2147483647L | (long) this.location.z + 2147483647L << 32;
|
||||
|
||||
this.a(chunk);
|
||||
PlayerChunkMap.b(this.playerChunkMap).remove(i);
|
||||
PlayerChunkMap.c(this.playerChunkMap).remove(this);
|
||||
if (this.dirtyCount > 0) {
|
||||
PlayerChunkMap.d(this.playerChunkMap).remove(this);
|
||||
}
|
||||
|
||||
this.playerChunkMap.a().chunkProviderServer.queueUnload(this.location.x, this.location.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.a(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z));
|
||||
}
|
||||
|
||||
private void a(Chunk chunk) {
|
||||
chunk.s += PlayerChunkMap.a(this.playerChunkMap).getTime() - this.g;
|
||||
this.g = PlayerChunkMap.a(this.playerChunkMap).getTime();
|
||||
}
|
||||
|
||||
public void a(int i, int j, int k) {
|
||||
if (this.dirtyCount == 0) {
|
||||
PlayerChunkMap.d(this.playerChunkMap).add(this);
|
||||
}
|
||||
|
||||
this.f |= 1 << (j >> 4);
|
||||
if (this.dirtyCount < 64) {
|
||||
short short1 = (short) (i << 12 | k << 8 | j);
|
||||
|
||||
for (int l = 0; l < this.dirtyCount; ++l) {
|
||||
if (this.dirtyBlocks[l] == short1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.dirtyBlocks[this.dirtyCount++] = short1;
|
||||
}
|
||||
}
|
||||
|
||||
public void sendAll(Packet packet) {
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
|
||||
|
||||
if (!entityplayer.chunkCoordIntPairQueue.contains(this.location)) {
|
||||
entityplayer.playerConnection.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void b() {
|
||||
if (this.dirtyCount != 0) {
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
|
||||
if (this.dirtyCount == 1) {
|
||||
i = this.location.x * 16 + (this.dirtyBlocks[0] >> 12 & 15);
|
||||
j = this.dirtyBlocks[0] & 255;
|
||||
k = this.location.z * 16 + (this.dirtyBlocks[0] >> 8 & 15);
|
||||
this.sendAll(new PacketPlayOutBlockChange(i, j, k, PlayerChunkMap.a(this.playerChunkMap)));
|
||||
if (PlayerChunkMap.a(this.playerChunkMap).getType(i, j, k).isTileEntity()) {
|
||||
this.sendTileEntity(PlayerChunkMap.a(this.playerChunkMap).getTileEntity(i, j, k));
|
||||
}
|
||||
} else {
|
||||
int l;
|
||||
|
||||
if (this.dirtyCount == 64) {
|
||||
i = this.location.x * 16;
|
||||
j = this.location.z * 16;
|
||||
this.sendAll(new PacketPlayOutMapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); // CraftBukkit - send everything (including biome) if all sections flagged
|
||||
|
||||
for (k = 0; k < 16; ++k) {
|
||||
if ((this.f & 1 << k) != 0) {
|
||||
l = k << 4;
|
||||
List list = PlayerChunkMap.a(this.playerChunkMap).getTileEntities(i, l, j, i + 16, l + 16, j + 16);
|
||||
|
||||
for (int i1 = 0; i1 < list.size(); ++i1) {
|
||||
this.sendTileEntity((TileEntity) list.get(i1));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.sendAll(new PacketPlayOutMultiBlockChange(this.dirtyCount, this.dirtyBlocks, PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z)));
|
||||
|
||||
for (i = 0; i < this.dirtyCount; ++i) {
|
||||
j = this.location.x * 16 + (this.dirtyBlocks[i] >> 12 & 15);
|
||||
k = this.dirtyBlocks[i] & 255;
|
||||
l = this.location.z * 16 + (this.dirtyBlocks[i] >> 8 & 15);
|
||||
if (PlayerChunkMap.a(this.playerChunkMap).getType(j, k, l).isTileEntity()) {
|
||||
this.sendTileEntity(PlayerChunkMap.a(this.playerChunkMap).getTileEntity(j, k, l));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.dirtyCount = 0;
|
||||
this.f = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void sendTileEntity(TileEntity tileentity) {
|
||||
if (tileentity != null) {
|
||||
Packet packet = tileentity.getUpdatePacket();
|
||||
|
||||
if (packet != null) {
|
||||
this.sendAll(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ChunkCoordIntPair a(PlayerChunk playerchunk) {
|
||||
return playerchunk.location;
|
||||
}
|
||||
|
||||
static List b(PlayerChunk playerchunk) {
|
||||
return playerchunk.b;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +0,0 @@
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
|
||||
|
||||
public class QueuedPacket
|
||||
{
|
||||
private final Packet a;
|
||||
private final GenericFutureListener[] b;
|
||||
|
||||
public QueuedPacket(Packet packet, GenericFutureListener... agenericfuturelistener)
|
||||
{
|
||||
this.a = packet;
|
||||
this.b = agenericfuturelistener;
|
||||
}
|
||||
|
||||
public static Packet a(QueuedPacket queuedpacket)
|
||||
{
|
||||
return queuedpacket.a;
|
||||
}
|
||||
|
||||
public static GenericFutureListener[] b(QueuedPacket queuedpacket)
|
||||
{
|
||||
return queuedpacket.b;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,20 +0,0 @@
|
||||
package org.bukkit.craftbukkit.v1_7_R4.inventory;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.MinecraftInventory;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
public class CraftInventoryCustom extends CraftInventory {
|
||||
public CraftInventoryCustom(InventoryHolder owner, InventoryType type) {
|
||||
super(new MinecraftInventory(owner, type));
|
||||
}
|
||||
|
||||
public CraftInventoryCustom(InventoryHolder owner, int size) {
|
||||
super(new MinecraftInventory(owner, size));
|
||||
}
|
||||
|
||||
public CraftInventoryCustom(InventoryHolder owner, int size, String title) {
|
||||
super(new MinecraftInventory(owner, size, title));
|
||||
}
|
||||
}
|
@ -1,415 +0,0 @@
|
||||
package org.bukkit.craftbukkit.v1_7_R4.inventory;
|
||||
|
||||
import static org.bukkit.craftbukkit.v1_7_R4.inventory.CraftMetaItem.ENCHANTMENTS;
|
||||
import static org.bukkit.craftbukkit.v1_7_R4.inventory.CraftMetaItem.ENCHANTMENTS_ID;
|
||||
import static org.bukkit.craftbukkit.v1_7_R4.inventory.CraftMetaItem.ENCHANTMENTS_LVL;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.EnchantmentManager;
|
||||
import net.minecraft.server.v1_7_R4.Item;
|
||||
import net.minecraft.server.v1_7_R4.NBTTagCompound;
|
||||
import net.minecraft.server.v1_7_R4.NBTTagList;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.serialization.DelegateDeserialization;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
@DelegateDeserialization(ItemStack.class)
|
||||
public class CraftItemStack extends ItemStack {
|
||||
|
||||
public static net.minecraft.server.v1_7_R4.ItemStack asNMSCopy(ItemStack original) {
|
||||
if (original instanceof CraftItemStack) {
|
||||
CraftItemStack stack = (CraftItemStack) original;
|
||||
return stack.handle == null ? null : stack.handle.cloneItemStack();
|
||||
}
|
||||
if (original == null || original.getTypeId() <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Item item = CraftMagicNumbers.getItem(original.getType());
|
||||
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
net.minecraft.server.v1_7_R4.ItemStack stack = new net.minecraft.server.v1_7_R4.ItemStack(item, original.getAmount(), original.getDurability());
|
||||
if (original.hasItemMeta()) {
|
||||
setItemMeta(stack, original.getItemMeta());
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static net.minecraft.server.v1_7_R4.ItemStack copyNMSStack(net.minecraft.server.v1_7_R4.ItemStack original, int amount) {
|
||||
net.minecraft.server.v1_7_R4.ItemStack stack = original.cloneItemStack();
|
||||
stack.count = amount;
|
||||
return stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the NMS stack to return as a strictly-Bukkit stack
|
||||
*/
|
||||
public static ItemStack asBukkitCopy(net.minecraft.server.v1_7_R4.ItemStack original) {
|
||||
if (original == null) {
|
||||
return new ItemStack(Material.AIR);
|
||||
}
|
||||
ItemStack stack = new ItemStack(CraftMagicNumbers.getMaterial(original.getItem()), original.count, (short) original.getData());
|
||||
if (hasItemMeta(original)) {
|
||||
stack.setItemMeta(getItemMeta(original));
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static CraftItemStack asCraftMirror(net.minecraft.server.v1_7_R4.ItemStack original) {
|
||||
return new CraftItemStack(original);
|
||||
}
|
||||
|
||||
public static CraftItemStack asCraftCopy(ItemStack original) {
|
||||
if (original instanceof CraftItemStack) {
|
||||
CraftItemStack stack = (CraftItemStack) original;
|
||||
return new CraftItemStack(stack.handle == null ? null : stack.handle.cloneItemStack());
|
||||
}
|
||||
return new CraftItemStack(original);
|
||||
}
|
||||
|
||||
public static CraftItemStack asNewCraftStack(Item item) {
|
||||
return asNewCraftStack(item, 1);
|
||||
}
|
||||
|
||||
public static CraftItemStack asNewCraftStack(Item item, int amount) {
|
||||
return new CraftItemStack(CraftMagicNumbers.getMaterial(item), amount, (short) 0, null);
|
||||
}
|
||||
|
||||
net.minecraft.server.v1_7_R4.ItemStack handle;
|
||||
|
||||
/**
|
||||
* Mirror
|
||||
*/
|
||||
protected CraftItemStack(net.minecraft.server.v1_7_R4.ItemStack item) {
|
||||
this.handle = item;
|
||||
}
|
||||
|
||||
protected CraftItemStack(ItemStack item) {
|
||||
this(item.getTypeId(), item.getAmount(), item.getDurability(), item.hasItemMeta() ? item.getItemMeta() : null);
|
||||
}
|
||||
|
||||
protected CraftItemStack(Material type, int amount, short durability, ItemMeta itemMeta) {
|
||||
setType(type);
|
||||
setAmount(amount);
|
||||
setDurability(durability);
|
||||
setItemMeta(itemMeta);
|
||||
}
|
||||
|
||||
protected CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) {
|
||||
this(Material.getMaterial(typeId), amount, durability, itemMeta);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTypeId() {
|
||||
return handle != null ? CraftMagicNumbers.getId(handle.getItem()) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTypeId(int type) {
|
||||
if (getTypeId() == type) {
|
||||
return;
|
||||
} else if (type == 0) {
|
||||
handle = null;
|
||||
} else if (CraftMagicNumbers.getItem(type) == null) { // :(
|
||||
handle = null;
|
||||
} else if (handle == null) {
|
||||
handle = new net.minecraft.server.v1_7_R4.ItemStack(CraftMagicNumbers.getItem(type), 1, 0);
|
||||
} else {
|
||||
handle.setItem(CraftMagicNumbers.getItem(type));
|
||||
if (hasItemMeta()) {
|
||||
// This will create the appropriate item meta, which will contain all the data we intend to keep
|
||||
setItemMeta(handle, getItemMeta(handle));
|
||||
}
|
||||
}
|
||||
setData(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount() {
|
||||
return handle != null ? handle.count : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAmount(int amount) {
|
||||
if (handle == null) {
|
||||
return;
|
||||
}
|
||||
if (amount == 0) {
|
||||
handle = null;
|
||||
} else {
|
||||
handle.count = amount;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDurability(final short durability) {
|
||||
// Ignore damage if item is null
|
||||
if (handle != null) {
|
||||
handle.setData(durability);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getDurability() {
|
||||
if (handle != null) {
|
||||
return (short) handle.getData();
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxStackSize() {
|
||||
return (handle == null) ? Material.AIR.getMaxStackSize() : handle.getItem().getMaxStackSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addUnsafeEnchantment(Enchantment ench, int level) {
|
||||
Validate.notNull(ench, "Cannot add null enchantment");
|
||||
|
||||
if (!makeTag(handle)) {
|
||||
return;
|
||||
}
|
||||
NBTTagList list = getEnchantmentList(handle);
|
||||
if (list == null) {
|
||||
list = new NBTTagList();
|
||||
handle.tag.set(ENCHANTMENTS.NBT, list);
|
||||
}
|
||||
int size = list.size();
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
NBTTagCompound tag = (NBTTagCompound) list.get(i);
|
||||
short id = tag.getShort(ENCHANTMENTS_ID.NBT);
|
||||
if (id == ench.getId()) {
|
||||
tag.setShort(ENCHANTMENTS_LVL.NBT, (short) level);
|
||||
return;
|
||||
}
|
||||
}
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setShort(ENCHANTMENTS_ID.NBT, (short) ench.getId());
|
||||
tag.setShort(ENCHANTMENTS_LVL.NBT, (short) level);
|
||||
list.add(tag);
|
||||
}
|
||||
|
||||
static boolean makeTag(net.minecraft.server.v1_7_R4.ItemStack item) {
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.tag == null) {
|
||||
item.setTag(new NBTTagCompound());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsEnchantment(Enchantment ench) {
|
||||
return getEnchantmentLevel(ench) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnchantmentLevel(Enchantment ench) {
|
||||
Validate.notNull(ench, "Cannot find null enchantment");
|
||||
if (handle == null) {
|
||||
return 0;
|
||||
}
|
||||
return EnchantmentManager.getEnchantmentLevel(ench.getId(), handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeEnchantment(Enchantment ench) {
|
||||
Validate.notNull(ench, "Cannot remove null enchantment");
|
||||
|
||||
NBTTagList list = getEnchantmentList(handle), listCopy;
|
||||
if (list == null) {
|
||||
return 0;
|
||||
}
|
||||
int index = Integer.MIN_VALUE;
|
||||
int level = Integer.MIN_VALUE;
|
||||
int size = list.size();
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
NBTTagCompound enchantment = (NBTTagCompound) list.get(i);
|
||||
int id = 0xffff & enchantment.getShort(ENCHANTMENTS_ID.NBT);
|
||||
if (id == ench.getId()) {
|
||||
index = i;
|
||||
level = 0xffff & enchantment.getShort(ENCHANTMENTS_LVL.NBT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (index == Integer.MIN_VALUE) {
|
||||
return 0;
|
||||
}
|
||||
if (size == 1) {
|
||||
handle.tag.remove(ENCHANTMENTS.NBT);
|
||||
if (handle.tag.isEmpty()) {
|
||||
handle.tag = null;
|
||||
}
|
||||
return level;
|
||||
}
|
||||
|
||||
// This is workaround for not having an index removal
|
||||
listCopy = new NBTTagList();
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (i != index) {
|
||||
listCopy.add(list.get(i));
|
||||
}
|
||||
}
|
||||
handle.tag.set(ENCHANTMENTS.NBT, listCopy);
|
||||
|
||||
return level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Enchantment, Integer> getEnchantments() {
|
||||
return getEnchantments(handle);
|
||||
}
|
||||
|
||||
static Map<Enchantment, Integer> getEnchantments(net.minecraft.server.v1_7_R4.ItemStack item) {
|
||||
NBTTagList list = (item != null && item.hasEnchantments()) ? item.getEnchantments() : null;
|
||||
|
||||
if (list == null || list.size() == 0) {
|
||||
return ImmutableMap.of();
|
||||
}
|
||||
|
||||
ImmutableMap.Builder<Enchantment, Integer> result = ImmutableMap.builder();
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
int id = 0xffff & ((NBTTagCompound) list.get(i)).getShort(ENCHANTMENTS_ID.NBT);
|
||||
int level = 0xffff & ((NBTTagCompound) list.get(i)).getShort(ENCHANTMENTS_LVL.NBT);
|
||||
|
||||
result.put(Enchantment.getById(id), level);
|
||||
}
|
||||
|
||||
return result.build();
|
||||
}
|
||||
|
||||
static NBTTagList getEnchantmentList(net.minecraft.server.v1_7_R4.ItemStack item) {
|
||||
return (item != null && item.hasEnchantments()) ? item.getEnchantments() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftItemStack clone() {
|
||||
CraftItemStack itemStack = (CraftItemStack) super.clone();
|
||||
if (this.handle != null) {
|
||||
itemStack.handle = this.handle.cloneItemStack();
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemMeta getItemMeta() {
|
||||
return getItemMeta(handle);
|
||||
}
|
||||
|
||||
public net.minecraft.server.v1_7_R4.ItemStack getHandle() {
|
||||
return handle;
|
||||
}
|
||||
|
||||
public static ItemMeta getItemMeta(net.minecraft.server.v1_7_R4.ItemStack item) {
|
||||
if (!hasItemMeta(item)) {
|
||||
return CraftItemFactory.instance().getItemMeta(getType(item));
|
||||
}
|
||||
switch (getType(item)) {
|
||||
case WRITTEN_BOOK:
|
||||
case BOOK_AND_QUILL:
|
||||
return new CraftMetaBook(item.tag);
|
||||
case SKULL_ITEM:
|
||||
return new CraftMetaSkull(item.tag);
|
||||
case LEATHER_HELMET:
|
||||
case LEATHER_CHESTPLATE:
|
||||
case LEATHER_LEGGINGS:
|
||||
case LEATHER_BOOTS:
|
||||
return new CraftMetaLeatherArmor(item.tag);
|
||||
case POTION:
|
||||
return new CraftMetaPotion(item.tag);
|
||||
case MAP:
|
||||
return new CraftMetaMap(item.tag);
|
||||
case FIREWORK:
|
||||
return new CraftMetaFirework(item.tag);
|
||||
case FIREWORK_CHARGE:
|
||||
return new CraftMetaCharge(item.tag);
|
||||
case ENCHANTED_BOOK:
|
||||
return new CraftMetaEnchantedBook(item.tag);
|
||||
default:
|
||||
return new CraftMetaItem(item.tag);
|
||||
}
|
||||
}
|
||||
|
||||
static Material getType(net.minecraft.server.v1_7_R4.ItemStack item) {
|
||||
Material material = Material.getMaterial(item == null ? 0 : CraftMagicNumbers.getId(item.getItem()));
|
||||
return material == null ? Material.AIR : material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setItemMeta(ItemMeta itemMeta) {
|
||||
return setItemMeta(handle, itemMeta);
|
||||
}
|
||||
|
||||
public static boolean setItemMeta(net.minecraft.server.v1_7_R4.ItemStack item, ItemMeta itemMeta) {
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
if (CraftItemFactory.instance().equals(itemMeta, null)) {
|
||||
item.tag = null;
|
||||
return true;
|
||||
}
|
||||
if (!CraftItemFactory.instance().isApplicable(itemMeta, getType(item))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
item.setTag(tag);
|
||||
|
||||
((CraftMetaItem) itemMeta).applyToItem(tag);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSimilar(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
if (stack == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(stack instanceof CraftItemStack)) {
|
||||
return stack.getClass() == ItemStack.class && stack.isSimilar(this);
|
||||
}
|
||||
|
||||
CraftItemStack that = (CraftItemStack) stack;
|
||||
if (handle == that.handle) {
|
||||
return true;
|
||||
}
|
||||
if (handle == null || that.handle == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(that.getTypeId() == getTypeId() && getDurability() == that.getDurability())) {
|
||||
return false;
|
||||
}
|
||||
return hasItemMeta() ? that.hasItemMeta() && handle.tag.equals(that.handle.tag) : !that.hasItemMeta();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasItemMeta() {
|
||||
return hasItemMeta(handle);
|
||||
}
|
||||
|
||||
static boolean hasItemMeta(net.minecraft.server.v1_7_R4.ItemStack item) {
|
||||
return !(item == null || item.tag == null || item.tag.isEmpty());
|
||||
}
|
||||
}
|
@ -1,194 +0,0 @@
|
||||
package org.bukkit.craftbukkit.v1_7_R4.inventory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftHumanEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.EntityHuman;
|
||||
import net.minecraft.server.v1_7_R4.IInventory;
|
||||
import net.minecraft.server.v1_7_R4.ItemStack;
|
||||
import net.minecraft.util.org.apache.commons.lang3.Validate;
|
||||
|
||||
public class MinecraftInventory implements IInventory
|
||||
{
|
||||
private final ItemStack[] items;
|
||||
private int maxStack = MAX_STACK;
|
||||
private final List<HumanEntity> viewers;
|
||||
private String title;
|
||||
private InventoryType type;
|
||||
private final InventoryHolder owner;
|
||||
|
||||
public MinecraftInventory(InventoryHolder owner, InventoryType type)
|
||||
{
|
||||
this(owner, type.getDefaultSize(), type.getDefaultTitle());
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public MinecraftInventory(InventoryHolder owner, int size)
|
||||
{
|
||||
this(owner, size, "Chest");
|
||||
}
|
||||
|
||||
public MinecraftInventory(InventoryHolder owner, int size, String title)
|
||||
{
|
||||
Validate.notNull(title, "Title cannot be null");
|
||||
Validate.isTrue(title.length() <= 32, "Title cannot be longer than 32 characters");
|
||||
this.items = new ItemStack[size];
|
||||
this.title = title;
|
||||
this.viewers = new ArrayList();
|
||||
this.owner = owner;
|
||||
this.type = InventoryType.CHEST;
|
||||
}
|
||||
|
||||
public int getSize()
|
||||
{
|
||||
return items.length;
|
||||
}
|
||||
|
||||
public ItemStack getItem(int i)
|
||||
{
|
||||
return items[i];
|
||||
}
|
||||
|
||||
public ItemStack splitStack(int i, int j)
|
||||
{
|
||||
ItemStack stack = this.getItem(i);
|
||||
ItemStack result;
|
||||
if (stack == null)
|
||||
return null;
|
||||
if (stack.count <= j)
|
||||
{
|
||||
this.setItem(i, null);
|
||||
result = stack;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = CraftItemStack.copyNMSStack(stack, j);
|
||||
stack.count -= j;
|
||||
}
|
||||
this.update();
|
||||
return result;
|
||||
}
|
||||
|
||||
public ItemStack splitWithoutUpdate(int i)
|
||||
{
|
||||
ItemStack stack = this.getItem(i);
|
||||
ItemStack result;
|
||||
if (stack == null)
|
||||
return null;
|
||||
if (stack.count <= 1)
|
||||
{
|
||||
this.setItem(i, null);
|
||||
result = stack;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = CraftItemStack.copyNMSStack(stack, 1);
|
||||
stack.count -= 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setItem(int i, ItemStack itemstack)
|
||||
{
|
||||
items[i] = itemstack;
|
||||
if (itemstack != null && this.getMaxStackSize() > 0 && itemstack.count > this.getMaxStackSize())
|
||||
{
|
||||
itemstack.count = this.getMaxStackSize();
|
||||
}
|
||||
}
|
||||
|
||||
public void setInventoryName(String name)
|
||||
{
|
||||
title = name;
|
||||
}
|
||||
|
||||
public int getMaxStackSize()
|
||||
{
|
||||
return maxStack;
|
||||
}
|
||||
|
||||
public void setMaxStackSize(int size)
|
||||
{
|
||||
maxStack = size;
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
}
|
||||
|
||||
public boolean a(EntityHuman entityhuman)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack[] getContents()
|
||||
{
|
||||
return items;
|
||||
}
|
||||
|
||||
public void onOpen(CraftHumanEntity who)
|
||||
{
|
||||
viewers.add(who);
|
||||
}
|
||||
|
||||
public void onClose(CraftHumanEntity who)
|
||||
{
|
||||
viewers.remove(who);
|
||||
}
|
||||
|
||||
public List<HumanEntity> getViewers()
|
||||
{
|
||||
return viewers;
|
||||
}
|
||||
|
||||
public InventoryType getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public void g()
|
||||
{
|
||||
}
|
||||
|
||||
public InventoryHolder getOwner()
|
||||
{
|
||||
return owner;
|
||||
}
|
||||
|
||||
public void startOpen()
|
||||
{
|
||||
}
|
||||
|
||||
public boolean c()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b(int i, ItemStack itemstack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean k_()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeContainer()
|
||||
{
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
/**
|
||||
* Represents a shootable entity.
|
||||
*/
|
||||
public interface Projectile extends Entity {
|
||||
|
||||
/**
|
||||
* This method exists for legacy reasons to provide backwards
|
||||
* compatibility. It will not exist at runtime and should not be used
|
||||
* under any circumstances.
|
||||
*/
|
||||
@Deprecated
|
||||
public LivingEntity _INVALID_getShooter();
|
||||
|
||||
/**
|
||||
* Retrieve the shooter of this projectile.
|
||||
*
|
||||
* @return the {@link ProjectileSource} that shot this projectile
|
||||
*/
|
||||
public ProjectileSource getShooter();
|
||||
|
||||
/**
|
||||
* This method exists for legacy reasons to provide backwards
|
||||
* compatibility. It will not exist at runtime and should not be used
|
||||
* under any circumstances.
|
||||
*/
|
||||
@Deprecated
|
||||
public void _INVALID_setShooter(LivingEntity shooter);
|
||||
|
||||
/**
|
||||
* Set the shooter of this projectile.
|
||||
*
|
||||
* @param source the {@link ProjectileSource} that shot this projectile
|
||||
*/
|
||||
public void setShooter(ProjectileSource source);
|
||||
|
||||
/**
|
||||
* Determine if this projectile should bounce or not when it hits.
|
||||
* <p>
|
||||
* If a small fireball does not bounce it will set the target on fire.
|
||||
*
|
||||
* @return true if it should bounce.
|
||||
*/
|
||||
public boolean doesBounce();
|
||||
|
||||
/**
|
||||
* Set whether or not this projectile should bounce or not when it hits
|
||||
* something.
|
||||
*
|
||||
* @param doesBounce whether or not it should bounce.
|
||||
*/
|
||||
public void setBounce(boolean doesBounce);
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
package org.bukkit.event.vehicle;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Raised when a living entity exits a vehicle.
|
||||
*/
|
||||
public class VehicleExitEvent extends Event implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private Entity vehicle;
|
||||
private final LivingEntity exited;
|
||||
|
||||
public VehicleExitEvent(final Entity vehicle, final LivingEntity exited) {
|
||||
this.vehicle = vehicle;
|
||||
this.exited = exited;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the vehicle.
|
||||
*
|
||||
* @return the vehicle
|
||||
*/
|
||||
public final Entity getVehicle() {
|
||||
return vehicle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the living entity that exited the vehicle.
|
||||
*
|
||||
* @return The entity.
|
||||
*/
|
||||
public LivingEntity getExited() {
|
||||
return exited;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -4,7 +4,6 @@
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.Core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core.CraftBukkit"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar" sourcepath="/REPO_DIR/GitHubLibraries/CraftBukkit/src"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.ClassCombat"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/>
|
||||
|
@ -44,7 +44,8 @@ import mineplex.core.updater.Updater;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
import nautilus.game.arcade.game.GameServerConfig;
|
||||
import net.minecraft.server.v1_7_R4.*;
|
||||
import net.minecraft.server.*;
|
||||
import net.minecraft.server.v1_7_R4.MinecraftServer;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
@ -543,6 +543,8 @@
|
||||
{
|
||||
Rank rank = null;
|
||||
|
||||
try
|
||||
{
|
||||
using (var repository = _repositoryFactory.CreateRepository())
|
||||
{
|
||||
var account = repository.Where<Account>(x => String.Equals(x.Name, token.Name)).Include(x => x.Rank).FirstOrDefault();
|
||||
@ -557,10 +559,11 @@
|
||||
if (rank == null)
|
||||
return account.Rank.ToString();
|
||||
|
||||
repository.Attach(account);
|
||||
repository.Edit(account);
|
||||
|
||||
var expire = DateTime.Now.AddMonths(1).AddMilliseconds(-DateTime.Now.Millisecond);
|
||||
|
||||
using (var transaction = new TransactionScope())
|
||||
{
|
||||
account.Rank = rank;
|
||||
account.RankExpire = expire;
|
||||
account.RankPerm = token.Perm;
|
||||
@ -638,8 +641,6 @@
|
||||
}
|
||||
|
||||
repository.CommitChanges();
|
||||
transaction.Complete();
|
||||
}
|
||||
|
||||
_logger.Log("INFO", "TOKEN " + token.Name + "'s rank has been updated to " + token.Rank + " " + (token.Perm ? "Permanently" : "Monthly") + "." + " Rank expire : " + account.RankExpire.ToString());
|
||||
}
|
||||
@ -649,8 +650,13 @@
|
||||
var account = repository.Where<Account>(x => String.Equals(x.Name, token.Name)).Include(x => x.Rank).FirstOrDefault();
|
||||
_logger.Log("INFO", "ACCOUNT " + account.Name + "'s rank is " + account.Rank.Name + " " + (account.RankPerm ? "Permanently" : "Monthly") + "." + " Rank expire : " + account.RankExpire.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Log("ERROR", "Applying UpdateRank : " + String.Join("; ", ex.InnerException.InnerException.Message));
|
||||
}
|
||||
|
||||
return rank.Name.ToString();
|
||||
return rank == null ? token.Rank : rank.Name.ToString();
|
||||
}
|
||||
|
||||
public void RemoveBan(RemovePunishmentToken token)
|
||||
@ -691,7 +697,7 @@
|
||||
{
|
||||
var account = repository.Where<Account>(x => x.AccountId == accountId).Include(x => x.Transactions).First();
|
||||
|
||||
var accountTransaction = new Transaction {Account = account, SalesPackage = salesPackage, Fee = fee, Profit = (gross - fee), Time = DateTime.Now};
|
||||
var accountTransaction = new LOC.Core.Model.Sales.Transaction {Account = account, SalesPackage = salesPackage, Fee = fee, Profit = (gross - fee), Time = DateTime.Now};
|
||||
|
||||
repository.Attach(salesPackage);
|
||||
|
||||
@ -699,7 +705,7 @@
|
||||
repository.Edit(account);
|
||||
|
||||
if (account.Transactions == null)
|
||||
account.Transactions = new List<Transaction>();
|
||||
account.Transactions = new List<LOC.Core.Model.Sales.Transaction>();
|
||||
|
||||
account.Transactions.Add(accountTransaction);
|
||||
account.Gems += salesPackage.Gems;
|
||||
@ -733,7 +739,7 @@
|
||||
Rank = repository.Where<Rank>(x => x.RankId == 1).First(),
|
||||
Gems = 0,
|
||||
Coins = 0,
|
||||
Transactions = new List<Transaction>(),
|
||||
Transactions = new List<LOC.Core.Model.Sales.Transaction>(),
|
||||
PvpTransactions = new List<GameTransaction>(),
|
||||
IpAddresses = new List<LoginAddress>(),
|
||||
MacAddresses = new List<MacAddress>(),
|
||||
|
@ -614,7 +614,7 @@
|
||||
<file relUrl="Content/css/bootstrap-responsive.css" publishTime="11/02/2013 13:30:01" />
|
||||
<file relUrl="Areas/Manage/Views/Web.config" publishTime="11/02/2013 13:30:01" />
|
||||
<file relUrl="Views/Home/Index.cshtml" publishTime="03/19/2014 02:41:15" />
|
||||
<file relUrl="bin/LOC.Website.Common.dll" publishTime="09/01/2014 16:33:06" />
|
||||
<file relUrl="bin/LOC.Website.Common.dll" publishTime="09/02/2014 00:05:44" />
|
||||
<file relUrl="Content/themes/techno/js/prototype.js" publishTime="11/02/2013 13:30:01" />
|
||||
<file relUrl="Scripts/jquery-1.4.4.min.js" publishTime="11/02/2013 13:30:01" />
|
||||
<file relUrl="Content/Images/Double.png" publishTime="11/02/2013 13:30:01" />
|
||||
@ -622,7 +622,7 @@
|
||||
<file relUrl="Views/Account/LogOn.cshtml" publishTime="11/02/2013 13:30:01" />
|
||||
<file relUrl="Content/Images/Wiki/Ranger.png" publishTime="11/02/2013 13:30:01" />
|
||||
<file relUrl="Content/themes/techno/images/templatemo_image_02.png" publishTime="11/02/2013 13:30:01" />
|
||||
<file relUrl="bin/LOC.Website.Common.pdb" publishTime="09/01/2014 16:33:05" />
|
||||
<file relUrl="bin/LOC.Website.Common.pdb" publishTime="09/02/2014 00:05:44" />
|
||||
<file relUrl="bin/LOC.Core.pdb" publishTime="08/30/2014 13:54:02" />
|
||||
<file relUrl="Content/Images/Wiki/red_dye.jpg" publishTime="11/02/2013 13:30:01" />
|
||||
<file relUrl="Scripts/MicrosoftMvcValidation.js" publishTime="11/02/2013 13:30:01" />
|
||||
@ -692,9 +692,9 @@
|
||||
<file relUrl="Views/Store/_WritePackage.cshtml" publishTime="11/02/2013 13:30:01" />
|
||||
<file relUrl="Content/css/bootstrap-responsive.min.css" publishTime="11/02/2013 13:30:01" />
|
||||
<file relUrl="Views/Servers/Index.cshtml" publishTime="11/02/2013 13:30:01" />
|
||||
<file relUrl="bin/LOC.Website.Web.dll" publishTime="09/01/2014 16:33:06" />
|
||||
<file relUrl="bin/LOC.Website.Web.dll" publishTime="09/02/2014 00:05:44" />
|
||||
<file relUrl="Views/Shared/_FrontLayout.cshtml" publishTime="11/02/2013 13:30:01" />
|
||||
<file relUrl="bin/LOC.Website.Web.pdb" publishTime="09/01/2014 16:33:06" />
|
||||
<file relUrl="bin/LOC.Website.Web.pdb" publishTime="09/02/2014 00:05:44" />
|
||||
<file relUrl="Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png" publishTime="11/02/2013 13:30:01" />
|
||||
<file relUrl="Views/Profile/Index.cshtml" publishTime="11/02/2013 13:30:01" />
|
||||
<file relUrl="bin/WebMatrix.WebData.xml" publishTime="11/02/2013 13:30:01" />
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user