Skip to content

Commit

Permalink
it compiles!
Browse files Browse the repository at this point in the history
  • Loading branch information
Player005 committed Oct 13, 2024
1 parent fbebd17 commit 953ca64
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .idea/runConfigurations/Fabric_Server___fabric__fabric.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.world.entity.npc.VillagerProfession;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.trading.ItemCost;
import net.minecraft.world.item.trading.MerchantOffer;
import net.minecraft.world.level.block.ComposterBlock;
import net.minecraft.world.level.levelgen.GenerationStep;
Expand Down Expand Up @@ -35,20 +36,20 @@ private static void registerBiomeModifers() {
platform.overworldBiomeTag(),
platform.undergroundBiomeTag(),
GenerationStep.Decoration.VEGETAL_DECORATION,
ResourceKey.create(Registries.PLACED_FEATURE, new ResourceLocation("vegandelight:patch_wild_soybean"))
ResourceKey.create(Registries.PLACED_FEATURE, ResourceLocation.parse("vegandelight:patch_wild_soybean"))
);
}

private static void registerTrades() {
platform.registerVillagerTrade(VillagerProfession.FARMER, 1,
(trader, random) -> new MerchantOffer(
new ItemStack(VeganItems.SOYBEAN, random.nextIntBetweenInclusive(16, 24)),
new ItemCost(VeganItems.SOYBEAN, random.nextIntBetweenInclusive(16, 24)),
new ItemStack(Items.EMERALD, 1),
12, 5, 0.05f
));
platform.registerVillagerTrade(VillagerProfession.LEATHERWORKER, 4,
(trader, random) -> new MerchantOffer(
new ItemStack(VeganItems.LEATHER_SUBSTITUTE, random.nextIntBetweenInclusive(8, 16)),
new ItemCost(VeganItems.LEATHER_SUBSTITUTE, random.nextIntBetweenInclusive(8, 16)),
new ItemStack(Items.EMERALD, 1),
12, 15, 0.1f
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,89 +20,89 @@ public class VeganItems {
public static final Item TOFU = register("tofu",
new Item(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(4)
.saturationMod(0.4f)
.saturationModifier(0.4f)
.build())));
public static final Item SILKEN_TOFU = register("silken_tofu",
new ConsumableItem(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(4)
.saturationMod(0.4f)
.saturationModifier(0.4f)
.build())
.craftRemainder(Items.BOWL)
.stacksTo(16)));
public static final Item SMOKED_TOFU = register("smoked_tofu",
new Item(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(4)
.saturationMod(0.4f)
.saturationModifier(0.4f)
.build())));
public static final Item COOKED_TOFU = register("cooked_tofu",
new Item(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(4)
.saturationMod(0.4f)
.saturationModifier(0.4f)
.build())));
public static final Item COOKED_SMOKED_TOFU = register("cooked_smoked_tofu",
new Item(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(4)
.saturationMod(0.4f)
.saturationModifier(0.4f)
.build())));
public static final Item TOFU_SLICES = register("tofu_slices",
new Item(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(2)
.saturationMod(0.1f)
.saturationModifier(0.1f)
.build())));
public static final Item SMOKED_TOFU_SLICES = register("smoked_tofu_slices",
new Item(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(2)
.saturationMod(0.1f)
.saturationModifier(0.1f)
.build())));
public static final Item COOKED_TOFU_SLICES = register("cooked_tofu_slices",
new Item(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(2)
.saturationMod(0.1f)
.saturationModifier(0.1f)
.build())));
public static final Item COOKED_SMOKED_TOFU_SLICES = register("cooked_smoked_tofu_slices",
new Item(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(2)
.saturationMod(0.1f)
.saturationModifier(0.1f)
.build())));
public static final Item MINCED_TOFU = register("minced_tofu",
new Item(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(2)
.saturationMod(0.1f)
.saturationModifier(0.1f)
.build())));
public static final Item TOFU_PATTY = register("tofu_patty",
new Item(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(2)
.saturationMod(0.1f)
.saturationModifier(0.1f)
.build())));
public static final Item TOFISH = register("tofish",
new Item(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(3)
.saturationMod(0.4f)
.saturationModifier(0.4f)
.build())));
public static final Item COOKED_TOFISH = register("cooked_tofish",
new Item(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(3)
.saturationMod(0.4f)
.saturationModifier(0.4f)
.build())));
public static final Item SMOKED_TOFISH = register("smoked_tofish",
new Item(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(3)
.saturationMod(0.4f)
.saturationModifier(0.4f)
.build())));
public static final Item COOKED_SMOKED_TOFISH = register("cooked_smoked_tofish",
new Item(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(3)
.saturationMod(0.4f)
.saturationModifier(0.4f)
.build())));
public static final Item TOFISH_ROLL = register("tofish_roll",
new Item(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(5)
.saturationMod(0.4f)
.saturationModifier(0.4f)
.build())));
public static final Item SMOKED_TOFISH_ROLL = register("smoked_tofish_roll",
new Item(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(5)
.saturationMod(0.4f)
.saturationModifier(0.4f)
.build())));


Expand All @@ -126,7 +126,7 @@ public class VeganItems {
new ItemNameBlockItem(VeganBlocks.SOYBEAN_CROP,
new Item.Properties().food(new FoodProperties.Builder()
.nutrition(1)
.saturationMod(0.1f)
.saturationModifier(0.1f)
.build())));

