Skip to content

Commit

Permalink
boats are back
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Aug 13, 2024
1 parent fd23ce8 commit 52e426f
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 78 deletions.
13 changes: 7 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ val loaderVersion: String by properties
val javaVersion: String by properties

val fabricApiVersion: String by properties
val fabricAsmVersion: String by properties
val customportalapiVersion: String by properties
val cardinalComponentsVersion: String by properties
val trinketsVersion: String by properties
Expand Down Expand Up @@ -120,6 +121,12 @@ dependencies {
version = customportalapiVersion,
).also(::include).exclude(module = "sodium")

modImplementation(
group = "com.github.Chocohead",
name = "Fabric-ASM",
version = fabricAsmVersion,
).also(::include)

modImplementation(
group = "net.fabricmc.fabric-api",
name = "fabric-api",
Expand Down Expand Up @@ -149,12 +156,6 @@ dependencies {
version = cardinalComponentsVersion,
)

modRuntimeOnly(
group = "com.terraformersmc",
name = "modmenu",
version = modmenuVersion,
)


}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ cardinalComponentsVersion=5.1.0
trinketsVersion=3.6.0
crowdinTranslateVersion=1.19.4
entityAttributesVersion=2.3.2
modmenuVersion=6.3.1
clothConfigVersion=10.1.117
fabricAsmVersion=2.3
17 changes: 7 additions & 10 deletions src/main/java/net/id/paradiselost/items/ParadiseLostItems.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package net.id.paradiselost.items;

import com.chocohead.mm.api.ClassTinkerers;
import com.google.common.collect.ImmutableList;
import dev.emi.trinkets.api.TrinketItem;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.id.paradiselost.ParadiseLost;
import net.id.paradiselost.blocks.ParadiseLostBlocks;
import net.id.paradiselost.entities.ParadiseLostEntityTypes;
import net.id.paradiselost.items.accessories.ParachuteTrinketItem;
Expand All @@ -18,7 +17,6 @@
import net.id.paradiselost.items.tools.bloodstone.CherineBloodstoneItem;
import net.id.paradiselost.items.tools.bloodstone.SurtrumBloodstoneItem;
import net.id.paradiselost.items.tools.bloodstone.OlviteBloodstoneItem;
import net.id.paradiselost.util.EnumExtender;
import net.minecraft.block.Block;
import net.minecraft.block.DoorBlock;
import net.minecraft.block.TallPlantBlock;
Expand All @@ -37,7 +35,6 @@

import java.util.Arrays;
import java.util.Iterator;
import java.util.Locale;
import java.util.function.Consumer;

import static net.id.paradiselost.ParadiseLost.MOD_ID;
Expand Down Expand Up @@ -432,10 +429,10 @@ private static FabricItemSettings decoration() {
public static final BlockItem ORANGE_PRESSURE_PLATE = add("orange_pressure_plate", ParadiseLostBlocks.ORANGE_WOODSTUFF.pressurePlate(), decoration);
public static final BlockItem WISTERIA_PRESSURE_PLATE = add("wisteria_pressure_plate", ParadiseLostBlocks.WISTERIA_WOODSTUFF.pressurePlate(), decoration);

public static final BoatSet AUREL_BOATS = addBoatItems("aurel", ParadiseLostBlocks.AUREL_WOODSTUFF.plank());
public static final BoatSet MOTHER_AUREL_BOATS = addBoatItems("mother_aurel", ParadiseLostBlocks.MOTHER_AUREL_WOODSTUFF.plank());
public static final BoatSet ORANGE_BOATS = addBoatItems("orange", ParadiseLostBlocks.ORANGE_WOODSTUFF.plank());
public static final BoatSet WISTERIA_BOATS = addBoatItems("wisteria", ParadiseLostBlocks.WISTERIA_WOODSTUFF.plank());
public static final BoatSet AUREL_BOATS = addBoatItems("aurel", "PARADISE_LOST_AUREL");
public static final BoatSet MOTHER_AUREL_BOATS = addBoatItems("mother_aurel", "PARADISE_LOST_MOTHER_AUREL");
public static final BoatSet ORANGE_BOATS = addBoatItems("orange", "PARADISE_LOST_ORANGE");
public static final BoatSet WISTERIA_BOATS = addBoatItems("wisteria", "PARADISE_LOST_WISTERIA");

public static final BoatSet[] BOAT_SETS = new BoatSet[] {AUREL_BOATS, MOTHER_AUREL_BOATS, ORANGE_BOATS, WISTERIA_BOATS};

Expand All @@ -461,10 +458,10 @@ private static BlockItem add(String id, Block block, Settings settings, Consumer
additionalActions);
}

private static BoatSet addBoatItems(String woodId, Block plankBlock) {
private static BoatSet addBoatItems(String woodId, String boatTypeId) {
String boatId = (MOD_ID + "_" + woodId);

BoatEntity.Type boatType = EnumExtender.add(BoatEntity.Type.class, boatId, plankBlock, boatId);
BoatEntity.Type boatType = ClassTinkerers.getEnum(BoatEntity.Type.class, boatTypeId);

BoatItem boat = add(woodId + "_boat", new BoatItem(false, boatType, decoration().maxCount(1)));
BoatItem chestBoat = add(woodId + "_chest_boat", new BoatItem(true, boatType, decoration().maxCount(1)));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package net.id.paradiselost.mixin.earlyrisers;

import com.chocohead.mm.api.ClassTinkerers;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.MappingResolver;

public class CustomBoatEarlyRiser implements Runnable {

@Override
public void run() {
MappingResolver remapper = FabricLoader.getInstance().getMappingResolver();

String boatType = remapper.mapClassName("intermediary", "net.minecraft.class_1690$class_1692");
String block = 'L' + remapper.mapClassName("intermediary", "net.minecraft.class_2248") + ';';
ClassTinkerers.enumBuilder(boatType, block, "Ljava/lang/String;")
.addEnum("PARADISE_LOST_AUREL", () -> new Object[] {null, "paradise_lost_aurel"})
.addEnum("PARADISE_LOST_MOTHER_AUREL", () -> new Object[] {null, "paradise_lost_mother_aurel"})
.addEnum("PARADISE_LOST_ORANGE", () -> new Object[] {null, "paradise_lost_orange"})
.addEnum("PARADISE_LOST_WISTERIA", () -> new Object[] {null, "paradise_lost_wisteria"})
.build();
}

}

This file was deleted.

26 changes: 0 additions & 26 deletions src/main/java/net/id/paradiselost/util/EnumExtender.java

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
"cardinal-components": [
"net.id.paradiselost.component.ParadiseLostComponents"
],
"modmenu": [
"net.id.paradiselost.config.ModMenuConfig"
"mm:early_risers": [
"net.id.paradiselost.mixin.earlyrisers.CustomBoatEarlyRiser"
]
},
"custom": {
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/paradise_lost.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"block.FarmlandBlockMixin",
"enchantment.EnchantmentHelperMixin",
"entity.BoatEntityMixin",
"entity.BoatEntityTypeMixin",
"entity.ChestBoatEntityMixin",
"entity.CowEntityMixin",
"entity.EntityMixin",
Expand Down

0 comments on commit 52e426f

Please sign in to comment.