Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Use Structure Void instead of Air #82

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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 @@ -74,7 +74,7 @@ public void harvest(@Nonnull Block block) {
public void whenPlaced(@NotNull BlockPlaceEvent event) {
super.whenPlaced(event);
addDisplayBush(event.getBlock().getLocation());
event.getBlock().setType(Material.AIR);
event.getBlock().setType(Material.STRUCTURE_VOID);
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public void updateGrowthStage(@Nonnull Block block, int growthStage) {
} else {
removeItems(block.getLocation());
}
block.setType(Material.AIR);
block.setType(Material.STRUCTURE_VOID);
} else if (growthStage == 2) {
ItemStack itemStack = getRandomItemWithDropModifier(block.getLocation());
if (itemStack != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void updateGrowthStage(@Nonnull Block block, int growthStage) {
}
} else if (growthStage == 1) {
addDisplayPlant(block.getLocation());
block.setType(Material.AIR);
block.setType(Material.STRUCTURE_VOID);
}
BlockStorage.addBlockInfo(block, Keys.FLORA_GROWTH_STAGE, String.valueOf(growthStage));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ private void unsafelyKillItem(@Nonnull Location location, @Nullable SlimefunItem
location.getWorld().dropItem(location, bush.getItem().clone());
bush.removeBushDisplayGroup(location);
BlockStorage.clearBlockInfo(location);
location.getBlock().setType(Material.AIR);
}
Copy link
Contributor

@Bunnky Bunnky Mar 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found bushes have similar issues as plants in regards to the unsafelyKillItem method. To fix this, I've added:

} else if (slimefunItem instanceof CultivationBush bush) {
location.getWorld().dropItem(location, bush.getItem().clone());
bush.removeBushDisplayGroup(location);
BlockStorage.clearBlockInfo(location);
location.getBlock().setType(Material.AIR);
}

Like most things, I'm not 100% this is efficient, but it's been working for us for a while

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore me, its been a long day :D I was thinking of something else that's not in scope here, apologies!

For reference I was thinking about

where I added event.getBlock().setType(Material.AIR); to stop a dupe

}

Expand Down
Loading