Skip to content

Commit

Permalink
compat for beta 5, fix watering cans
Browse files Browse the repository at this point in the history
  • Loading branch information
eerussianguy committed Sep 9, 2022
1 parent c204f69 commit 223afd9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 33 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ mixin_version=0.8.5
jei_version=9.7.1.232
patchouli_version=1.18.2-70
tfc_version=0.0.0-indev
tfc_identifier=3970479
tfc_identifier=3975434
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.eerussianguy.firmalife.config.FLConfig;
import net.dries007.tfc.common.blockentities.ComposterBlockEntity;
import net.dries007.tfc.common.blockentities.TFCBlockEntities;
import net.dries007.tfc.common.blocks.devices.TFCComposterBlock;
import net.dries007.tfc.config.TFCConfig;
import net.dries007.tfc.util.climate.Climate;

Expand All @@ -18,42 +17,22 @@ public IronComposterBlockEntity(BlockPos pos, BlockState state)
}

@Override
public void randomTick()
public long getReadyTicks()
{
if (getGreen() >= 4 && getBrown() >= 4 & !isRotten())
assert level != null;
final float rainfall = Climate.getRainfall(level, getBlockPos());
long readyTicks = FLConfig.SERVER.ironComposterTicks.get(); // firmalife: divide ready time by 4
if (TFCConfig.SERVER.composterRainfallCheck.get())
{
assert level != null;
final float rainfall = Climate.getRainfall(level, getBlockPos());
long readyTicks = FLConfig.SERVER.ironComposterTicks.get(); // firmalife: divide ready time by 4
if (TFCConfig.SERVER.composterRainfallCheck.get())
if (rainfall < 150f) // inverted trapezoid wave
{
if (rainfall < 150f) // inverted trapezoid wave
{
readyTicks *= (long) ((150f - rainfall) / 50f + 1f);
}
else if (rainfall > 350f)
{
readyTicks *= (long) ((rainfall - 350f) / 50f + 1f);
}
readyTicks *= (long) ((150f - rainfall) / 50f + 1f);
}
if (getTicksSinceUpdate() > readyTicks)
else if (rainfall > 350f)
{
setState(TFCComposterBlock.CompostType.READY);
markForSync();
readyTicks *= (long) ((rainfall - 350f) / 50f + 1f);
}
}
return readyTicks;
}

private void setState(TFCComposterBlock.CompostType type)
{
assert level != null;
level.setBlockAndUpdate(getBlockPos(), level.getBlockState(getBlockPos()).setValue(TFCComposterBlock.TYPE, type));
}

private boolean isRotten()
{
assert level != null;
return level.getBlockState(getBlockPos()).getValue(TFCComposterBlock.TYPE) == TFCComposterBlock.CompostType.ROTTEN;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class FLItems
public static final RegistryObject<Item> SEED_BALL = register("seed_ball", () -> new SeedBallItem(prop()));
public static final RegistryObject<Item> SPOON = register("spoon", MISC);
public static final RegistryObject<Item> TREATED_LUMBER = register("treated_lumber", MISC);
public static final RegistryObject<Item> WATERING_CAN = register("watering_can", () -> new WateringCanItem(prop()));
public static final RegistryObject<Item> WATERING_CAN = register("watering_can", () -> new WateringCanItem(prop().defaultDurability(20)));

public static final Map<Spice, RegistryObject<Item>> SPICES = Helpers.mapOfKeys(Spice.class, spice -> register("spice/" + spice.name(), MISC));
public static final Map<FLFood, RegistryObject<Item>> FOODS = Helpers.mapOfKeys(FLFood.class, food -> register("food/" + food.name(), () -> new DecayingItem(new Item.Properties().food(food.getFoodProperties()).tab(FOOD))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void releaseUsing(ItemStack stack, Level level, LivingEntity entity, int
receiver.addWater(0.25f);
}
}
stack.hurtAndBreak(1, entity, p -> p.broadcastBreakEvent(entity.getUsedItemHand()));
}

@Override
Expand Down

0 comments on commit 223afd9

Please sign in to comment.