Skip to content

Commit

Permalink
1.19.3, add datagen cache to gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
gliscowo committed Dec 11, 2022
1 parent cac5d3a commit bc563b1
Show file tree
Hide file tree
Showing 63 changed files with 149 additions and 192 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ gradle-app.setting
# Common working directory
run/

# datagen cache
/src/main/generated/.cache/

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
/remappedSrc/
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies {
modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:${project.rei_version}"
modLocalRuntime "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}"

modLocalRuntime "dev.architectury:architectury-fabric:${project.arch_version}"
// modLocalRuntime "dev.architectury:architectury-fabric:${project.arch_version}"

modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}"

Expand Down
17 changes: 8 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,23 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_base_version=1.19
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.28
loader_version=0.14.10
minecraft_base_version=1.19.3
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.3
loader_version=0.14.11
# Mod Properties
mod_version=2.0.18
maven_group=wraith
archives_base_name=wraith-alloy-forgery

# Dependencies
fabric_version=0.64.0+1.19.2
fabric_version=0.69.0+1.19.3

# https://maven.shedaniel.me/me/shedaniel/RoughlyEnoughItems-fabric/
rei_version=9.0.472
arch_version = 6.3.49
rei_version=10.0.578

# https://www.curseforge.com/minecraft/mc-mods/modmenu/files
modmenu_version=4.1.1
modmenu_version=5.0.2

# https://maven.wispforest.io/io/wispforest/owo-lib
owo_version=0.8.5+1.19
owo_version=0.9.3+1.19.3

This file was deleted.

39 changes: 0 additions & 39 deletions src/main/generated/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public boolean canInsert(ItemStack stack) {
}

