Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Merge pull request #41 from McMoonLakeDev/v1.9-alpha
Browse files Browse the repository at this point in the history
v1.9 a5.1
  • Loading branch information
MoonLake authored Jun 12, 2017
2 parents 8790ac4 + 626fd1a commit 3609f47
Show file tree
Hide file tree
Showing 27 changed files with 2,154 additions and 2,822 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.minecraft.moonlake</groupId>
<artifactId>MoonLake</artifactId>
<packaging>jar</packaging>
<version>1.9-a5</version>
<version>1.9-a5.1</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/minecraft/moonlake/api/nbt/NBTEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public interface NBTEntity {
* @return Entity
* @throws NBTException 如果生成实体时错误则抛出异常
* @throws IllegalArgumentException 如果 NBT 复合对象或目标世界对象为 {@code null} 则抛出异常
* @deprecated 已过时, 将于 v1.9-a6 删除.
*/
@Deprecated
Entity spawnEntity(Object nbtTagCompound, World world) throws NBTException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

package com.minecraft.moonlake.api.nbt;

import com.minecraft.moonlake.api.utility.MinecraftBukkitVersion;
import com.minecraft.moonlake.api.utility.MinecraftReflection;
import com.minecraft.moonlake.builder.SingleParamBuilder;
import com.minecraft.moonlake.nbt.exception.NBTException;
import com.minecraft.moonlake.nbt.exception.NBTInitializeException;
import com.minecraft.moonlake.reflect.FuzzyReflect;
Expand Down Expand Up @@ -65,7 +67,14 @@ public NBTEntityExpression() throws NBTInitializeException {
// 这个 EntityTypes 类可以用模糊反射, 但是 Entity 类这几个函数都是同样参数同样返回值, 暂时不用
entityTypesCreateEntityMethod = Accessors.getMethodAccessor(FuzzyReflect.fromClass(entityTypesClass, true).getMethodByParameters("a", entityClass, new Class[] { nbtTagCompoundClass, worldClass }));
entityReadMethod = Accessors.getMethodAccessor(entityClass, "c", nbtTagCompoundClass);
entityPlayerReadMethod = Accessors.getMethodAccessor(entityClass, "e", nbtTagCompoundClass);
entityPlayerReadMethod = Accessors.getMethodAccessorBuilderBukkitVer(new SingleParamBuilder<MethodAccessor, MinecraftBukkitVersion>() {
@Override
public MethodAccessor build(MinecraftBukkitVersion param) {
if(!param.isOrLater(MinecraftBukkitVersion.V1_9_R2))
return Accessors.getMethodAccessor(entityClass, "e", nbtTagCompoundClass);
return Accessors.getMethodAccessor(FuzzyReflect.fromClass(entityClass).getMethodByParameters("save", nbtTagCompoundClass, new Class[] { nbtTagCompoundClass }));
}
});
entityWriteMethod = entityPlayerWriteMethod = Accessors.getMethodAccessor(entityClass, "f", nbtTagCompoundClass);
}
catch(Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ public void write(Chunk chunk, NBTCompound nbt) throws NBTException {
}

@Override
@Deprecated
public Entity spawnEntity(NBTCompound nbt, World world) throws NBTException {

Validate.notNull(nbt, "The nbt tag object is null.");
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/minecraft/moonlake/api/nbt/NBTLibrary.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ public interface NBTLibrary {
* @return Entity
* @throws NBTException 如果生成实体时错误则抛出异常
* @throws IllegalArgumentException 如果实体对象或目标世界对象为 {@code null} 则抛出异常
* @deprecated 已过时, 将于 v1.9-a6 删除.
*/
@Deprecated
Entity spawnEntity(NBTCompound nbt, World world) throws NBTException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public Object createTag(Object value, NBTType type) throws NBTConvertException {

Validate.notNull(type, "The nbt tag type object is null.");

return createTag(convertValue(value, type.getType()));
return createTag(convertValue(value, (byte) type.getTypeId()));
}

/**
Expand Down
Loading

0 comments on commit 3609f47

Please sign in to comment.