9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-28 11:29:19 +00:00
This commit is contained in:
XiaoMoMi
2024-06-20 00:15:19 +08:00
parent f7f2b37c54
commit 7e7ce62138
7 changed files with 16 additions and 10 deletions

View File

@@ -195,7 +195,7 @@ public abstract class AbstractCustomListener implements Listener {
Sprinkler sprinkler = this.itemManager.getSprinklerBy3DItemID(itemID);
if (sprinkler != null) {
ItemStack newItem = this.itemManager.getItemStack(null, sprinkler.get2DItemID());
if (newItem != null) {
if (newItem != null && newItem.getType() != Material.AIR) {
newItem.setAmount(itemStack.getAmount());
item.setItemStack(newItem);
}
@@ -205,7 +205,7 @@ public abstract class AbstractCustomListener implements Listener {
Pot pot = this.itemManager.getPotByBlockID(itemID);
if (pot != null) {
ItemStack newItem = this.itemManager.getItemStack(null, pot.getDryItem());
if (newItem != null) {
if (newItem != null && newItem.getType() != Material.AIR) {
newItem.setAmount(itemStack.getAmount());
item.setItemStack(newItem);
}

View File

@@ -55,7 +55,7 @@ public class SimpleLocation {
}
public ChunkPos getChunkPos() {
return new ChunkPos(x >> 4, z >> 4);
return new ChunkPos((int) Math.floor((double) getX() / 16), (int) Math.floor((double) getZ() / 16));
}
public SimpleLocation add(int x, int y, int z) {

View File

@@ -83,6 +83,9 @@ public class AbstractCustomCropsBlock implements DataBlock {
* @return can be ticked or not
*/
public boolean canTick(int interval) {
if (interval <= 0) {
return false;
}
if (interval == 1) {
return true;
}