Skip to content

Commit

Permalink
Synchronize some nkx block updates (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
lt-name authored Oct 4, 2024
1 parent 2de5bda commit 438fa1c
Show file tree
Hide file tree
Showing 144 changed files with 2,905 additions and 785 deletions.
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/Server.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cn.nukkit;

import cn.nukkit.block.Block;
import cn.nukkit.block.customblock.CustomBlockManager;
import cn.nukkit.block.custom.CustomBlockManager;
import cn.nukkit.blockentity.*;
import cn.nukkit.command.*;
import cn.nukkit.console.NukkitConsole;
Expand Down
568 changes: 29 additions & 539 deletions src/main/java/cn/nukkit/block/Block.java

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockAnvil.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public boolean canBeActivated() {
}

@Override
public int getWaterloggingLevel() {
return 1;
public WaterloggingType getWaterloggingType() {
return WaterloggingType.WHEN_PLACED_IN_WATER;
}

@Override
Expand Down
95 changes: 95 additions & 0 deletions src/main/java/cn/nukkit/block/BlockAzalea.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package cn.nukkit.block;

import cn.nukkit.item.Item;
import cn.nukkit.item.ItemTool;
import cn.nukkit.level.Position;
import cn.nukkit.math.AxisAlignedBB;

public class BlockAzalea extends BlockTransparent {

public BlockAzalea() {
// Does nothing
}

@Override
public String getName() {
return "Azalea";
}

@Override
public int getId() {
return AZALEA;
}

@Override
public boolean canPlaceOn(Block floor, Position pos) {
// Azaleas can be placed on grass blocks, dirt, coarse dirt, rooted dirt, podzol, moss blocks, farmland, mud, muddy mangrove roots and clay.
switch (floor.getId()) {
case GRASS:
case DIRT:
case ROOTED_DIRT:
case PODZOL:
case MOSS_BLOCK:
case FARMLAND:
case MUD:
case CLAY_BLOCK:
return true;
}
return false;
}

@Override
public int getToolType() {
return ItemTool.TYPE_NONE;
}

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

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

@Override
public boolean canBePushed() {
return false;
}

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

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

@Override
public double getHardness() {
return 0;
}

@Override
public double getResistance() {
return 0;
}

@Override
public boolean isSolid() {
return false;
}

@Override
protected AxisAlignedBB recalculateBoundingBox() {
return null;
}

@Override
public Item[] getDrops(Item item) {
return Item.EMPTY_ARRAY;
}
}
17 changes: 17 additions & 0 deletions src/main/java/cn/nukkit/block/BlockAzaleaFlowering.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package cn.nukkit.block;

public class BlockAzaleaFlowering extends BlockAzalea {

public BlockAzaleaFlowering() {
}

@Override
public String getName() {
return "Flowering Azalea";
}

@Override
public int getId() {
return FLOWERING_AZALEA;
}
}
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockBanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public boolean canPassThrough() {
}

@Override
public int getWaterloggingLevel() {
return 1;
public WaterloggingType getWaterloggingType() {
return WaterloggingType.WHEN_PLACED_IN_WATER;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockBeacon.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public boolean canBeActivated() {
}

@Override
public int getWaterloggingLevel() {
return 1;
public WaterloggingType getWaterloggingType() {
return WaterloggingType.WHEN_PLACED_IN_WATER;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockBed.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ protected AxisAlignedBB recalculateBoundingBox() {
}

@Override
public int getWaterloggingLevel() {
return 1;
public WaterloggingType getWaterloggingType() {
return WaterloggingType.WHEN_PLACED_IN_WATER;
}

@Override
Expand Down
9 changes: 2 additions & 7 deletions src/main/java/cn/nukkit/block/BlockBedrockInvisible.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@ public String getName() {
}

@Override
public int getWaterloggingLevel() {
return 2;
}

@Override
public boolean canBeFlowedInto() {
return false;
public WaterloggingType getWaterloggingType() {
return WaterloggingType.FLOW_INTO_BLOCK;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockBell.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ public Item toItem() {
}

@Override
public int getWaterloggingLevel() {
return 1;
public WaterloggingType getWaterloggingType() {
return WaterloggingType.WHEN_PLACED_IN_WATER;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockBrewingStand.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public double getResistance() {
}

@Override
public int getWaterloggingLevel() {
return 1;
public WaterloggingType getWaterloggingType() {
return WaterloggingType.WHEN_PLACED_IN_WATER;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockBubbleColumn.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public String getName() {
}

@Override
public int getWaterloggingLevel() {
return 2;
public WaterloggingType getWaterloggingType() {
return WaterloggingType.FLOW_INTO_BLOCK;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public double getHardness() {
}

@Override
public int getWaterloggingLevel() {
return 1;
public WaterloggingType getWaterloggingType() {
return WaterloggingType.WHEN_PLACED_IN_WATER;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockCactus.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public double getResistance() {
}

@Override
public int getWaterloggingLevel() {
return 1;
public WaterloggingType getWaterloggingType() {
return WaterloggingType.WHEN_PLACED_IN_WATER;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockCake.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public double getResistance() {
}

@Override
public int getWaterloggingLevel() {
return 1;
public WaterloggingType getWaterloggingType() {
return WaterloggingType.WHEN_PLACED_IN_WATER;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockCampfire.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public boolean canSilkTouch() {
}

@Override
public int getWaterloggingLevel() {
return 1;
public WaterloggingType getWaterloggingType() {
return WaterloggingType.WHEN_PLACED_IN_WATER;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockCandleCake.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public double getResistance() {
}

@Override
public int getWaterloggingLevel() {
return 1;
public WaterloggingType getWaterloggingType() {
return WaterloggingType.WHEN_PLACED_IN_WATER;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockCarpet.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public boolean canPassThrough() {
}

@Override
public int getWaterloggingLevel() {
return 1;
public WaterloggingType getWaterloggingType() {
return WaterloggingType.WHEN_PLACED_IN_WATER;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cn/nukkit/block/BlockCauldron.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ public void setFillLevel(int fillLevel) {
}

@Override
public int getWaterloggingLevel() {
return 1;
public WaterloggingType getWaterloggingType() {
return WaterloggingType.WHEN_PLACED_IN_WATER;
}

@Override
Expand Down
Loading

0 comments on commit 438fa1c

Please sign in to comment.