Skip to content

Commit

Permalink
Update to 1.21.2
Browse files Browse the repository at this point in the history
Patbox committed Oct 20, 2024
1 parent 5d16621 commit bf4b1d3
Showing 10 changed files with 82 additions and 68 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.6.+'
id 'fabric-loom' version '1.7.+'
id 'maven-publish'
}

@@ -76,7 +76,7 @@ tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"


it.options.release = 17
it.options.release = 21

}

12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -3,16 +3,16 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.5
minecraft_version=1.21.2-rc1
yarn_mappings=1.21.2-rc1+build.1
loader_version=0.16.7

# Fabric API
fabric_version=0.105.0+1.21.1
#Fabric api
fabric_version=0.106.0+1.21.2


# Mod Properties
mod_version = 1.6.1+1.21.1
mod_version = 1.7.0+1.21.2
maven_group = eu.pb4
archives_base_name = sgui

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -260,7 +260,7 @@ public AnimatedGuiElementBuilder enchant(MinecraftServer server, RegistryKey<Enc
* @return this element builder
*/
public AnimatedGuiElementBuilder enchant(RegistryWrapper.WrapperLookup lookup, RegistryKey<Enchantment> enchantment, int level) {
return enchant(lookup.getWrapperOrThrow(RegistryKeys.ENCHANTMENT).getOrThrow(enchantment), level);
return enchant(lookup.getOrThrow(RegistryKeys.ENCHANTMENT).getOrThrow(enchantment), level);
}

/**
30 changes: 28 additions & 2 deletions src/main/java/eu/pb4/sgui/api/elements/GuiElementBuilder.java
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.server.MinecraftServer;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;
import net.minecraft.util.Unit;
import org.jetbrains.annotations.Nullable;
@@ -36,7 +37,7 @@
*/
@SuppressWarnings({"unused"})
public class GuiElementBuilder implements GuiElementBuilderInterface<GuiElementBuilder> {
protected ItemStack itemStack = new ItemStack(Items.STONE);
protected ItemStack itemStack = new ItemStack(Items.WHITE_DYE);
protected GuiElement.ClickCallback callback = GuiElementInterface.EMPTY_CALLBACK;

/**
@@ -54,6 +55,15 @@ public GuiElementBuilder(Item item) {
this.itemStack = new ItemStack(item);
}

/**
* Constructs a GuiElementBuilder with the specified item model.
*
* @param model Item model to use. Same as calling model(...).
*/
public GuiElementBuilder(Identifier model) {
this.model(model);
}

/**
* Constructs a GuiElementBuilder with the specified Item
* and number of items.
@@ -273,7 +283,7 @@ public GuiElementBuilder enchant(MinecraftServer server, RegistryKey<Enchantment
* @return this element builder
*/
public GuiElementBuilder enchant(RegistryWrapper.WrapperLookup lookup, RegistryKey<Enchantment> enchantment, int level) {
return enchant(lookup.getWrapperOrThrow(RegistryKeys.ENCHANTMENT).getOrThrow(enchantment), level);
return enchant(lookup.getOrThrow(RegistryKeys.ENCHANTMENT).getOrThrow(enchantment), level);
}

/**
@@ -307,6 +317,22 @@ public GuiElementBuilder setCustomModelData(int value) {
return this;
}

/**
* Sets the model of the element.
*
* @param model model to display item as
* @return this element builder
*/
public GuiElementBuilder model(Identifier model) {
this.itemStack.set(DataComponentTypes.ITEM_MODEL, model);
return this;
}

public GuiElementBuilder model(Item model) {
this.itemStack.set(DataComponentTypes.ITEM_MODEL, model.getComponents().get(DataComponentTypes.ITEM_MODEL));
return this;
}

/**
* Sets the element to be unbreakable, also hides the durability bar.
*
2 changes: 1 addition & 1 deletion src/main/java/eu/pb4/sgui/api/gui/SignGui.java
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ public class SignGui implements GuiInterface {
*/
public SignGui(ServerPlayerEntity player) {
this.player = player;
this.signEntity = new VirtualSignBlockEntity(player.getWorld(), new BlockPos(player.getBlockPos().getX(), Math.min(player.getWorld().getTopY() - 1, player.getBlockPos().getY() + 5), player.getBlockPos().getZ()), Blocks.OAK_SIGN.getDefaultState());
this.signEntity = new VirtualSignBlockEntity(player.getWorld(), new BlockPos(player.getBlockPos().getX(), Math.min(player.getWorld().getTopYInclusive(), player.getBlockPos().getY() + 5), player.getBlockPos().getZ()), Blocks.OAK_SIGN.getDefaultState());
}

/**
4 changes: 2 additions & 2 deletions src/main/java/eu/pb4/sgui/api/gui/SimpleGui.java
Original file line number Diff line number Diff line change
@@ -11,12 +11,12 @@
import net.minecraft.item.ItemStack;
import net.minecraft.network.packet.s2c.play.OpenScreenS2CPacket;
import net.minecraft.network.packet.s2c.play.ScreenHandlerPropertyUpdateS2CPacket;
import net.minecraft.recipe.NetworkRecipeId;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.screen.slot.Slot;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;

import java.util.OptionalInt;

@@ -187,7 +187,7 @@ protected boolean sendGui() {
* @param recipe the selected recipe identifier
* @param shift is shift was held
*/
public void onCraftRequest(Identifier recipe, boolean shift) {
public void onCraftRequest(NetworkRecipeId recipe, boolean shift) {
}

@Override
65 changes: 28 additions & 37 deletions src/main/java/eu/pb4/sgui/mixin/ServerPlayNetworkHandlerMixin.java
Original file line number Diff line number Diff line change
@@ -13,13 +13,17 @@
import eu.pb4.sgui.virtual.inventory.VirtualScreenHandler;
import eu.pb4.sgui.virtual.merchant.VirtualMerchantScreenHandler;
import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.PlayerInventory;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import net.minecraft.item.ItemStack;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.message.LastSeenMessageList;
import net.minecraft.network.packet.c2s.play.*;
import net.minecraft.network.packet.s2c.play.*;
import net.minecraft.network.packet.s2c.play.BlockUpdateS2CPacket;
import net.minecraft.network.packet.s2c.play.OpenScreenS2CPacket;
import net.minecraft.network.packet.s2c.play.PlayerActionResponseS2CPacket;
import net.minecraft.network.packet.s2c.play.UpdateSelectedSlotS2CPacket;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.filter.FilteredMessage;
@@ -42,15 +46,13 @@
@Mixin(ServerPlayNetworkHandler.class)
public abstract class ServerPlayNetworkHandlerMixin extends ServerCommonNetworkHandler {

@Shadow
public ServerPlayerEntity player;
@Unique
private boolean sgui$bookIgnoreClose = false;

@Unique
private ScreenHandler sgui$previousScreen = null;

@Shadow
public ServerPlayerEntity player;

public ServerPlayNetworkHandlerMixin(MinecraftServer server, ClientConnection connection, ConnectedClientData clientData) {
super(server, connection, clientData);
}
@@ -60,47 +62,36 @@ public ServerPlayNetworkHandlerMixin(MinecraftServer server, ClientConnection co
if (this.player.currentScreenHandler instanceof VirtualScreenHandler handler) {
try {
var gui = handler.getGui();

int slot = packet.getSlot();
int button = packet.getButton();

ClickType type = ClickType.toClickType(packet.getActionType(), button, slot);
boolean ignore = gui.onAnyClick(slot, type, packet.getActionType());
if (ignore && !handler.getGui().getLockPlayerInventory() && (slot >= handler.getGui().getSize() || slot < 0 || handler.getGui().getSlotRedirect(slot) != null)) {
if (type == ClickType.MOUSE_DOUBLE_CLICK || (type.isDragging && type.value == 2)) {
GuiHelpers.sendPlayerScreenHandler(this.player);
} else if (type == ClickType.OFFHAND_SWAP) {
int index = handler.getGui().getOffhandSlotIndex();
ItemStack updated = index >= 0 ? handler.getSlot(index).getStack() : ItemStack.EMPTY;
GuiHelpers.sendSlotUpdate(this.player, -2, PlayerInventory.OFF_HAND_SLOT, updated, handler.getRevision());
}

return;
}

this.player.currentScreenHandler.disableSyncing();
boolean bl = packet.getRevision() != this.player.currentScreenHandler.getRevision();

for (Int2ObjectMap.Entry<ItemStack> entry : Int2ObjectMaps.fastIterable(packet.getModifiedStacks())) {
this.player.currentScreenHandler.setPreviousTrackedSlotMutable(entry.getIntKey(), entry.getValue());
}

this.player.currentScreenHandler.setPreviousCursorStack(packet.getStack());

boolean allow = gui.click(slot, type, packet.getActionType());
if (handler.getGui().isOpen()) {
if (!allow) {
if (slot >= 0 && slot < handler.getGui().getSize()) {
this.sendPacket(new ScreenHandlerSlotUpdateS2CPacket(handler.syncId, handler.nextRevision(), slot, handler.getSlot(slot).getStack()));
}
GuiHelpers.sendSlotUpdate(this.player, -1, -1, this.player.currentScreenHandler.getCursorStack(), handler.getRevision());

if (type.numKey) {
int index = handler.getGui().getHotbarSlotIndex(handler.slots.size(), type.value - 1);
GuiHelpers.sendSlotUpdate(this.player, handler.syncId, index, handler.getSlot(index).getStack(), handler.nextRevision());
} else if (type == ClickType.OFFHAND_SWAP) {
int index = handler.getGui().getOffhandSlotIndex();
ItemStack updated = index >= 0 ? handler.getSlot(index).getStack() : ItemStack.EMPTY;
GuiHelpers.sendSlotUpdate(this.player, -2, PlayerInventory.OFF_HAND_SLOT, updated, handler.getRevision());
} else if (type == ClickType.MOUSE_DOUBLE_CLICK || type == ClickType.MOUSE_LEFT_SHIFT || type == ClickType.MOUSE_RIGHT_SHIFT || (type.isDragging && type.value == 2)) {
GuiHelpers.sendPlayerScreenHandler(this.player);
}

this.player.currentScreenHandler.enableSyncing();
if (allow) {
if (bl) {
this.player.currentScreenHandler.updateToClient();
} else {
this.player.currentScreenHandler.sendContentUpdates();
}
}

} catch (Throwable e) {
handler.getGui().handleException(e);
ci.cancel();
}

ci.cancel();
@@ -190,7 +181,7 @@ public ServerPlayNetworkHandlerMixin(MinecraftServer server, ClientConnection co
private void sgui$catchRecipeRequests(CraftRequestC2SPacket packet, CallbackInfo ci) {
if (this.player.currentScreenHandler instanceof VirtualScreenHandler handler && handler.getGui() instanceof SimpleGui gui) {
try {
gui.onCraftRequest(packet.getRecipeId(), packet.shouldCraftAll());
gui.onCraftRequest(packet.recipeId(), packet.craftAll());
} catch (Throwable e) {
handler.getGui().handleException(e);
}
@@ -271,7 +262,7 @@ public ServerPlayNetworkHandlerMixin(MinecraftServer server, ClientConnection co
var pos = packet.getBlockHitResult().getBlockPos();
handler.syncSelectedSlot();

this.sendPacket(new BlockUpdateS2CPacket(pos, this.player. getServerWorld().getBlockState(pos)));
this.sendPacket(new BlockUpdateS2CPacket(pos, this.player.getServerWorld().getBlockState(pos)));
pos = pos.offset(packet.getBlockHitResult().getSide());
this.sendPacket(new BlockUpdateS2CPacket(pos, this.player.getServerWorld().getBlockState(pos)));
this.sendPacket(new PlayerActionResponseS2CPacket(packet.getSequence()));
@@ -307,7 +298,7 @@ public ServerPlayNetworkHandlerMixin(MinecraftServer server, ClientConnection co
if (this.player.currentScreenHandler instanceof HotbarScreenHandler handler) {
var gui = handler.getGui();
var buf = new PacketByteBuf(Unpooled.buffer());
((PlayerInteractEntityC2SPacketAccessor)packet).invokeWrite(buf);
((PlayerInteractEntityC2SPacketAccessor) packet).invokeWrite(buf);

int entityId = buf.readVarInt();
var type = buf.readEnumConstant(HotbarGui.EntityInteraction.class);
7 changes: 2 additions & 5 deletions src/testmod/java/eu/pb4/sgui/testmod/SGuiTest.java
Original file line number Diff line number Diff line change
@@ -17,9 +17,7 @@
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.WrittenBookItem;
import net.minecraft.registry.Registries;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.recipe.NetworkRecipeId;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.screen.slot.Slot;
@@ -29,7 +27,6 @@
import net.minecraft.text.*;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.random.Random;
import net.minecraft.village.TradeOffer;
@@ -293,7 +290,7 @@ private static int test5(CommandContext<ServerCommandSource> objectCommandContex
ServerPlayerEntity player = objectCommandContext.getSource().getPlayer();
SimpleGui gui = new SimpleGui(ScreenHandlerType.CRAFTING, player, false) {
@Override
public void onCraftRequest(Identifier recipeId, boolean shift) {
public void onCraftRequest(NetworkRecipeId recipeId, boolean shift) {
super.onCraftRequest(recipeId, shift);
this.player.sendMessage(Text.literal(recipeId.toString() + " - " + shift), false);
}
22 changes: 11 additions & 11 deletions src/testmod/java/eu/pb4/sgui/testmod/SnakeGui.java
Original file line number Diff line number Diff line change
@@ -55,19 +55,19 @@ public SnakeGui(ServerPlayerEntity player) {
super(ScreenHandlerType.GENERIC_9X6, player, true);
this.setTitle(Text.literal("SGui Snake"));

var reg = player.getRegistryManager().get(RegistryKeys.BANNER_PATTERN);
var reg = player.getRegistryManager().getOrThrow(RegistryKeys.BANNER_PATTERN);

NUMBERS = new ItemStack[]{
create(new BannerPatternsComponent.Builder().add(reg.getEntry(BannerPatterns.STRIPE_BOTTOM).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_LEFT).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_TOP).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_RIGHT).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_DOWNLEFT).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getEntry(BannerPatterns.STRIPE_CENTER).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.SQUARE_TOP_LEFT).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.CURLY_BORDER).orElseThrow(), DyeColor.GRAY).add(reg.getEntry(BannerPatterns.STRIPE_BOTTOM).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getEntry(BannerPatterns.STRIPE_TOP).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.RHOMBUS).orElseThrow(), DyeColor.GRAY).add(reg.getEntry(BannerPatterns.STRIPE_BOTTOM).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_DOWNLEFT).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getEntry(BannerPatterns.STRIPE_BOTTOM).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_MIDDLE).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_TOP).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.CURLY_BORDER).orElseThrow(), DyeColor.GRAY).add(reg.getEntry(BannerPatterns.STRIPE_RIGHT).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getEntry(BannerPatterns.STRIPE_LEFT).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.HALF_HORIZONTAL_BOTTOM).orElseThrow(), DyeColor.GRAY).add(reg.getEntry(BannerPatterns.STRIPE_RIGHT).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_MIDDLE).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getEntry(BannerPatterns.STRIPE_BOTTOM).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.RHOMBUS).orElseThrow(), DyeColor.GRAY).add(reg.getEntry(BannerPatterns.STRIPE_TOP).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_DOWNRIGHT).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getEntry(BannerPatterns.STRIPE_BOTTOM).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_RIGHT).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.HALF_HORIZONTAL).orElseThrow(), DyeColor.GRAY).add(reg.getEntry(BannerPatterns.STRIPE_MIDDLE).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_TOP).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_LEFT).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getEntry(BannerPatterns.STRIPE_DOWNLEFT).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_TOP).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getEntry(BannerPatterns.STRIPE_DOWNLEFT).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_TOP).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getEntry(BannerPatterns.STRIPE_LEFT).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.HALF_HORIZONTAL_BOTTOM).orElseThrow(), DyeColor.GRAY).add(reg.getEntry(BannerPatterns.STRIPE_MIDDLE).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_TOP).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_RIGHT).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.STRIPE_BOTTOM).orElseThrow(), DyeColor.WHITE).add(reg.getEntry(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getOptional(BannerPatterns.STRIPE_BOTTOM).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_LEFT).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_TOP).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_RIGHT).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_DOWNLEFT).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getOptional(BannerPatterns.STRIPE_CENTER).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.SQUARE_TOP_LEFT).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.CURLY_BORDER).orElseThrow(), DyeColor.GRAY).add(reg.getOptional(BannerPatterns.STRIPE_BOTTOM).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getOptional(BannerPatterns.STRIPE_TOP).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.RHOMBUS).orElseThrow(), DyeColor.GRAY).add(reg.getOptional(BannerPatterns.STRIPE_BOTTOM).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_DOWNLEFT).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getOptional(BannerPatterns.STRIPE_BOTTOM).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_MIDDLE).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_TOP).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.CURLY_BORDER).orElseThrow(), DyeColor.GRAY).add(reg.getOptional(BannerPatterns.STRIPE_RIGHT).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getOptional(BannerPatterns.STRIPE_LEFT).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.HALF_HORIZONTAL_BOTTOM).orElseThrow(), DyeColor.GRAY).add(reg.getOptional(BannerPatterns.STRIPE_RIGHT).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_MIDDLE).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getOptional(BannerPatterns.STRIPE_BOTTOM).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.RHOMBUS).orElseThrow(), DyeColor.GRAY).add(reg.getOptional(BannerPatterns.STRIPE_TOP).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_DOWNRIGHT).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getOptional(BannerPatterns.STRIPE_BOTTOM).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_RIGHT).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.HALF_HORIZONTAL).orElseThrow(), DyeColor.GRAY).add(reg.getOptional(BannerPatterns.STRIPE_MIDDLE).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_TOP).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_LEFT).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getOptional(BannerPatterns.STRIPE_DOWNLEFT).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_TOP).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getOptional(BannerPatterns.STRIPE_DOWNLEFT).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_TOP).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
create(new BannerPatternsComponent.Builder().add(reg.getOptional(BannerPatterns.STRIPE_LEFT).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.HALF_HORIZONTAL_BOTTOM).orElseThrow(), DyeColor.GRAY).add(reg.getOptional(BannerPatterns.STRIPE_MIDDLE).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_TOP).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_RIGHT).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.STRIPE_BOTTOM).orElseThrow(), DyeColor.WHITE).add(reg.getOptional(BannerPatterns.BORDER).orElseThrow(), DyeColor.GRAY).build()),
};

Layer controller = new Layer(3, 3);

0 comments on commit bf4b1d3

Please sign in to comment.