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

Basic fixes to Infernalfarm #44

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 @@ -4,6 +4,7 @@
import java.util.Set;

import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.data.Ageable;
Expand Down Expand Up @@ -60,6 +61,20 @@ public Recipe getRecipe() {
res.setIngredient('N', Material.NETHER_BRICK);
return res;
}

@Override
public void onBlockRegistered(Location location, boolean isPlacing) {
int range = RADIUS / 2;
Block block = location.getBlock();

for (int x = -range; x <= range; x++) {
for (int z = -range; z <= range; z++) {
blocks.add(block.getRelative(x, 2, z));
}
}

super.onBlockRegistered(location, isPlacing);
}
Comment on lines +65 to +77
Copy link
Member

Choose a reason for hiding this comment

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

This is just horrible and redundant, by calling the super method you add all blocks on the same y level yet again.
And this is very redundant as it only deviates from the super method by a single parameter.

Copy link
Member

Choose a reason for hiding this comment

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

Also the build is failing too...


@Override
public void onServerTick() {
Expand All @@ -71,9 +86,9 @@ public void onServerTick() {

if (ageable.getAge() >= ageable.getMaximumAge()) {
setCharge(getCharge() - getScuPerCycle());

ageable.setAge(0);
crop.getWorld().playEffect(crop.getLocation(), Effect.STEP_SOUND, crop.getType());
crop.setBlockData(ageable);
setJammed(!output(Material.NETHER_WART));
break;
}
Expand Down