[go: nahoru, domu]

Skip to content

Commit

Permalink
adapt: endstone recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
KoshakMineDEV committed Jul 14, 2024
1 parent 2529637 commit 7d38ba1
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 158 deletions.
7 changes: 6 additions & 1 deletion src/main/java/cn/nukkit/block/BlockChest.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,15 @@ public boolean canBePulled() {
}

/**
* TODO: 大箱子在PNX不能推动
* TODO: Double chests cannot be moved
*/
protected boolean canMove() {
var blockEntity = this.getBlockEntity();
return blockEntity == null || !blockEntity.isPaired();
}

@Override
public Item[] getDrops(Item item) {
return new Item[]{toItem()};
}
}
8 changes: 6 additions & 2 deletions src/main/java/cn/nukkit/item/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,11 @@ public static CompoundTag parseCompoundTag(byte[] tag) {
try {
return NBTIO.read(tag, ByteOrder.LITTLE_ENDIAN);
} catch (IOException e) {
throw new UncheckedIOException(e);
try {
return NBTIO.read(tag, ByteOrder.BIG_ENDIAN);
} catch (IOException ee) {
throw new UncheckedIOException(ee);
}
}
}

Expand All @@ -766,7 +770,7 @@ public byte[] writeCompoundTag(CompoundTag tag) {
return EmptyArrays.EMPTY_BYTES;
}
try {
return NBTIO.write(tag, ByteOrder.LITTLE_ENDIAN);
return NBTIO.write(tag, ByteOrder.BIG_ENDIAN);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/cn/nukkit/recipe/BlastFurnaceRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public boolean match(Input input) {

@Override
public RecipeType getType() {
if (this.getInput() instanceof DefaultDescriptor des) {
return des.getItem().hasMeta() ? RecipeType.BLAST_FURNACE_DATA : RecipeType.BLAST_FURNACE;
} else return RecipeType.BLAST_FURNACE;
return RecipeType.BLAST_FURNACE;
}
}
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/recipe/CampfireRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public boolean match(Input input) {

@Override
public RecipeType getType() {
return this.getInput().toItem().hasMeta() ? RecipeType.CAMPFIRE_DATA : RecipeType.CAMPFIRE;
return RecipeType.CAMPFIRE;
}
}
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/recipe/FurnaceRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ public boolean match(Input input) {

@Override
public RecipeType getType() {
return this.getInput().toItem().hasMeta() ? RecipeType.FURNACE_DATA : RecipeType.FURNACE;
return RecipeType.FURNACE;
}
}
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/recipe/SmokerRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public boolean match(Input input) {

@Override
public RecipeType getType() {
return this.getResult().hasMeta() ? RecipeType.SMOKER_DATA : RecipeType.SMOKER;
return RecipeType.SMOKER;
}
}
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/recipe/SoulCampfireRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ public SoulCampfireRecipe(String recipeId, Item result, Item ingredient) {

@Override
public RecipeType getType() {
return this.getInput().toItem().hasMeta() ? RecipeType.SOUL_CAMPFIRE_DATA : RecipeType.SOUL_CAMPFIRE;
return RecipeType.SOUL_CAMPFIRE;
}
}
257 changes: 109 additions & 148 deletions src/main/java/cn/nukkit/registry/RecipeRegistry.java

Large diffs are not rendered by default.

0 comments on commit 7d38ba1

Please sign in to comment.