Skip to content

Commit

Permalink
Merge changes from dev/1.21.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kd8lvt committed Oct 24, 2024
2 parents 00c0577 + 676c5de commit 0d07694
Show file tree
Hide file tree
Showing 23 changed files with 256 additions and 94 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ loom {
}
}

accessWidenerPath = file("src/main/resources/exclusionzone.accesswidener")

runs {
// This adds a new gradle task that runs the datagen API: "gradlew runDatagen"
datagen {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ loader_version=0.16.4
fabric_version=0.103.0+1.21.1

# Mod Properties
mod_version=1.0.5-1.21.1
mod_version=1.0.5b-1.21.1
maven_group=com.kd8lvt.exclusionzone
archives_base_name=exclusionzone
modid=exclusionzone
10 changes: 9 additions & 1 deletion src/main/java/com/kd8lvt/exclusionzone/ExclusionZone.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.kd8lvt.exclusionzone;

import com.kd8lvt.exclusionzone.item.PersonaWeapons.PersonaWeaponTraits;
import com.kd8lvt.exclusionzone.item.Tools.LoggingAxe;
import com.kd8lvt.exclusionzone.player.ToxicBuildupTracker;
import com.kd8lvt.exclusionzone.registry.ModItems;
import com.kd8lvt.exclusionzone.registry.ModRegistries;
Expand Down Expand Up @@ -66,7 +67,14 @@ public void reload(ResourceManager manager) {

ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> toxTracker.remove(handler.getPlayer()));

ServerTickEvents.END_SERVER_TICK.register(toxTracker::onTick);
ServerTickEvents.END_SERVER_TICK.register(server -> {
toxTracker.onTick(server);
LoggingAxe.queue.processQueue(server);
});

ServerLifecycleEvents.SERVER_STOPPING.register(server->{
LoggingAxe.queue.onServerShuttingDown();
});
}

public static void runCommand(String cmd) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ public class ExclusionZoneDataGenerator implements DataGeneratorEntrypoint {
@Override
public void onInitializeDataGenerator(FabricDataGenerator generator) {
FabricDataGenerator.Pack pack = generator.createPack();
pack.addProvider(ExclusionZoneEnglishProvider::new);
pack.addProvider(ExclusionZoneRecipeGenerator::new);
pack.addProvider(ExclusionZoneModelGenerator::new);
pack.addProvider(ExclusionZoneEnglishProvider::new);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public void generateItemModels(ItemModelGenerator itemModelGenerator) {
generated(ModItems.get("warped_meat"));
generated(ModItems.get("cito_sanitatem_caro"));
generated(ModItems.get("omen_of_caro_invictus"));
generated(ModItems.get("reinforced_handle"));
generated(ModItems.get("logging_axe_head"));
handheldRod(ModItems.get("glasscutter"));
handheldRod(ModItems.get("persona_monosword"));
itemGen.register(ModItems.get("logging_axe"),Models.HANDHELD);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.kd8lvt.exclusionzone.datagen;

import com.kd8lvt.exclusionzone.ExclusionZone;
import com.kd8lvt.exclusionzone.registry.ModBlocks;
import com.kd8lvt.exclusionzone.registry.ModItems;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
Expand Down Expand Up @@ -29,9 +28,7 @@ public ExclusionZoneRecipeGenerator(FabricDataOutput output, CompletableFuture<R

@Override
public void generate(RecipeExporter exporter) {
ExclusionZone.LOGGER.info("Recipe: Otherworldly Bone->Bone Meal");
shapeless(exporter,RecipeCategory.MISC,new Item[]{ModItems.get("otherworldly_bone")},Items.BONE_MEAL);
ExclusionZone.LOGGER.info("Recipe: Magnet");
shaped(
exporter,
RecipeCategory.MISC,
Expand All @@ -47,21 +44,40 @@ public void generate(RecipeExporter exporter) {
add(" a ");
add("ce ");
}}.toArray(new String[3]));
ExclusionZone.LOGGER.info("Recipe: Logging Axe");
shapeless(
exporter,
RecipeCategory.MISC,
new Item[]{
ModItems.get("logging_axe_head"),
ModItems.get("reinforced_handle")
},
ModItems.get("logging_axe")
);
shaped(
exporter,
RecipeCategory.MISC,
ModItems.get("logging_axe"),
ModItems.get("logging_axe_head"),
new HashMap<>(){{
put('A',Items.AMETHYST_BLOCK);
put('e',Items.ENDER_PEARL);
put('a',Items.AMETHYST_SHARD);
put('s',Items.STICK);
}},
new ArrayList<String>(){{
add("aaa");
add("as ");
add(" s ");
add("Aaa");
add("Ae ");
add(" ");
}}.toArray(new String[3]));
ExclusionZone.LOGGER.info("Recipe: Persona Monosword");
shaped(
exporter,
RecipeCategory.MISC,
ModItems.get("reinforced_handle"),
new HashMap<>(){{
put('i',Items.IRON_INGOT);
}},
new ArrayList<String>(){{
add("i");
add("i");
}}.toArray(new String[2]));
shaped(
exporter,
RecipeCategory.MISC,
Expand All @@ -76,7 +92,6 @@ public void generate(RecipeExporter exporter) {
add("ea ");
add("ge ");
}}.toArray(new String[3]));
ExclusionZone.LOGGER.info("Recipe: Block Breaker");
shaped(
exporter,
RecipeCategory.MISC,
Expand All @@ -93,7 +108,6 @@ public void generate(RecipeExporter exporter) {
add("srs");
}}.toArray(new String[3])
);
ExclusionZone.LOGGER.info("Recipe: Muffler");
shapedTags( //Muffler Recipe
exporter,
RecipeCategory.MISC,
Expand All @@ -108,7 +122,6 @@ public void generate(RecipeExporter exporter) {
add("www");
}}.toArray(new String[3])
);
ExclusionZone.LOGGER.info("Recipe: Glasscutter");
shaped(
exporter,
RecipeCategory.TOOLS,
Expand All @@ -127,6 +140,11 @@ public void generate(RecipeExporter exporter) {

@SuppressWarnings("SameParameterValue")
private void shapeless(RecipeExporter exporter, RecipeCategory category, Item[] inputs, Item output) {
try {
LOGGER.info("Shaped Recipe: %s".formatted(output.getTranslationKey()));
} catch (Exception e) {
LOGGER.info("Failed to get shapeless recipe output's translation key, but that's ok :)");
}
ShapelessRecipeJsonBuilder builder = ShapelessRecipeJsonBuilder.create(category,output)
.criterion(FabricRecipeProvider.hasItem(output),FabricRecipeProvider.conditionsFromItem(output));
for (Item item : inputs) {
Expand All @@ -137,6 +155,11 @@ private void shapeless(RecipeExporter exporter, RecipeCategory category, Item[]
}

private void shaped(RecipeExporter exporter, RecipeCategory category, Item output, HashMap<Character,Item> inputs, String[] patternStrs) {
try {
LOGGER.info("Shaped Recipe: %s".formatted(output.getTranslationKey()));
} catch (Exception e) {
LOGGER.info("Failed to get shaped recipe output's translation key, but that's ok :)");
}
ShapedRecipeJsonBuilder builder = ShapedRecipeJsonBuilder.create(category, output)
.criterion(FabricRecipeProvider.hasItem(output),FabricRecipeProvider.conditionsFromItem(output));
for (Map.Entry<Character, Item> entry:inputs.entrySet()) {
Expand Down
Loading

0 comments on commit 0d07694

Please sign in to comment.