Skip to content

Commit

Permalink
Add sub-designs for the banner patterns: hammer, wire cutter & wolf
Browse files Browse the repository at this point in the history
This allows for individual coloured grip + head of the tool
It also squashes all three wolf designs into one pattern
  • Loading branch information
BluSunrize committed Jun 13, 2024
1 parent 949d4d3 commit a6de90f
Show file tree
Hide file tree
Showing 27 changed files with 48 additions and 97 deletions.
5 changes: 4 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
- Add cloche recipes for ferns and grass (voidsong-dragonfly)
- Add crushing recipes for stone and deepslate (voidsong-dragonfly)
- Add the blueprint shelf, a block that can store up to 9 blueprints! (BluSunrize)
- Add a banner pattern for the wirecutter (BluSunrize)
- Add a banner pattern for the wire cutter (BluSunrize)
- Add sub-designs for the banner patterns: hammer, wire cutter & wolf (BluSunrize)
- This allows for individual coloured grip + head of the tool
- It also allows all three wolf designs to be stored in one pattern
- Fix crusher not accepting multiple stacks of the same ore (BluSunrize)
- Fix stone multiblocks being washed away by water (BluSunrize)
- Fix potential race condition with wires damaging entities (BluSunrize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,6 @@ private void createItemModels()
addItemModel("banner_pattern", IEBannerPatterns.ORNATE.item());
addItemModel("banner_pattern", IEBannerPatterns.TREATED_WOOD.item());
addItemModel("banner_pattern", IEBannerPatterns.WINDMILL.item());
addItemModel("banner_pattern", IEBannerPatterns.WOLF_R.item());
addItemModel("banner_pattern", IEBannerPatterns.WOLF_L.item());
addItemModel("banner_pattern", IEBannerPatterns.WOLF.item());
addItemModels("", IEItems.Misc.ICON_BIRTHDAY, IEItems.Misc.ICON_LUCKY,
IEItems.Misc.ICON_DRILLBREAK, IEItems.Misc.ICON_RAVENHOLM, IEItems.Misc.ICON_FRIED, IEItems.Misc.ICON_BTTF);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,18 +292,6 @@ private void recipesBlueprint(RecipeOutput out)
.input(Items.PAPER)
.input(WoodenDevices.WINDMILL)
.build(out, toRL("blueprint/banner_windmill"));
BlueprintCraftingRecipeBuilder.builder()
.category("bannerpatterns")
.output(IEBannerPatterns.WOLF_R.item())
.input(Items.PAPER)
.input(BulletHandler.getBulletItem(BulletItem.WOLFPACK))
.build(out, toRL("blueprint/banner_wolf_r"));
BlueprintCraftingRecipeBuilder.builder()
.category("bannerpatterns")
.output(IEBannerPatterns.WOLF_L.item())
.input(Items.PAPER)
.input(BulletHandler.getBulletItem(BulletItem.WOLFPACK))
.build(out, toRL("blueprint/banner_wolf_l"));
BlueprintCraftingRecipeBuilder.builder()
.category("bannerpatterns")
.output(IEBannerPatterns.WOLF.item())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import blusunrize.immersiveengineering.api.Lib;
import blusunrize.immersiveengineering.common.register.IEBannerPatterns;
import blusunrize.immersiveengineering.common.register.IEBannerPatterns.BannerEntry;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderLookup.Provider;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
Expand All @@ -37,6 +38,10 @@ public BannerTags(PackOutput output, CompletableFuture<Provider> provider, @Null
protected void addTags(Provider p_256380_)
{
for(BannerEntry entry : IEBannerPatterns.ALL_BANNERS)
tag(entry.tag()).add(entry.pattern().value());
{
IntrinsicTagAppender<BannerPattern> tag = tag(entry.tag());
for(Holder<BannerPattern> pattern : entry.patterns())
tag.add(pattern.value());
}
}
}

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

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

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

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

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

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

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

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import blusunrize.immersiveengineering.common.entities.SkylineHookEntity;
import blusunrize.immersiveengineering.common.gui.IEBaseContainerOld;
import blusunrize.immersiveengineering.common.register.*;
import blusunrize.immersiveengineering.common.register.IEBannerPatterns.BannerEntry;
import blusunrize.immersiveengineering.common.register.IEMenuTypes.ArgContainer;
import blusunrize.immersiveengineering.common.util.sound.IEBlockEntitySound;
import blusunrize.immersiveengineering.common.util.sound.SkyhookSound;
Expand Down Expand Up @@ -205,9 +206,12 @@ public static void clientSetup(FMLClientSetupEvent ev)

IEManual.addIEManualEntries();
IEBannerPatterns.ALL_BANNERS.forEach(entry -> {
ResourceKey<BannerPattern> pattern = entry.pattern().unwrapKey().orElseThrow();
Sheets.BANNER_MATERIALS.put(pattern, new Material(Sheets.BANNER_SHEET, BannerPattern.location(pattern, true)));
Sheets.SHIELD_MATERIALS.put(pattern, new Material(Sheets.SHIELD_SHEET, BannerPattern.location(pattern, false)));
for(Holder<BannerPattern> pattern : entry.patterns())
{
ResourceKey<BannerPattern> key = pattern.unwrapKey().orElseThrow();
Sheets.BANNER_MATERIALS.put(key, new Material(Sheets.BANNER_SHEET, BannerPattern.location(key, true)));
Sheets.SHIELD_MATERIALS.put(key, new Material(Sheets.SHIELD_SHEET, BannerPattern.location(key, false)));
}
});
ev.enqueueWork(OptifineWarning::warnIfRequired);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredRegister;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class IEBannerPatterns
Expand All @@ -28,38 +30,45 @@ public class IEBannerPatterns
Registries.BANNER_PATTERN, Lib.MODID
);
public static final List<BannerEntry> ALL_BANNERS = new ArrayList<>();
public static final BannerEntry HAMMER = addBanner("hammer", "hmr");
public static final BannerEntry WIRECUTTER = addBanner("wirecutter", "wct");
public static final BannerEntry HAMMER = addBanner("hammer", "hmr", "head","grip");
public static final BannerEntry WIRECUTTER = addBanner("wirecutter", "wct", "head","grip");
public static final BannerEntry BEVELS = addBanner("bevels", "bvl");
public static final BannerEntry ORNATE = addBanner("ornate", "orn");
public static final BannerEntry TREATED_WOOD = addBanner("treated_wood", "twd");
public static final BannerEntry WINDMILL = addBanner("windmill", "wnd");
public static final BannerEntry WOLF_R = addBanner("wolf_r", "wlfr");
public static final BannerEntry WOLF_L = addBanner("wolf_l", "wlfl");
public static final BannerEntry WOLF = addBanner("wolf", "wlf");
public static final BannerEntry WOLF = addBanner("wolf", "wlf", "r", "l");