@Override
public ItemStack transferSlot(PlayerEntity player, int invSlot) {
public ItemStack quickMove(PlayerEntity player, int invSlot) {
return ScreenUtils.handleSlotTransfer(this, invSlot, this.controllerInventory.size());
}

Expand Down
16 changes: 7 additions & 9 deletions src/main/java/wraith/alloyforgery/AlloyForgery.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package wraith.alloyforgery;

import io.wispforest.owo.itemgroup.OwoItemGroup;
import io.wispforest.owo.moddata.ModDataLoader;
import io.wispforest.owo.particles.ClientParticles;
import io.wispforest.owo.particles.systems.ParticleSystem;
Expand All @@ -13,12 +12,13 @@
import net.fabricmc.fabric.api.transfer.v1.item.ItemStorage;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.resource.ResourceType;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.registry.Registry;
import wraith.alloyforgery.block.ForgeControllerBlockEntity;
import wraith.alloyforgery.data.AlloyForgeryGlobalRemaindersLoader;
import wraith.alloyforgery.forges.ForgeRegistry;
Expand All @@ -30,8 +30,6 @@ public class AlloyForgery implements ModInitializer {

public static final String MOD_ID = "alloy_forgery";

public static final OwoItemGroup ALLOY_FORGERY_GROUP = new AlloyForgeryItemGroup(id("alloy_forgery"));

public static BlockEntityType<ForgeControllerBlockEntity> FORGE_CONTROLLER_BLOCK_ENTITY = ForgeControllerBlockEntity.Type.INSTANCE;
public static ScreenHandlerType<AlloyForgeScreenHandler> ALLOY_FORGE_SCREEN_HANDLER_TYPE;

Expand All @@ -52,18 +50,18 @@ public class AlloyForgery implements ModInitializer {
@SuppressWarnings("UnstableApiUsage")
@Override
public void onInitialize() {
ALLOY_FORGE_SCREEN_HANDLER_TYPE = Registry.register(Registry.SCREEN_HANDLER, id("alloy_forge"), new ScreenHandlerType<>(AlloyForgeScreenHandler::new));
ALLOY_FORGE_SCREEN_HANDLER_TYPE = Registry.register(Registries.SCREEN_HANDLER, id("alloy_forge"), new ScreenHandlerType<>(AlloyForgeScreenHandler::new));

ResourceManagerHelper.get(ResourceType.SERVER_DATA).registerReloadListener(new AlloyForgeryGlobalRemaindersLoader());
ResourceManagerHelper.get(ResourceType.SERVER_DATA).registerReloadListener(FuelDataLoader.INSTANCE);
ModDataLoader.load(ForgeRegistry.Loader.INSTANCE);

Registry.register(Registry.BLOCK_ENTITY_TYPE, id("forge_controller"), FORGE_CONTROLLER_BLOCK_ENTITY);
Registry.register(Registries.BLOCK_ENTITY_TYPE, id("forge_controller"), FORGE_CONTROLLER_BLOCK_ENTITY);

Registry.register(Registry.RECIPE_TYPE, AlloyForgeRecipe.Type.ID, AlloyForgeRecipe.Type.INSTANCE);
Registry.register(Registry.RECIPE_SERIALIZER, AlloyForgeRecipe.Type.ID, AlloyForgeRecipeSerializer.INSTANCE);
Registry.register(Registries.RECIPE_TYPE, AlloyForgeRecipe.Type.ID, AlloyForgeRecipe.Type.INSTANCE);
Registry.register(Registries.RECIPE_SERIALIZER, AlloyForgeRecipe.Type.ID, AlloyForgeRecipeSerializer.INSTANCE);

ALLOY_FORGERY_GROUP.initialize();
AlloyForgeryItemGroup.GROUP.initialize();

ItemStorage.SIDED.registerFallback((world, pos, state, blockEntity, context) -> {
if (context == Direction.DOWN && world.getBlockEntity(pos.up()) instanceof ForgeControllerBlockEntity froge)
Expand Down
50 changes: 21 additions & 29 deletions src/main/java/wraith/alloyforgery/AlloyForgeryItemGroup.java
Original file line number Diff line number Diff line change
@@ -1,51 +1,43 @@
package wraith.alloyforgery;

import io.wispforest.owo.itemgroup.Icon;
import io.wispforest.owo.itemgroup.OwoItemGroup;
import io.wispforest.owo.itemgroup.gui.ItemGroupButton;
import io.wispforest.owo.itemgroup.gui.ItemGroupTab;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.text.Text;
import wraith.alloyforgery.block.ForgeControllerBlock;
import wraith.alloyforgery.forges.ForgeRegistry;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

public class AlloyForgeryItemGroup extends OwoItemGroup {
public class AlloyForgeryItemGroup {

private List<ItemStack> controllerCache = null;
private static List<ItemStack> CONTROLLER_CACHE = null;

protected AlloyForgeryItemGroup(Identifier id) {
super(id);
}
public static final OwoItemGroup GROUP = OwoItemGroup.builder(AlloyForgery.id("alloy_forgery"), () -> {
if (CONTROLLER_CACHE == null) return null;
return Icon.of(CONTROLLER_CACHE.get(0));
}).initializer(group -> {
group.tabs.add(new ItemGroupTab(Icon.of(ItemStack.EMPTY), Text.empty(), (enabledFeatures, entries, hasPermissions) -> {
if (CONTROLLER_CACHE == null) createControllerCache();
CONTROLLER_CACHE.forEach(entries::add);
}, ItemGroupTab.DEFAULT_TEXTURE, true));

@Override
public ItemStack createIcon() {
if (this.controllerCache == null) return Items.BRICKS.getDefaultStack();
return this.controllerCache.isEmpty() ? Items.BRICKS.getDefaultStack() : this.controllerCache.get(0);
}
group.addButton(ItemGroupButton.github(group, "https://github.com/LordDeatHunter/Alloy-Forgery"));
group.addButton(ItemGroupButton.curseforge(group, "https://www.curseforge.com/minecraft/mc-mods/alloy-forgery"));
group.addButton(ItemGroupButton.modrinth(group, "https://modrinth.com/mod/alloy-forgery"));
group.addButton(ItemGroupButton.discord(group, "https://discord.gg/Pa5wDVm8Xv"));
}).build();

@Override
public void appendStacks(DefaultedList<ItemStack> stacks) {
if (controllerCache == null) this.createControllerCache();
stacks.addAll(this.controllerCache);
}

private void createControllerCache() {
private static void createControllerCache() {
final var blockList = new ArrayList<>(ForgeRegistry.getControllerBlocks());
blockList.sort(Comparator.comparingInt(value -> ((ForgeControllerBlock) value).forgeDefinition.forgeTier()));

this.controllerCache = new ArrayList<>(blockList.size());
blockList.forEach(block -> this.controllerCache.add(block.asItem().getDefaultStack()));
CONTROLLER_CACHE = new ArrayList<>(blockList.size());
blockList.forEach(block -> CONTROLLER_CACHE.add(block.asItem().getDefaultStack()));
}

@Override
protected void setup() {
this.addButton(ItemGroupButton.github("https://github.com/LordDeatHunter/Alloy-Forgery"));
this.addButton(ItemGroupButton.curseforge("https://www.curseforge.com/minecraft/mc-mods/alloy-forgery"));
this.addButton(ItemGroupButton.modrinth("https://modrinth.com/mod/alloy-forgery"));
this.addButton(ItemGroupButton.discord("https://discord.gg/Pa5wDVm8Xv"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ private void handleForgingRemainders(DefaultedList<ItemStack> remainderList) {
if (!remainderStack.isEmpty()) {
if (inputStack.isEmpty()) {
this.setStack(i, remainderStack);
} else if (ItemStack.areItemsEqualIgnoreDamage(inputStack, remainderStack) && ItemStack.areNbtEqual(inputStack, remainderStack)) {
} else if (inputStack.isItemEqual(remainderStack) && ItemStack.areNbtEqual(inputStack, remainderStack)) {
remainderStack.increment(inputStack.getCount());

if (remainderStack.getCount() > remainderStack.getMaxCount()) {
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/wraith/alloyforgery/data/AlloyForgeryData.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
public class AlloyForgeryData implements DataGeneratorEntrypoint {
@Override
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
fabricDataGenerator.addProvider(new AlloyForgeryRecipeProvider(fabricDataGenerator));
fabricDataGenerator.addProvider(new AlloyForgeryTagProviders.Item(fabricDataGenerator));
var fortnitusPackus = fabricDataGenerator.createPack();
fortnitusPackus.addProvider(AlloyForgeryRecipeProvider::new);
fortnitusPackus.addProvider(AlloyForgeryTagProviders.Item::new);
}
}
10 changes: 5 additions & 5 deletions src/main/java/wraith/alloyforgery/data/AlloyForgeryTags.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package wraith.alloyforgery.data;

import net.minecraft.item.Item;
import net.minecraft.tag.TagKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import wraith.alloyforgery.AlloyForgery;

public class AlloyForgeryTags {
Expand Down Expand Up @@ -90,15 +90,15 @@ private static TagKey<Item> registerAlloyForgery(String path) {
}

private static TagKey<Item> register(Identifier id) {
return TagKey.of(Registry.ITEM_KEY, id);
return TagKey.of(RegistryKeys.ITEM, id);
}
}

private static Identifier common(String path){
private static Identifier common(String path) {
return new Identifier(COMMON_NAMESPACE, path);
}

private static Identifier alloyForgery(String path){
private static Identifier alloyForgery(String path) {
return AlloyForgery.id(path);
}
}
Loading

0 comments on commit bc563b1

Please sign in to comment.