Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private static class NewBlockData extends WrappedBlockData {
private static MethodAccessor TO_LEGACY_DATA;
private static MethodAccessor GET_BLOCK;
private static MethodAccessor BLOCK_FROM_MATERIAL;
private static MethodAccessor GET_BLOCK_DATA;
private static MethodAccessor DEFAULT_BLOCK_DATA;
private static MethodAccessor FROM_LEGACY_DATA;
private static MethodAccessor GET_HANDLE;

Expand Down Expand Up @@ -100,7 +100,7 @@ private static class NewBlockData extends WrappedBlockData {
.parameterCount(0)
.returnTypeExact(IBLOCK_DATA)
.build();
GET_BLOCK_DATA = Accessors.getMethodAccessor(fuzzy.getMethod(contract));
DEFAULT_BLOCK_DATA = Accessors.getMethodAccessor(fuzzy.getMethod(contract));

fuzzy = FuzzyReflection.fromClass(MinecraftReflection.getCraftBukkitClass("block.data.CraftBlockData"));
contract = FuzzyMethodContract
Expand Down Expand Up @@ -131,7 +131,7 @@ public int getData() {
@Override
public void setType(Material material) {
Object block = BLOCK_FROM_MATERIAL.invoke(null, material);
setHandle(GET_BLOCK_DATA.invoke(block));
setHandle(DEFAULT_BLOCK_DATA.invoke(block));
}

@Override
Expand All @@ -141,7 +141,7 @@ public void setData(int data) {

@Override
public void setTypeAndData(Material material, int data) {
setHandle(TO_LEGACY_DATA.invoke(null, material, (byte) data));
setHandle(FROM_LEGACY_DATA.invoke(null, material, (byte) data));
}

@Override
Expand All @@ -151,7 +151,7 @@ public WrappedBlockData deepClone() {

private static WrappedBlockData createNewData(Material material) {
Object block = BLOCK_FROM_MATERIAL.invoke(null, material);
return new NewBlockData(GET_BLOCK_DATA.invoke(block));
return new NewBlockData(DEFAULT_BLOCK_DATA.invoke(block));
}

private static WrappedBlockData createNewData(Material material, int data) {
Expand Down