public static void init(IEventBus modBus)
{
REGISTER.register(modBus);
}

private static BannerEntry addBanner(String name, String hashName)
private static BannerEntry addBanner(String name, String hashName, String... subdesigns)
{
Holder<BannerPattern> pattern = REGISTER.register(name, () -> new BannerPattern("ie_"+hashName));
TagKey<BannerPattern> tag = TagKey.create(Registries.BANNER_PATTERN, pattern.unwrapKey().get().location());
ItemRegObject<BannerPatternItem> item = IEItems.register("bannerpattern_"+name, () -> new BannerPatternItem(
tag, new Properties()
));
BannerEntry result = new BannerEntry(pattern, tag, item);
for(String design : subdesigns)
result.patterns().add(
REGISTER.register(name+"_"+design, () -> new BannerPattern("ie_"+hashName+"_"+design))
);
ALL_BANNERS.add(result);
return result;
}

public record BannerEntry(
Holder<BannerPattern> pattern,
List<Holder<BannerPattern>> patterns,
TagKey<BannerPattern> tag,
IEItems.ItemRegObject<BannerPatternItem> item
)
{
public BannerEntry(Holder<BannerPattern> pattern, TagKey<BannerPattern> tag, ItemRegObject<BannerPatternItem> item)
{
this(new ArrayList<>(), tag, item);
this.patterns.add(pattern);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1421,10 +1421,6 @@
"item.immersiveengineering.bannerpattern_treated_wood.desc": "Wooden Paneling",
"item.immersiveengineering.bannerpattern_windmill": "Banner Pattern",
"item.immersiveengineering.bannerpattern_windmill.desc": "Windmill",
"item.immersiveengineering.bannerpattern_wolf_r": "Banner Pattern",
"item.immersiveengineering.bannerpattern_wolf_r.desc": "Wolf (right)",
"item.immersiveengineering.bannerpattern_wolf_l": "Banner Pattern",
"item.immersiveengineering.bannerpattern_wolf_l.desc": "Wolf (left)",
"item.immersiveengineering.bannerpattern_wolf": "Banner Pattern",
"item.immersiveengineering.bannerpattern_wolf.desc": "Wolf",
"item.immersiveengineering.fusilier_spawn_egg": "Fusilier Spawn Egg",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a6de90f

Please sign in to comment.