Skip to content

Commit

Permalink
Various Fixes (Nukkit#266)
Browse files Browse the repository at this point in the history
- No water from broken packed ice
- Anvil can now be placed on snow layer
- Fix dead bush turning to update block if replaced with other block

Everything tested and works

(cherry picked from commit f1b33cd)
  • Loading branch information
PetteriM1 authored and boybook committed Jul 24, 2018
1 parent 8ccc677 commit 667a354
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/block/BlockAnvil.java
Expand Up @@ -89,7 +89,7 @@ public String getName() {

@Override
public boolean place(Item item, Block block, Block target, BlockFace face, double fx, double fy, double fz, Player player) {
if (!target.isTransparent()) {
if (!target.isTransparent() || target.getId() == Block.SNOW_LAYER) {
int damage = this.getDamage();
int[] faces = {1, 2, 3, 0};
this.setDamage(faces[player != null ? player.getDirection().getHorizontalIndex() : 0]);
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/cn/nukkit/block/BlockDeadBush.java
Expand Up @@ -31,6 +31,11 @@ public String getName() {
public int getId() {
return DEAD_BUSH;
}

@Override
public boolean canBeReplaced() {
return true;
}

@Override
public boolean place(Item item, Block block, Block target, BlockFace face, double fx, double fy, double fz, Player player) {
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/cn/nukkit/block/BlockIcePacked.java
@@ -1,5 +1,6 @@
package cn.nukkit.block;

import cn.nukkit.item.Item;
import cn.nukkit.item.ItemTool;

/**
Expand Down Expand Up @@ -35,4 +36,10 @@ public int onUpdate(int type) {
public boolean canHarvestWithHand() {
return false;
}

@Override
public boolean onBreak(Item item) {
this.getLevel().setBlock(this, new BlockAir(), true); //no water
return true;
}
}

0 comments on commit 667a354

Please sign in to comment.