Add banner patterns... mostly

This commit is contained in:
Andrew-71 2023-12-26 19:34:45 +03:00
parent 586a39977b
commit a72c3a427c
13 changed files with 41 additions and 1 deletions

View file

@ -31,7 +31,7 @@ Goals left - QOL
## 0.4
* Implement antenna everywhere
* Add patterns
* Add crafting recipes for banner patterns; change item textures; remake grain
* Implement new concrete
* TV rework #3 (new colours, second static, ...?)
* More landmines, land mine base item, create integration for it

View file

@ -4,8 +4,10 @@ import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
import net.minecraft.block.Block;
import net.minecraft.block.entity.BannerPattern;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.BannerPatternItem;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
@ -20,6 +22,7 @@ import net.minecraft.util.Identifier;
import java.util.Optional;
import java.util.function.Supplier;
import net.minecraft.util.Rarity;
import su.a71.new_soviet.NewSoviet;
public class NSE_BaseRegistration {
@ -60,5 +63,17 @@ public class NSE_BaseRegistration {
return TagKey.of(RegistryKeys.ITEM, new Identifier(NewSoviet.MOD_ID, name));
}
public static void registerPattern(String name, Rarity rarity, ItemGroup tab) {
BannerPattern patternThing = new BannerPattern(name);
final TagKey<BannerPattern> bannerTag = TagKey.of(RegistryKeys.BANNER_PATTERN, new Identifier(NewSoviet.MOD_ID, name));
BannerPatternItem patternItem = new BannerPatternItem(bannerTag, new Item.Settings().rarity(rarity));
Registry.register(Registries.ITEM, new Identifier(NewSoviet.MOD_ID, name), patternItem);
Registry.register(Registries.BANNER_PATTERN, new Identifier(NewSoviet.MOD_ID, name), patternThing);
if (tab == null) return; // Sanity check for hidden items
Optional<RegistryKey<ItemGroup>> key = Registries.ITEM_GROUP.getKey(tab);
key.ifPresent(itemGroupRegistryKey -> ItemGroupEvents.modifyEntriesEvent(itemGroupRegistryKey).register(content -> content.add(patternItem)));
}
public static void init() {}
}

View file

@ -54,5 +54,8 @@ public class NSE_Items extends NSE_BaseRegistration {
registerItem("antenna", () -> ANTENNA, NSE_ITEMS_TAB);
registerItem("cigarette", ()-> CIGARETTE, NSE_ITEMS_TAB);
registerItem("cigarette_butt", ()-> CIGARETTE_BUTT, NSE_ITEMS_TAB);
registerPattern("sickle_pattern", Rarity.UNCOMMON, NSE_ITEMS_TAB);
registerPattern("star_pattern", Rarity.UNCOMMON, NSE_ITEMS_TAB);
registerPattern("grain_pattern", Rarity.UNCOMMON, NSE_ITEMS_TAB);
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "new_soviet:item/pattern/sickle"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "new_soviet:item/pattern/star"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 435 B

View file

@ -0,0 +1,5 @@
{
"values": [
"new_soviet:sickle_pattern"
]
}

View file

@ -0,0 +1,5 @@
{
"values": [
"new_soviet:star_pattern"
]
}