public static final Item LEATHER_SUBSTITUTE = register("leather_substitute",
Expand All @@ -135,7 +135,7 @@ public class VeganItems {
public static final Item APPLESAUCE = register("applesauce",
new ConsumableItem(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(2)
.saturationMod(0.4f)
.saturationModifier(0.4f)
.build())
.craftRemainder(Items.BOWL)
.stacksTo(16)));
Expand Down
16 changes: 13 additions & 3 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ val FABRIC_API_VERSION: String by rootProject.extra
val FDRF_VERSION: String by rootProject.extra

repositories {
maven("https://maven.parchmentmc.org/")
maven("https://maven.parchmentmc.org/") // Parchment mappings

maven { // Farmer's Delight Refabricated
name = "Greenhouse Maven"
Expand Down Expand Up @@ -80,6 +80,16 @@ tasks {

jar {
from(rootDir.resolve("LICENSE.md"))

duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

named("compileTestJava").configure {
enabled = false
}

named("test").configure {
enabled = false
}
}

Expand All @@ -98,5 +108,5 @@ dependencies {
exclude("io.github.fabricators_of_create.Porting-Lib")
}

compileOnly(project(":common"))
}
implementation(project.project(":common").sourceSets.getByName("main").output)
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ public void onInitializeClient() {
VeganFluids.APPLESAUCE,
VeganFluids.FLOWING_APPLESAUCE,
new SimpleFluidRenderHandler(
new ResourceLocation("vegandelight:block/applesauce_still"),
new ResourceLocation("vegandelight:block/applesauce_flow")
ResourceLocation.parse("vegandelight:block/applesauce_still"),
ResourceLocation.parse("vegandelight:block/applesauce_flow")
)
);

FluidRenderHandlerRegistry.INSTANCE.register(
VeganFluids.SOYMILK,
VeganFluids.FLOWING_SOYMILK,
new SimpleFluidRenderHandler(
new ResourceLocation("vegandelight:block/milky_still"),
new ResourceLocation("vegandelight:block/milky_flow")
ResourceLocation.parse("vegandelight:block/milky_still"),
ResourceLocation.parse("vegandelight:block/milky_flow")
)
);

Expand Down
6 changes: 5 additions & 1 deletion neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,15 @@ tasks.named("compileTestJava").configure {

dependencies {
implementation("net.neoforged:neoforge:${NEOFORGE_VERSION}")
compileOnly(project.project(":common").sourceSets.main.get().output)

implementation(project.project(":common").sourceSets.getByName("main").output)

implementation("maven.modrinth:farmers-delight:$FD_NEO_VERSION")
}

tasks.jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

// NeoGradle compiles the game, but we don't want to add our common code to the game's code
val notNeoTask: (Task) -> Boolean = { it: Task -> !it.name.startsWith("neo") && !it.name.startsWith("compileService") }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.village.VillagerTradesEvent;
import net.neoforged.neoforge.registries.DeferredRegister;
import org.jetbrains.annotations.NotNull;
Expand All @@ -27,35 +27,31 @@
public class VeganDelightNeo {
public static IEventBus eventBus;

public VeganDelightNeo(IEventBus eventBus) {
public VeganDelightNeo(@NotNull IEventBus eventBus) {
VeganDelightNeo.eventBus = eventBus;
eventBus.addListener(VeganDelightNeo::onVillagerTrades);

VeganDelightMod.initialize(new VDNeoforgePlatform());
}

@Mod.EventBusSubscriber(modid = "vegandelight")
public static class EventSubscriber {
public EventSubscriber() {
NeoForge.EVENT_BUS.register(this);
}

public static void onVillagerTrades(VillagerTradesEvent event) {
for (VillagerTrade trade : VDNeoforgePlatform.registeredTrades) {
if (event.getType() == trade.profession) {
var levelTrades = event.getTrades().get(trade.level);
@SubscribeEvent
public static void onVillagerTrades(VillagerTradesEvent event) {
for (VillagerTrade trade : VDNeoforgePlatform.registeredTrades) {
if (event.getType() == trade.profession) {
var levelTrades = event.getTrades().get(trade.level);

levelTrades.add(trade.itemListing);
}
levelTrades.add(trade.itemListing);
}
}
}


public static class VDNeoforgePlatform implements VeganDelightPlatform {
public static final List<VillagerTrade> registeredTrades = new ArrayList<>();

@Override
public TagKey<Biome> undergroundBiomeTag() {
return TagKey.create(Registries.BIOME, new ResourceLocation("c:underground"));
return TagKey.create(Registries.BIOME, ResourceLocation.parse("c:underground"));
}

@Override
Expand All @@ -80,7 +76,6 @@ public CreativeModeTab registerItemTab(ItemStack icon, @NotNull Component title,

@Override
public void registerBiomeModifier(float minTemp, float maxTemp, TagKey<Biome> allowed, TagKey<Biome> denied, GenerationStep.Decoration step, ResourceKey<PlacedFeature> modifier) {
// biome modifiers are loaded via file in forge/neoforge
}
}

Expand Down

0 comments on commit 953ca64

Please sign in to comment.