Split client and server.

This commit is contained in:
modmuss50 2022-05-19 21:45:31 +01:00
parent 3cb62b0291
commit c3622cb263
208 changed files with 194 additions and 219 deletions

View file

@ -34,6 +34,7 @@ import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
import net.minecraft.client.texture.SpriteAtlasTexture;
import reborncore.api.blockentity.UnloadHandler;
import reborncore.client.*;
import reborncore.common.screen.ScreenIcons;
import java.util.Locale;
@ -43,7 +44,12 @@ public class RebornCoreClient implements ClientModInitializer {
public void onInitializeClient() {
RebornFluidRenderManager.setupClient();
HolidayRenderManager.setupClient();
ClientSpriteRegistryCallback.event(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE).register(IconSupplier::registerSprites);
ClientSpriteRegistryCallback.event(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE).register((atlasTexture, registry) -> {
registry.register(ScreenIcons.HEAD);
registry.register(ScreenIcons.CHEST);
registry.register(ScreenIcons.LEGS);
registry.register(ScreenIcons.FEET);
});
ClientBoundPacketHandlers.init();
HudRenderCallback.EVENT.register(new ItemStackRenderer());
ItemTooltipCallback.EVENT.register(new StackToolTipHandler());

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package reborncore.common.util;
package reborncore.client;
import net.minecraft.client.MinecraftClient;
import net.minecraft.network.MessageSender;

View file

@ -53,7 +53,7 @@ import reborncore.client.gui.builder.slot.SlotConfigGui;
import reborncore.client.gui.builder.widget.GuiButtonHologram;
import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.screen.BuiltScreenHandler;
import reborncore.client.screen.builder.slot.PlayerInventorySlot;
import reborncore.common.screen.slot.PlayerInventorySlot;
import reborncore.common.blockentity.MachineBaseBlockEntity;
import java.util.ArrayList;

View file

@ -27,7 +27,6 @@ package reborncore.client.gui.builder;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import net.minecraft.text.Text;
import reborncore.client.RenderUtil;
import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.blockentity.RedstoneConfiguration;

View file

@ -28,13 +28,9 @@ import com.google.common.collect.Lists;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.network.MessageType;
import net.minecraft.screen.slot.Slot;
import net.minecraft.text.Text;
import net.minecraft.util.Util;
import net.minecraft.util.registry.Registry;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Unique;
import reborncore.client.gui.GuiUtil;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.slot.elements.ConfigSlotElement;
@ -44,7 +40,7 @@ import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.network.NetworkManager;
import reborncore.common.network.ServerBoundPackets;
import reborncore.common.util.ClientChatUtils;
import reborncore.client.ClientChatUtils;
import reborncore.common.util.Color;
import java.util.Collections;

View file

@ -34,7 +34,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.slot.SlotConfigGui;
import reborncore.client.gui.slots.BaseSlot;
import reborncore.common.screen.slot.BaseSlot;
import reborncore.common.blockentity.SlotConfiguration;
import java.util.ArrayList;

View file

@ -43,7 +43,6 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import reborncore.api.IListInfoProvider;
@ -436,7 +435,7 @@ public class GuiBuilder {
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
RenderSystem.setShaderTexture(0, DrawableHelper.OPTIONS_BACKGROUND_TEXTURE);
RenderSystem.setShaderTexture(0, OPTIONS_BACKGROUND_TEXTURE);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
bufferBuilder.vertex(this.left, this.bottom, 0.0D).texture((float) this.left / 32.0F, (float) (this.bottom + (int) this.getScrollAmount()) / 32.0F).color(32, 32, 32, 255).next();

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package reborncore.mixin.client;
package reborncore.client.mixin;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.debug.DebugRenderer;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package reborncore.mixin.client;
package reborncore.client.mixin;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.AbstractClientPlayerEntity;

View file

@ -1,6 +1,6 @@
{
"required": true,
"package": "reborncore.mixin.client",
"package": "reborncore.client.mixin",
"compatibilityLevel": "JAVA_17",
"client": [
"MixinGameRenderer",

View file

@ -29,7 +29,6 @@ import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import reborncore.client.multiblock.HologramRenderer;
import java.util.function.BiPredicate;
@ -38,7 +37,6 @@ import java.util.function.BiPredicate;
*
* @author ramidzkh
* @see MultiblockVerifier
* @see HologramRenderer
*/
public interface MultiblockWriter {

View file

@ -33,7 +33,7 @@ import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;
import reborncore.api.recipe.IRecipeCrafterProvider;
import reborncore.client.screen.builder.Syncable;
import reborncore.common.screen.Syncable;
import reborncore.common.util.BooleanFunction;
import reborncore.common.util.NBTSerializable;

View file

@ -39,7 +39,6 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import reborncore.api.IListInfoProvider;
import reborncore.client.screen.builder.BlockEntityScreenHandlerBuilder;
import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.blockentity.RedstoneConfiguration;
import reborncore.common.util.StringUtils;

View file

@ -22,27 +22,13 @@
* SOFTWARE.
*/
package reborncore.client;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
import net.minecraft.client.texture.SpriteAtlasTexture;
package reborncore.common.screen;
import net.minecraft.util.Identifier;
import reborncore.RebornCore;
public class IconSupplier {
public static Identifier armour_head_id = new Identifier(RebornCore.MOD_ID, "gui/slot_sprites/armour_head");
public static Identifier armour_chest_id = new Identifier(RebornCore.MOD_ID, "gui/slot_sprites/armour_chest");
public static Identifier armour_legs_id = new Identifier(RebornCore.MOD_ID, "gui/slot_sprites/armour_legs");
public static Identifier armour_feet_id = new Identifier(RebornCore.MOD_ID, "gui/slot_sprites/armour_feet");
@Environment(EnvType.CLIENT)
public static void registerSprites(SpriteAtlasTexture atlasTexture, ClientSpriteRegistryCallback.Registry registry) {
registry.register(IconSupplier.armour_head_id);
registry.register(IconSupplier.armour_chest_id);
registry.register(IconSupplier.armour_legs_id);
registry.register(IconSupplier.armour_feet_id);
}
public class ScreenIcons {
public static Identifier HEAD = new Identifier(RebornCore.MOD_ID, "gui/slot_sprites/armour_head");
public static Identifier CHEST = new Identifier(RebornCore.MOD_ID, "gui/slot_sprites/armour_chest");
public static Identifier LEGS = new Identifier(RebornCore.MOD_ID, "gui/slot_sprites/armour_legs");
public static Identifier FEET = new Identifier(RebornCore.MOD_ID, "gui/slot_sprites/armour_feet");
}

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package reborncore.client.screen.builder;
package reborncore.common.screen;
import org.apache.commons.lang3.tuple.Pair;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package reborncore.client.screen.builder;
package reborncore.common.screen.builder;
import com.mojang.serialization.Codec;
import com.mojang.serialization.DataResult;
@ -40,14 +40,11 @@ import reborncore.RebornCore;
import reborncore.api.blockentity.IUpgrade;
import reborncore.api.blockentity.IUpgradeable;
import reborncore.api.recipe.IRecipeCrafterProvider;
import reborncore.client.gui.slots.BaseSlot;
import reborncore.client.gui.slots.SlotFake;
import reborncore.client.gui.slots.SlotOutput;
import reborncore.client.screen.builder.slot.FilteredSlot;
import reborncore.client.screen.builder.slot.UpgradeSlot;
import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.fluid.FluidUtils;
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
import reborncore.common.screen.Syncable;
import reborncore.common.screen.slot.*;
import team.reborn.energy.api.EnergyStorageUtil;
import java.util.function.Consumer;

View file

@ -22,16 +22,16 @@
* SOFTWARE.
*/
package reborncore.client.screen.builder;
package reborncore.common.screen.builder;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ArmorItem;
import net.minecraft.util.Identifier;
import org.apache.commons.lang3.Range;
import reborncore.client.IconSupplier;
import reborncore.client.screen.builder.slot.PlayerInventorySlot;
import reborncore.client.screen.builder.slot.SpriteSlot;
import reborncore.common.screen.ScreenIcons;
import reborncore.common.screen.slot.PlayerInventorySlot;
import reborncore.common.screen.slot.SpriteSlot;
public final class PlayerScreenHandlerBuilder {
@ -114,19 +114,19 @@ public final class PlayerScreenHandlerBuilder {
}
public PlayerArmorScreenHandlerBuilder helmet(final int xStart, final int yStart) {
return this.armor(this.parent.player.size() - 2, xStart, yStart, EquipmentSlot.HEAD, IconSupplier.armour_head_id);
return this.armor(this.parent.player.size() - 2, xStart, yStart, EquipmentSlot.HEAD, ScreenIcons.HEAD);
}
public PlayerArmorScreenHandlerBuilder chestplate(final int xStart, final int yStart) {
return this.armor(this.parent.player.size() - 3, xStart, yStart, EquipmentSlot.CHEST, IconSupplier.armour_chest_id);
return this.armor(this.parent.player.size() - 3, xStart, yStart, EquipmentSlot.CHEST, ScreenIcons.CHEST);
}
public PlayerArmorScreenHandlerBuilder leggings(final int xStart, final int yStart) {
return this.armor(this.parent.player.size() - 4, xStart, yStart, EquipmentSlot.LEGS, IconSupplier.armour_legs_id);
return this.armor(this.parent.player.size() - 4, xStart, yStart, EquipmentSlot.LEGS, ScreenIcons.LEGS);
}
public PlayerArmorScreenHandlerBuilder boots(final int xStart, final int yStart) {
return this.armor(this.parent.player.size() - 5, xStart, yStart, EquipmentSlot.FEET, IconSupplier.armour_feet_id);
return this.armor(this.parent.player.size() - 5, xStart, yStart, EquipmentSlot.FEET, ScreenIcons.FEET);
}
public PlayerArmorScreenHandlerBuilder complete(final int xStart, final int yStart) {

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package reborncore.client.screen.builder;
package reborncore.common.screen.builder;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package reborncore.client.gui.slots;
package reborncore.common.screen.slot;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;

View file

@ -22,11 +22,10 @@
* SOFTWARE.
*/
package reborncore.client.screen.builder.slot;
package reborncore.common.screen.slot;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import reborncore.client.gui.slots.BaseSlot;
import java.util.function.Predicate;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package reborncore.client.screen.builder.slot;
package reborncore.common.screen.slot;
import net.minecraft.inventory.Inventory;
import net.minecraft.screen.slot.Slot;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package reborncore.client.gui.slots;
package reborncore.common.screen.slot;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package reborncore.client.gui.slots;
package reborncore.common.screen.slot;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package reborncore.client.gui.slots;
package reborncore.common.screen.slot;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package reborncore.client.gui.slots;
package reborncore.common.screen.slot;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;

View file

@ -22,13 +22,13 @@
* SOFTWARE.
*/
package reborncore.client.screen.builder.slot;
package reborncore.common.screen.slot;
import com.mojang.datafixers.util.Pair;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.inventory.Inventory;
import net.minecraft.screen.PlayerScreenHandler;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
@ -56,6 +56,6 @@ public class SpriteSlot extends FilteredSlot {
@Nullable
@Environment(EnvType.CLIENT)
public Pair<Identifier, Identifier> getBackgroundSprite() {
return Pair.of(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, spriteName);
return Pair.of(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, spriteName);
}
}

View file

@ -22,13 +22,12 @@
* SOFTWARE.
*/
package reborncore.client.screen.builder.slot;
package reborncore.common.screen.slot;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import reborncore.api.blockentity.IUpgrade;
import reborncore.api.blockentity.IUpgradeable;
import reborncore.client.gui.slots.BaseSlot;
import reborncore.common.util.RebornInventory;
public class UpgradeSlot extends BaseSlot {

View file

@ -37,10 +37,10 @@ import net.minecraft.util.registry.Registry;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;
import reborncore.client.screen.builder.Syncable;
import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.fluid.FluidValue;
import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.screen.Syncable;
import java.util.List;
import java.util.function.Consumer;

View file

@ -21,7 +21,7 @@
]
},
"mixins": [
"reborncore.client.mixins.json",
"reborncore.client.mixins.json",
"reborncore.common.mixins.json"
],
"depends": {