Commit f3a4330a authored by primetoxinz's avatar primetoxinz

Add configs for HCFishing times and world modifiers.

parent f7ab06cf
package betterwithmods.common.entity;
import betterwithmods.module.hardcore.crafting.HCFishing;
import betterwithmods.util.WorldUtils;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
......@@ -54,22 +55,17 @@ public class EntityHCFishHook extends EntityFishHook implements IEntityAdditiona
WorldServer worldserver = (WorldServer) this.world;
//minutes
double min = 1;
if (WorldUtils.isTimeFrame(world, WorldUtils.TimeFrame.NIGHT)) {
min *= 2; //2
}
if (worldserver.isRainingAt(pos.up())) {
min *= 0.75; //1.5
}
if (WorldUtils.isMoonPhase(world, WorldUtils.MoonPhase.Full)) {
min /= 2; //.75
}
if (WorldUtils.isTimeFrame(worldserver, WorldUtils.TimeFrame.DAWN) || WorldUtils.isTimeFrame(worldserver, WorldUtils.TimeFrame.DUSK)) {
min /= 2;
}
double initialTime = HCFishing.configuration.initialTime;
if (WorldUtils.isTimeFrame(world, WorldUtils.TimeFrame.NIGHT))
initialTime *= HCFishing.configuration.nightModifier;
if (worldserver.isRainingAt(pos.up()))
initialTime *= HCFishing.configuration.rainModifier;
if (WorldUtils.isMoonPhase(world, WorldUtils.MoonPhase.Full))
initialTime *= HCFishing.configuration.fullMoonModifier;
if (WorldUtils.isTimeFrame(worldserver, WorldUtils.TimeFrame.DAWN))
initialTime *= HCFishing.configuration.dawnModifier;
else if (WorldUtils.isTimeFrame(worldserver, WorldUtils.TimeFrame.DUSK))
initialTime *= HCFishing.configuration.duskModifier;
if (this.ticksCatchable > 0) {
--this.ticksCatchable;
......@@ -145,7 +141,7 @@ public class EntityHCFishHook extends EntityFishHook implements IEntityAdditiona
this.ticksCaughtDelay = 1;
} else {
int modifer = 20 * 60;
this.ticksCaughtDelay = MathHelper.getInt(this.rand, (int) (min * (modifer)), (int) ((min + 2) * (modifer)));
this.ticksCaughtDelay = MathHelper.getInt(this.rand, (int) (initialTime * (modifer)), (int) ((initialTime + 2) * (modifer)));
this.ticksCaughtDelay = Math.max(1200, this.ticksCaughtDelay - (this.lureSpeed * 1200));
}
......
......@@ -61,12 +61,14 @@ public class HCFishing extends Feature {
private static final ResourceLocation BAITED_FISHING_ROD = new ResourceLocation(BWMod.MODID, "baited_fishing_rod");
public static Ingredient BAIT = Ingredient.EMPTY;
public static FishingTimes configuration;
@Override
public void setupConfig() {
requireBait = loadPropBool("Require Bait", "Change Fishing Rods to require being Baited with certain items to entice fish, they won't nibble without it!", true);
restrictToOpenWater = loadPropBool("Restrict to Open Water", "Fishing on underground locations won't work, hook must be placed on a water block with line of sight to the sky.", true);
minimumWaterDepth = loadPropInt("Minimum Water Depth", "If higher than 1, requires bodies of water to have a minimum depth for fishing to be successful.", 3);
configuration = new FishingTimes();
}
@Override
......@@ -296,7 +298,8 @@ public class HCFishing extends Feature {
public static class FishingBait implements ICapabilitySerializable<NBTTagCompound> {
private boolean bait;
public FishingBait() {}
public FishingBait() {
}
public boolean hasBait() {
return bait;
......@@ -331,4 +334,18 @@ public class HCFishing extends Feature {
setBait(nbt.getBoolean("bait"));
}
}
public class FishingTimes {
public double initialTime;
public double nightModifier, rainModifier, fullMoonModifier, dawnModifier, duskModifier;
public FishingTimes() {
initialTime = loadPropDouble("Base Time", "Starting time for which fishing events are calculated in minutes", 1);
nightModifier = loadPropDouble("Night Modifier", "Scale the baseTime by this when it is night time", 2);
rainModifier = loadPropDouble("Rain Modifier", "Scale the baseTime by this when it is raining", 0.75);
fullMoonModifier = loadPropDouble("Full Moon Modifier", "Scale the baseTime by this when it is a full moon", 0.5);
dawnModifier = loadPropDouble("Dawn Modifier", "Scale the baseTime by this when it is dawn", 0.5);
duskModifier = loadPropDouble("Dusk Modifier", "Scale the baseTime by this when it is dusk", 0.5);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment