-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split sources to make everything better
- Loading branch information
Showing
97 changed files
with
331 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
.../common/config/TaleOfKingdomsModMenu.java → .../client/config/TaleOfKingdomsModMenu.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...s/common/event/InventoryDrawCallback.java → ...s/client/event/InventoryDrawCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ofkingdoms/client/gui/RenderListener.java → ...ofkingdoms/client/gui/RenderListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../citybuilder/CityBuilderPriceListGui.java → .../citybuilder/CityBuilderPriceListGui.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...doms/mixin/client/InventoryDrawEvent.java → ...doms/client/mixin/InventoryDrawEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...oms/mixin/client/RecipesUpdatedEvent.java → ...oms/client/mixin/RecipesUpdatedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../structure/StructureBlockRenderMixin.java → .../structure/StructureBlockRenderMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
92 changes: 92 additions & 0 deletions
92
...om/convallyria/taleofkingdoms/client/packet/incoming/IncomingOpenScreenPacketHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package com.convallyria.taleofkingdoms.client.packet.incoming; | ||
|
||
import com.convallyria.taleofkingdoms.TaleOfKingdoms; | ||
import com.convallyria.taleofkingdoms.client.gui.entity.BankerScreen; | ||
import com.convallyria.taleofkingdoms.client.gui.entity.BlacksmithScreen; | ||
import com.convallyria.taleofkingdoms.client.gui.entity.GuildMasterScreen; | ||
import com.convallyria.taleofkingdoms.client.gui.entity.InnkeeperScreen; | ||
import com.convallyria.taleofkingdoms.client.gui.entity.citybuilder.CityBuilderBeginGui; | ||
import com.convallyria.taleofkingdoms.client.gui.entity.citybuilder.CityBuilderTierOneGui; | ||
import com.convallyria.taleofkingdoms.client.gui.entity.kingdom.ForemanScreen; | ||
import com.convallyria.taleofkingdoms.client.gui.entity.kingdom.ItemShopScreen; | ||
import com.convallyria.taleofkingdoms.client.gui.entity.kingdom.StockMarketScreen; | ||
import com.convallyria.taleofkingdoms.client.gui.entity.shop.FoodShopScreen; | ||
import com.convallyria.taleofkingdoms.client.packet.ClientPacketHandler; | ||
import com.convallyria.taleofkingdoms.common.entity.guild.BankerEntity; | ||
import com.convallyria.taleofkingdoms.common.entity.guild.BlacksmithEntity; | ||
import com.convallyria.taleofkingdoms.common.entity.guild.CityBuilderEntity; | ||
import com.convallyria.taleofkingdoms.common.entity.guild.FoodShopEntity; | ||
import com.convallyria.taleofkingdoms.common.entity.guild.GuildMasterEntity; | ||
import com.convallyria.taleofkingdoms.common.entity.guild.InnkeeperEntity; | ||
import com.convallyria.taleofkingdoms.common.entity.kingdom.ForemanEntity; | ||
import com.convallyria.taleofkingdoms.common.entity.kingdom.ItemShopEntity; | ||
import com.convallyria.taleofkingdoms.common.entity.kingdom.StockMarketEntity; | ||
import com.convallyria.taleofkingdoms.common.packet.Packets; | ||
import com.convallyria.taleofkingdoms.common.packet.context.PacketContext; | ||
import com.convallyria.taleofkingdoms.common.world.ConquestInstance; | ||
import com.convallyria.taleofkingdoms.server.packet.outgoing.OutgoingOpenScreenPacketHandler; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.gui.screen.Screen; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.text.Text; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.Optional; | ||
|
||
public final class IncomingOpenScreenPacketHandler extends ClientPacketHandler { | ||
|
||
public IncomingOpenScreenPacketHandler() { | ||
super(Packets.OPEN_CLIENT_SCREEN); | ||
} | ||
|
||
@Override | ||
public void handleIncomingPacket(PacketContext context, PacketByteBuf attachedData) { | ||
final OutgoingOpenScreenPacketHandler.ScreenTypes type = attachedData.readEnumConstant(OutgoingOpenScreenPacketHandler.ScreenTypes.class); | ||
final int entityId = attachedData.readInt(); | ||
context.taskQueue().execute(() -> { | ||
MinecraftClient client = (MinecraftClient) context.taskQueue(); | ||
if (TaleOfKingdoms.CONFIG.mainConfig.developerMode) { | ||
final String text = "Received open screen, " + type; | ||
TaleOfKingdoms.LOGGER.info(text); | ||
if (client.player != null) client.player.sendMessage(Text.literal(text)); | ||
} | ||
|
||
if (client.player == null) return; | ||
|
||
final Entity entityById = client.world.getEntityById(entityId); | ||
if (entityById == null) { | ||
TaleOfKingdoms.LOGGER.warn("Desync! " + entityId + " was not found."); | ||
return; | ||
} | ||
|
||
final Optional<ConquestInstance> instance = TaleOfKingdoms.getAPI().getConquestInstanceStorage().mostRecentInstance(); | ||
if (instance.isEmpty()) { | ||
TaleOfKingdoms.LOGGER.warn("Desync! Conquest instance was not found."); | ||
return; | ||
} | ||
|
||
Screen screen = switch (type) { | ||
case GUILD_MASTER -> new GuildMasterScreen(client.player, (GuildMasterEntity) entityById, instance.get()); | ||
case BLACKSMITH -> new BlacksmithScreen(client.player, (BlacksmithEntity) entityById, instance.get()); | ||
case INNKEEPER -> new InnkeeperScreen(client.player, (InnkeeperEntity) entityById, instance.get()); | ||
case BANKER -> new BankerScreen(client.player, (BankerEntity) entityById, instance.get()); | ||
case FOOD_SHOP -> new FoodShopScreen(client.player, (FoodShopEntity) entityById, instance.get()); | ||
case ITEM_SHOP -> new ItemShopScreen(client.player, (ItemShopEntity) entityById, instance.get()); | ||
case CITY_BUILDER_BEGIN -> new CityBuilderBeginGui(client.player, (CityBuilderEntity) entityById, instance.get()); | ||
case CITY_BUILDER_TIER_ONE -> new CityBuilderTierOneGui(client.player, (CityBuilderEntity) entityById, instance.get()); | ||
case STOCK_MARKET -> new StockMarketScreen(client.player, (StockMarketEntity) entityById, instance.get()); | ||
case FOREMAN -> new ForemanScreen(client.player, (ForemanEntity) entityById, instance.get()); | ||
}; | ||
|
||
client.setScreen(screen); | ||
}); | ||
} | ||
|
||
@Override | ||
public void handleOutgoingPacket(@NotNull PlayerEntity player, @Nullable Object... data) { | ||
throw new IllegalStateException("Not supported"); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"required": true, | ||
"package": "com.convallyria.taleofkingdoms.client.mixin", | ||
"compatibilityLevel": "JAVA_17", | ||
"client": [ | ||
"InventoryDrawEvent", | ||
"RecipesUpdatedEvent", | ||
"structure.StructureBlockRenderMixin" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |
Oops, something went wrong.