Archiviert
13
0

Properly obtain read/write methods for tile entities

Dieser Commit ist enthalten in:
Dan Mulloy 2015-06-19 22:17:34 -04:00
Ursprung e0f7c72e18
Commit 9fe5df3cfe
3 geänderte Dateien mit 9 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -13,7 +13,8 @@
* You should have received a copy of the GNU General Public License along with this program;
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*/package com.comphenix.protocol.compat.netty.shaded;
*/
package com.comphenix.protocol.compat.netty.shaded;
import java.io.IOException;
import java.io.ObjectInputStream;

Datei anzeigen

@ -13,7 +13,8 @@
* You should have received a copy of the GNU General Public License along with this program;
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*/package com.comphenix.protocol.compat.netty.shaded;
*/
package com.comphenix.protocol.compat.netty.shaded;
import java.io.DataInputStream;
import java.io.DataOutputStream;

Datei anzeigen

@ -46,16 +46,14 @@ class TileEntityAccessor<T extends BlockState> {
private boolean writeDetected;
private boolean readDetected;
private TileEntityAccessor() {
public TileEntityAccessor() {
// Do nothing
}
/**
* Construct a new tile entity accessor.
* @param tileEntityField - the tile entity field.
* @param tileEntity - the tile entity.
* @param tile - the block state.
* @throws IOException Cannot read tile entity.
* @param state - the block state.
*/
private TileEntityAccessor(FieldAccessor tileEntityField, T state) {
if (tileEntityField != null) {
@ -64,7 +62,7 @@ class TileEntityAccessor<T extends BlockState> {
// Possible read/write methods
try {
findMethodsUsingASM(type);
findMethodsUsingASM();
} catch (IOException ex1) {
try {
// Much slower though
@ -84,12 +82,11 @@ class TileEntityAccessor<T extends BlockState> {
/**
* Find the read/write methods in TileEntity.
* @param tileEntityClass - the tile entity class.
* @param nbtCompoundClass - the compound clas.
* @throws IOException If we cannot find these methods.
*/
private void findMethodsUsingASM(final Class<?> tileEntityClass) throws IOException {
private void findMethodsUsingASM() throws IOException {
final Class<?> nbtCompoundClass = MinecraftReflection.getNBTCompoundClass();
final Class<?> tileEntityClass = MinecraftReflection.getTileEntityClass();
final ClassReader reader = new ClassReader(tileEntityClass.getCanonicalName());
final String tagCompoundName = getJarName(MinecraftReflection.getNBTCompoundClass());