Skip to content

Commit

Permalink
😔
Browse files Browse the repository at this point in the history
  • Loading branch information
brachy84 committed Mar 6, 2024
1 parent 34c9311 commit fbbde53
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/main/java/com/cleanroommc/bogosorter/BogoSorter.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.logging.log4j.Logger;

import java.time.LocalDate;
import java.time.Month;

@Mod(modid = BogoSorter.ID,
name = BogoSorter.NAME,
Expand Down Expand Up @@ -159,6 +160,6 @@ public static boolean isExpandableInventoryLoaded() {

public static boolean isAprilFools() {
LocalDate date = LocalDate.now();
return date.getMonthValue() == 4 && date.getDayOfMonth() == 1;
return date.getMonth() == Month.APRIL && date.getDayOfMonth() == 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public class BogoSorterConfig {
public static final List<String> ORE_PREFIXES_LIST = new ArrayList<>();

public static int buttonColor = 0xFFFFFFFF;
public static float baseBogoChance = 0.01f;

@SideOnly(Side.CLIENT)
public static void save(JsonObject json) {
Expand All @@ -45,7 +44,6 @@ public static void save(JsonObject json) {
general.addProperty("sortSound", SortHandler.sortSound.getSoundName().toString());
general.addProperty("buttonColor", "#" + Integer.toHexString(buttonColor));
general.addProperty("_comment", "By setting the chance below to 0 you agree to have no humor and that you are boring.");
general.addProperty("baseBogoChance", baseBogoChance);

json.add("General", general);

Expand Down Expand Up @@ -86,7 +84,6 @@ public static void load(JsonObject json) {
SortHandler.sortSound = SoundEvents.UI_BUTTON_CLICK;
}
buttonColor = JsonHelper.getColor(general, 0xFFFFFFFF, "buttonColor");
baseBogoChance = MathHelper.clamp(JsonHelper.getFloat(general, 0.01f, "baseBogoChance"), 0f, 1f);
}
sortRules.clear();
if (json.has("ItemSortRules")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ public static void playSortSound() {
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(sound, 1f));
}

private static float getBogoChance() {
float f = BogoSorterConfig.baseBogoChance;
if (BogoSorter.isAprilFools()) {
return f < 0.01 ? 0.2f : Math.min(f * 20, 1f);
}
return f;
}

private final EntityPlayer player;
private final Container container;
private final GuiSortingContext context;
Expand Down Expand Up @@ -91,8 +83,7 @@ public void sort(int slotId, boolean sync) {

public void sort(SlotGroup slotGroup, boolean sync) {
if (slotGroup != null) {
float chance = getBogoChance();
if (chance > 0 && BogoSorter.RND.nextFloat() < getBogoChance()) {
if (BogoSorter.isAprilFools() && BogoSorter.RND.nextFloat() < 0.01f) {
sortBogo(slotGroup);
this.player.sendMessage(new TextComponentString("Get Bogo'd!"));
} else {
Expand Down

0 comments on commit fbbde53

Please sign in to comment.