Skip to content

Commit

Permalink
Boyyfrieneddddd
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySemicolon committed Apr 15, 2024
1 parent 40b7451 commit acd86a7
Show file tree
Hide file tree
Showing 54 changed files with 584 additions and 572 deletions.
2 changes: 1 addition & 1 deletion src/generated/resources/assets/malum/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -1117,11 +1117,11 @@
"malum.gui.curio.effect.explosion_drops_collected": "Automatic Collection of Explosion Drops",
"malum.gui.curio.effect.explosions_spare_valuables": "Protects Valuable Items from Explosions",
"malum.gui.curio.effect.extend_positive_effect": "Extends Positive Effects",
"malum.gui.curio.effect.fervor": "Increased Mining Speed",
"malum.gui.curio.effect.friendly_enemies": "Reduces Enemy Aggression",
"malum.gui.curio.effect.full_health_fake_collection": "Striking Full Health Targets Triggers Spirit Collection Effects",
"malum.gui.curio.effect.gluttony_magic_proficiency": "Gluttony Exchanges Hunger for Magic Proficiency",
"malum.gui.curio.effect.growing_gluttony": "Eating Rotten Foods Extends Gluttony",
"malum.gui.curio.effect.haste": "Increased Mining Speed",
"malum.gui.curio.effect.hunger_drain": "Actively Drains Hunger",
"malum.gui.curio.effect.low_health_speed": "Speed at Low Health",
"malum.gui.curio.effect.no_sweep": "Disables Scythe Sweeping",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"extra_items": [
{
"count": 6,
"item": "malum:copper_node"
"tag": "forge:ingots/iron"
},
{
"count": 4,
"item": "minecraft:gunpowder"
},
{
"count": 4,
"item": "malum:cursed_grit"
"count": 2,
"item": "minecraft:blaze_powder"
}
],
"input": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@
"type": "malum:spirit_infusion",
"extra_items": [
{
"count": 2,
"item": "minecraft:ender_pearl"
"count": 6,
"tag": "forge:ingots/iron"
},
{
"count": 4,
"item": "malum:warp_flux"
},
{
"count": 4,
"tag": "forge:ingots/iron"
},
{
"count": 8,
"item": "minecraft:gunpowder"
"count": 2,
"item": "minecraft:ender_pearl"
}
],
"input": {
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/com/sammy/malum/client/screen/codex/BookEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

import java.util.function.*;

public class BookEntry<T extends EntryScreen<T, K>, K extends AbstractMalumScreen<K>> {
public class BookEntry {

public final String identifier;
public final boolean isVoid;
public final ImmutableList<BookPage<T>> pages;
public final ImmutableList<EntryReference<T, K>> references;
public Predicate<T> isValid = t -> true;
public final ImmutableList<BookPage> pages;
public final ImmutableList<EntryReference> references;
public Predicate<EntryScreen> isValid = t -> true;

public BookEntry(String identifier, boolean isVoid, ImmutableList<BookPage<T>> pages, ImmutableList<EntryReference<T, K>> references) {
public BookEntry(String identifier, boolean isVoid, ImmutableList<BookPage> pages, ImmutableList<EntryReference> references) {
this.identifier = identifier;
this.isVoid = isVoid;
this.pages = pages;
Expand All @@ -29,15 +29,15 @@ public String descriptionTranslationKey() {
return "malum.gui.book.entry." + identifier + ".description";
}

public boolean isValid(T screen) {
public boolean isValid(EntryScreen screen) {
return isValid.test(screen);
}

public static <T extends EntryScreen<T, K>, K extends AbstractProgressionCodexScreen<K>> PlacedBookEntryBuilder<T, K> build(String identifier, int xOffset, int yOffset) {
return new PlacedBookEntryBuilder<>(identifier, xOffset, yOffset);
public static PlacedBookEntryBuilder build(String identifier, int xOffset, int yOffset) {
return new PlacedBookEntryBuilder(identifier, xOffset, yOffset);
}

public static <T extends EntryScreen<T, K>, K extends AbstractMalumScreen<K>> BookEntryBuilder<T, K> build(String identifier) {
return new BookEntryBuilder<>(identifier);
public static BookEntryBuilder build(String identifier) {
return new BookEntryBuilder(identifier);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,37 @@

import com.google.common.collect.*;
import com.sammy.malum.client.screen.codex.pages.*;
import com.sammy.malum.client.screen.codex.screens.*;

import java.util.*;

public class BookEntryBuilder<T extends EntryScreen<T, K>, K extends AbstractMalumScreen<K>> {
public class BookEntryBuilder {

protected final String identifier;
protected final boolean isVoid;

protected List<BookPage<T>> pages = new ArrayList<>();
protected List<EntryReference<T, K>> references = new ArrayList<>();
protected List<BookPage> pages = new ArrayList<>();
protected List<EntryReference> references = new ArrayList<>();

public BookEntryBuilder(String identifier) {
this.identifier = identifier;
this.isVoid = identifier.startsWith("void.");
}

public BookEntryBuilder<T, K> addPage(BookPage<T> page) {
public BookEntryBuilder addPage(BookPage page) {
if (page.isValid()) {
pages.add(page);
}
return this;
}
public BookEntryBuilder<T, K> addReference(EntryReference<T, K> reference) {
public BookEntryBuilder addReference(EntryReference reference) {
references.add(reference);
return this;
}

public BookEntry<T, K> build() {
ImmutableList<BookPage<T>> bookPages = ImmutableList.copyOf(pages);
ImmutableList<EntryReference<T, K>> entryReferences = ImmutableList.copyOf(references);
BookEntry<T, K> bookEntry = new BookEntry<>(identifier, isVoid, bookPages, entryReferences);
public BookEntry build() {
ImmutableList<BookPage> bookPages = ImmutableList.copyOf(pages);
ImmutableList<EntryReference> entryReferences = ImmutableList.copyOf(references);
BookEntry bookEntry = new BookEntry(identifier, isVoid, bookPages, entryReferences);
bookPages.forEach(p -> p.setBookEntry(bookEntry));
return bookEntry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,27 @@
import com.google.common.collect.*;
import com.sammy.malum.client.screen.codex.objects.progression.*;
import com.sammy.malum.client.screen.codex.pages.*;
import com.sammy.malum.client.screen.codex.screens.*;

import java.util.function.*;

public class PlacedBookEntry<T extends EntryScreen<T, K>, K extends AbstractProgressionCodexScreen<K>>extends BookEntry<T, K> {
private final BookEntryWidgetPlacementData<K> widgetData;
public class PlacedBookEntry extends BookEntry {
private final BookEntryWidgetPlacementData widgetData;

public PlacedBookEntry(String identifier, boolean isVoid, BookEntryWidgetPlacementData<K> widgetData, ImmutableList<BookPage<T>> bookPages, ImmutableList<EntryReference<T, K>> entryReferences) {
public PlacedBookEntry(String identifier, boolean isVoid, BookEntryWidgetPlacementData widgetData, ImmutableList<BookPage> bookPages, ImmutableList<EntryReference> entryReferences) {
super(identifier, isVoid, bookPages, entryReferences);
this.widgetData = widgetData;
}

public BookEntryWidgetPlacementData<K> getWidgetData() {
public BookEntryWidgetPlacementData getWidgetData() {
return widgetData;
}

public interface WidgetSupplier<T extends AbstractProgressionCodexScreen<T>> {
ProgressionEntryObject<T> getBookObject(BookEntry<?, T> entry, int x, int y);
public interface WidgetSupplier {
ProgressionEntryObject getBookObject(BookEntry entry, int x, int y);
}

public record BookEntryWidgetPlacementData<T extends AbstractProgressionCodexScreen<T>>(int xOffset, int yOffset,
WidgetSupplier<T> widgetSupplier,
Consumer<ProgressionEntryObject<T>> widgetConfig) {
public record BookEntryWidgetPlacementData(int xOffset, int yOffset,
WidgetSupplier widgetSupplier,
Consumer<ProgressionEntryObject> widgetConfig) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
import com.google.common.collect.*;
import com.sammy.malum.client.screen.codex.objects.progression.*;
import com.sammy.malum.client.screen.codex.pages.*;
import com.sammy.malum.client.screen.codex.screens.*;

import java.util.function.*;

public class PlacedBookEntryBuilder<T extends EntryScreen<T, K>, K extends AbstractProgressionCodexScreen<K>> extends BookEntryBuilder<T, K> {
public class PlacedBookEntryBuilder extends BookEntryBuilder {

protected PlacedBookEntry.WidgetSupplier<K> widgetSupplier = ProgressionEntryObject::new;
protected Consumer<ProgressionEntryObject<K>> widgetConfig;
protected PlacedBookEntry.WidgetSupplier widgetSupplier = ProgressionEntryObject::new;
protected Consumer<ProgressionEntryObject> widgetConfig;

protected final int xOffset;
protected final int yOffset;
Expand All @@ -21,22 +20,22 @@ public PlacedBookEntryBuilder(String identifier, int xOffset, int yOffset) {
this.yOffset = yOffset*40;
}

public PlacedBookEntryBuilder<T, K> setWidgetSupplier(PlacedBookEntry.WidgetSupplier<K> widgetSupplier) {
public PlacedBookEntryBuilder setWidgetSupplier(PlacedBookEntry.WidgetSupplier widgetSupplier) {
this.widgetSupplier = widgetSupplier;
return this;
}

public PlacedBookEntryBuilder<T, K> setWidgetConfig(Consumer<ProgressionEntryObject<K>> widgetConfig) {
public PlacedBookEntryBuilder setWidgetConfig(Consumer<ProgressionEntryObject> widgetConfig) {
this.widgetConfig = widgetConfig;
return this;
}

@Override
public PlacedBookEntry<T, K> build() {
ImmutableList<BookPage<T>> bookPages = ImmutableList.copyOf(pages);
ImmutableList<EntryReference<T, K>> entryReferences = ImmutableList.copyOf(references);
PlacedBookEntry.BookEntryWidgetPlacementData<K> data = new PlacedBookEntry.BookEntryWidgetPlacementData<>(xOffset, yOffset, widgetSupplier, widgetConfig);
PlacedBookEntry<T, K> bookEntry = new PlacedBookEntry<>(identifier, isVoid, data, bookPages, entryReferences);
public PlacedBookEntry build() {
ImmutableList<BookPage> bookPages = ImmutableList.copyOf(pages);
ImmutableList<EntryReference> entryReferences = ImmutableList.copyOf(references);
PlacedBookEntry.BookEntryWidgetPlacementData data = new PlacedBookEntry.BookEntryWidgetPlacementData(xOffset, yOffset, widgetSupplier, widgetConfig);
PlacedBookEntry bookEntry = new PlacedBookEntry(identifier, isVoid, data, bookPages, entryReferences);
bookPages.forEach(p -> p.setBookEntry(bookEntry));
return bookEntry;
}
Expand Down
Loading

0 comments on commit acd86a7

Please sign in to comment.