Skip to content

Commit

Permalink
fix: berry string thing
Browse files Browse the repository at this point in the history
  • Loading branch information
bruberu committed Jul 1, 2024
1 parent bd4d57b commit 8ef79f3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
9 changes: 7 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1718246243
//version: 1719793363
/*
* DO NOT CHANGE THIS FILE!
* Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -69,6 +69,7 @@ propertyDefaultIfUnset("includeMCVersionJar", false)
propertyDefaultIfUnset("autoUpdateBuildScript", false)
propertyDefaultIfUnset("modArchivesBaseName", project.modId)
propertyDefaultIfUnsetWithEnvVar("developmentEnvironmentUserName", "Developer", "DEV_USERNAME")
propertyDefaultIfUnset("additionalJavaArguments", "")
propertyDefaultIfUnset("enableJava17RunTasks", false)
propertyDefaultIfUnset("generateGradleTokenClass", "")
propertyDefaultIfUnset("gradleTokenModId", "")
Expand Down Expand Up @@ -119,7 +120,7 @@ if (!getFile(targetPackageJava).exists() && !getFile(targetPackageScala).exists(

if (apiPackage) {
final String endApiPath = modGroupPath + '/' + apiPackagePath
if (useSrcApiPath) {
if (useSrcApiPath.toBoolean()) {
targetPackageJava = 'src/api/java/' + endApiPath
targetPackageScala = 'src/api/scala/' + endApiPath
targetPackageKotlin = 'src/api/kotlin/' + endApiPath
Expand Down Expand Up @@ -382,6 +383,10 @@ minecraft {
])
}

if (additionalJavaArguments.size() != 0) {
extraRunJvmArguments.addAll(additionalJavaArguments.split(';'))
}

if (enableJava17RunTasks.toBoolean()) {
lwjgl3Version = "3.3.2"
}
Expand Down
18 changes: 11 additions & 7 deletions src/main/java/gregtechfoodoption/item/GTFOBerrySeedBehaviour.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package gregtechfoodoption.item;

import gregtechfoodoption.block.GTFOBerryBush;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
Expand All @@ -16,6 +14,8 @@

import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;

// bri'ish class
public class GTFOBerrySeedBehaviour extends GTFOCropSeedBehaviour {
Expand All @@ -33,7 +33,8 @@ public ActionResult<ItemStack> onItemUse(EntityPlayer player, World world, Block
}

private boolean isBlocked(World world, BlockPos pos, EntityPlayer player) {
AtomicBoolean areAnyBlocked = new AtomicBoolean(false);
AtomicInteger areAnyBlocked = new AtomicInteger(0);
AtomicReference<BlockPos> blockedCrop = new AtomicReference<>();
BlockPos.getAllInBox(pos.up().east().north(), pos.up().west().south()).forEach((crop) -> {
if (crop.equals(pos.up()) || world.getBlockState(crop).getBlock() instanceof GTFOBerryBush) {
AtomicBoolean isBlocked = new AtomicBoolean(true);
Expand All @@ -43,13 +44,16 @@ private boolean isBlocked(World world, BlockPos pos, EntityPlayer player) {
}
});
if (isBlocked.get()) {
if (world.isRemote)
player.sendMessage(new TextComponentTranslation("gregtechfoodoption.blocked", crop));
areAnyBlocked.set(true);
blockedCrop.set(crop);
areAnyBlocked.set(areAnyBlocked.get() + 1);
}
}
});
return areAnyBlocked.get();
if (world.isRemote && areAnyBlocked.get() > 0) {
String posString = "(" + blockedCrop.get().getX() + ", " + blockedCrop.get().getY() + ", " + blockedCrop.get().getZ() + ")";
player.sendMessage(new TextComponentTranslation("gregtechfoodoption.blocked", posString, areAnyBlocked.get()));
}
return areAnyBlocked.get() > 0;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@ gregtechfoodoption.berry.description.1=§bGrows faster in higher tiers
gregtechfoodoption.berry.description.2=Place §5three§r grown berry bushes of the previous tier in the 3x3 centered on the bush to get to the next tier
gregtechfoodoption.berry.description.3=§4The 3x3 centered on the bush must not be filled!

gregtechfoodoption.blocked=This blocks a berry bush at %s!
gregtechfoodoption.blocked=This blocks a berry bush at %s (%s in total).

metaitem.component.coconut.name=Coconut
metaitem.component.coconut.tooltip=A cold-blooded Killer
Expand Down

0 comments on commit 8ef79f3

Please sign in to comment.