1.19.3 port (#3074)
* Start on 1.19.3 port * Client runs, kinda * Fix crash when opening item group * Fix dynamic models * Add atlas config for slot sprites * Ore :) * Rubber tree's, lakes and ore cleanup * Add blocks to item group * Fix rubber tree sapling * added vanilla creative and missing peridot pickaxe (#3076) * added vanilla creative and missing peridot pickaxe * some small tweaks Co-authored-by: ayutac <fly.high.android@gmail.com> * added bamboo saw mill datagen recipes (#3077) * added bamboo saw mill datagen recipes * fixed datagen error Co-authored-by: ayutac <fly.high.android@gmail.com> * 1.19.3-rc1 * 1.19.3 port villager housing (#3082) * added NBTs for the houses * added the houses, theoretically * added the houses, practically * made house gen configurable Co-authored-by: ayutac <fly.high.android@gmail.com> * Fixes #3083 * reordered TR creative tab and small tweaks to the rest (#3081) * reordered TR creative tab and small tweaks to the rest * small bugfix Co-authored-by: ayutac <fly.high.android@gmail.com> * 1.19.3 * Bump version Co-authored-by: Ayutac <skoch02@students.uni-mainz.de> Co-authored-by: ayutac <fly.high.android@gmail.com>
This commit is contained in:
parent
7b7fba96c5
commit
573ba92920
162 changed files with 2049 additions and 1265 deletions
|
@ -30,11 +30,13 @@ import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
|||
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
|
||||
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
|
||||
import net.minecraft.screen.PlayerScreenHandler;
|
||||
import reborncore.api.blockentity.UnloadHandler;
|
||||
import reborncore.client.*;
|
||||
import reborncore.common.screen.ScreenIcons;
|
||||
import reborncore.client.BlockOutlineRenderer;
|
||||
import reborncore.client.ClientBoundPacketHandlers;
|
||||
import reborncore.client.HolidayRenderManager;
|
||||
import reborncore.client.ItemStackRenderer;
|
||||
import reborncore.client.RebornFluidRenderManager;
|
||||
import reborncore.client.StackToolTipHandler;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
@ -44,12 +46,6 @@ public class RebornCoreClient implements ClientModInitializer {
|
|||
public void onInitializeClient() {
|
||||
RebornFluidRenderManager.setupClient();
|
||||
HolidayRenderManager.setupClient();
|
||||
ClientSpriteRegistryCallback.event(PlayerScreenHandler.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());
|
||||
|
|
|
@ -37,7 +37,7 @@ import net.minecraft.client.render.entity.model.PlayerEntityModel;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
import reborncore.common.util.CalenderUtils;
|
||||
|
||||
|
@ -74,8 +74,8 @@ public class HolidayRenderManager {
|
|||
float yaw = player.prevYaw + (player.getYaw() - player.prevYaw) * tickDelta - (player.prevBodyYaw + (player.bodyYaw - player.prevBodyYaw) * tickDelta);
|
||||
float pitch = player.prevPitch + (player.getPitch() - player.prevPitch) * tickDelta;
|
||||
|
||||
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(yaw));
|
||||
matrixStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(pitch));
|
||||
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(yaw));
|
||||
matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(pitch));
|
||||
santaHat.render(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlay(player, 0.0F), 1F, 1F, 1F, 1F);
|
||||
matrixStack.pop();
|
||||
}
|
||||
|
|
|
@ -35,9 +35,10 @@ import net.minecraft.client.render.DiffuseLighting;
|
|||
import net.minecraft.client.texture.NativeImage;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Matrix4f;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import org.joml.Matrix4f;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import java.nio.file.Files;
|
||||
|
@ -56,14 +57,15 @@ public class ItemStackRenderer implements HudRenderCallback {
|
|||
public void onHudRender(MatrixStack matrixStack, float v) {
|
||||
if (!ItemStackRenderManager.RENDER_QUEUE.isEmpty()) {
|
||||
ItemStack itemStack = ItemStackRenderManager.RENDER_QUEUE.remove();
|
||||
Identifier id = Registry.ITEM.getId(itemStack.getItem());
|
||||
Identifier id = Registries.ITEM.getId(itemStack.getItem());
|
||||
MinecraftClient.getInstance().textRenderer.draw(matrixStack, "Rendering " + id + ", " + ItemStackRenderManager.RENDER_QUEUE.size() + " items left", 5, 5, -1);
|
||||
export(id, itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
private void export(Identifier identifier, ItemStack item) {
|
||||
RenderSystem.setProjectionMatrix(Matrix4f.projectionMatrix(0, 16, 0, 16, 1000, 3000));
|
||||
Matrix4f matrix4f = new Matrix4f().setOrtho(0, 16, 0, 16, 1000, 3000);
|
||||
RenderSystem.setProjectionMatrix(matrix4f);
|
||||
MatrixStack stack = RenderSystem.getModelViewStack();
|
||||
stack.loadIdentity();
|
||||
stack.translate(0, 0, -2000);
|
||||
|
|
|
@ -25,16 +25,13 @@
|
|||
package reborncore.client;
|
||||
|
||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
|
||||
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
|
||||
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
|
||||
import net.fabricmc.fabric.api.resource.ResourceReloadListenerKeys;
|
||||
import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
import net.minecraft.resource.ResourceType;
|
||||
import net.minecraft.screen.PlayerScreenHandler;
|
||||
import net.minecraft.util.Identifier;
|
||||
import reborncore.common.fluid.FluidSettings;
|
||||
import reborncore.common.fluid.RebornFluid;
|
||||
|
@ -45,15 +42,13 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class RebornFluidRenderManager implements ClientSpriteRegistryCallback, SimpleSynchronousResourceReloadListener {
|
||||
public class RebornFluidRenderManager implements SimpleSynchronousResourceReloadListener {
|
||||
|
||||
private static final Map<Fluid, TemporaryLazy<Sprite[]>> spriteMap = new HashMap<>();
|
||||
|
||||
public static void setupClient() {
|
||||
RebornFluidRenderManager rebornFluidRenderManager = new RebornFluidRenderManager();
|
||||
ClientSpriteRegistryCallback.event(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE).register(rebornFluidRenderManager);
|
||||
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(rebornFluidRenderManager);
|
||||
RebornFluidManager.getFluidStream().forEach(RebornFluidRenderManager::setupFluidRenderer);
|
||||
}
|
||||
|
@ -70,14 +65,6 @@ public class RebornFluidRenderManager implements ClientSpriteRegistryCallback, S
|
|||
FluidRenderHandlerRegistry.INSTANCE.register(fluid, (extendedBlockView, blockPos, fluidState) -> sprites.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerSprites(SpriteAtlasTexture spriteAtlasTexture, Registry registry) {
|
||||
Stream.concat(
|
||||
RebornFluidManager.getFluidStream().map(rebornFluid -> rebornFluid.getFluidSettings().getFlowingTexture()),
|
||||
RebornFluidManager.getFluidStream().map(rebornFluid -> rebornFluid.getFluidSettings().getStillTexture())
|
||||
).forEach(registry::register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getFabricId() {
|
||||
return new Identifier("reborncore", "fluid_render_manager");
|
||||
|
|
|
@ -150,7 +150,7 @@ public class RenderUtil {
|
|||
RenderSystem.disableTexture();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder bufferBuilder = tessellator.getBuffer();
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
/*
|
||||
* This file is part of RebornCore, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2021 TeamReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package reborncore.client.gui;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import reborncore.common.util.Color;
|
||||
|
||||
public class GuiButtonCustomTexture extends ButtonWidget {
|
||||
public int textureU;
|
||||
public int textureV;
|
||||
public String textureName;
|
||||
public String linkedPage;
|
||||
public Text name;
|
||||
public String imagePrefix = "techreborn:textures/manual/elements/";
|
||||
public int buttonHeight;
|
||||
public int buttonWidth;
|
||||
public int buttonU;
|
||||
public int buttonV;
|
||||
public int textureH;
|
||||
public int textureW;
|
||||
|
||||
public GuiButtonCustomTexture(int xPos, int yPos, int u, int v, int buttonWidth, int buttonHeight,
|
||||
String textureName, String linkedPage, Text name, int buttonU, int buttonV, int textureH, int textureW, ButtonWidget.PressAction pressAction) {
|
||||
super(xPos, yPos, buttonWidth, buttonHeight, Text.empty(), pressAction);
|
||||
this.textureU = u;
|
||||
this.textureV = v;
|
||||
this.textureName = textureName;
|
||||
this.name = name;
|
||||
this.linkedPage = linkedPage;
|
||||
this.buttonHeight = height;
|
||||
this.buttonWidth = width;
|
||||
this.buttonU = buttonU;
|
||||
this.buttonV = buttonV;
|
||||
this.textureH = textureH;
|
||||
this.textureW = textureW;
|
||||
}
|
||||
|
||||
public void drawButton(MatrixStack matrixStack, MinecraftClient mc, int mouseX, int mouseY) {
|
||||
if (this.visible) {
|
||||
boolean flag = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width
|
||||
&& mouseY < this.y + this.height;
|
||||
RenderSystem.setShaderTexture(0, WIDGETS_TEXTURE);
|
||||
int u = textureU;
|
||||
int v = textureV;
|
||||
|
||||
if (flag) {
|
||||
u += width;
|
||||
matrixStack.push();
|
||||
RenderSystem.setShaderColor(0f, 0f, 0f, 1f);
|
||||
this.drawTexture(matrixStack, this.x, this.y, u, v, width, height);
|
||||
matrixStack.pop();
|
||||
}
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
renderImage(matrixStack, this.x, this.y);
|
||||
drawTextWithShadow(matrixStack, mc.textRenderer, this.name, this.x + 20, this.y + 3,
|
||||
Color.WHITE.getColor());
|
||||
}
|
||||
}
|
||||
|
||||
public void renderImage(MatrixStack matrixStack, int offsetX, int offsetY) {
|
||||
RenderSystem.setShaderTexture(0, new Identifier(imagePrefix + this.textureName + ".png"));
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
|
||||
RenderSystem.setShaderColor(1F, 1F, 1F, 1F);
|
||||
drawTexture(matrixStack, offsetX, offsetY, this.buttonU, this.buttonV, this.textureW, this.textureH);
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* This file is part of RebornCore, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2021 TeamReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package reborncore.client.gui;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.Text;
|
||||
import reborncore.common.util.Color;
|
||||
|
||||
public class GuiButtonItemTexture extends ButtonWidget {
|
||||
|
||||
public int textureU;
|
||||
public int textureV;
|
||||
public ItemStack itemstack;
|
||||
public String LINKED_PAGE;
|
||||
public Text NAME;
|
||||
|
||||
public GuiButtonItemTexture(int xPos, int yPos, int u, int v, int width, int height, ItemStack stack,
|
||||
String linkedPage, Text name, ButtonWidget.PressAction pressAction) {
|
||||
super(xPos, yPos, width, height, Text.empty(), pressAction);
|
||||
textureU = u;
|
||||
textureV = v;
|
||||
itemstack = stack;
|
||||
NAME = name;
|
||||
this.LINKED_PAGE = linkedPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float ticks) {
|
||||
if (this.visible) {
|
||||
MinecraftClient mc = MinecraftClient.getInstance();
|
||||
boolean flag = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width
|
||||
&& mouseY < this.y + this.height;
|
||||
RenderSystem.setShaderTexture(0, WIDGETS_TEXTURE);
|
||||
int u = textureU;
|
||||
int v = textureV;
|
||||
if (flag) {
|
||||
u += mc.textRenderer.getWidth(this.NAME) + 25;
|
||||
v += mc.textRenderer.getWidth(this.NAME) + 25;
|
||||
matrixStack.push();
|
||||
RenderSystem.setShaderColor(0f, 0f, 0f, 1f);
|
||||
this.drawTexture(matrixStack, this.x, this.y, u, v, mc.textRenderer.getWidth(this.NAME) + 25, height);
|
||||
matrixStack.pop();
|
||||
}
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
//GL11.glEnable(32826); RESCALE_NORMAL_EXT
|
||||
// DiffuseLighting.enable(); FIXME 1.17
|
||||
ItemRenderer itemRenderer = MinecraftClient.getInstance().getItemRenderer();
|
||||
itemRenderer.renderGuiItemIcon(itemstack, this.x, this.y);
|
||||
this.drawTextWithShadow(matrixStack, mc.textRenderer, this.NAME, this.x + 20, this.y + 3,
|
||||
Color.WHITE.getColor());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -278,7 +278,8 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
|
|||
for (Selectable selectable : selectables) {
|
||||
if (selectable instanceof ClickableWidget clickable) {
|
||||
if (clickable.isHovered()) {
|
||||
clickable.renderTooltip(matrixStack, mouseX, mouseY);
|
||||
// TODO 1.19.3
|
||||
// clickable.renderTooltip(matrixStack, mouseX, mouseY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,9 +37,9 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.screen.PlayerScreenHandler;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import net.minecraft.world.World;
|
||||
import org.joml.Quaternionf;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.client.ClientNetworkManager;
|
||||
import reborncore.client.gui.GuiUtil;
|
||||
|
@ -75,12 +75,12 @@ public class FluidConfigPopupElement extends ElementBase {
|
|||
BlockRenderManager dispatcher = MinecraftClient.getInstance().getBlockRenderManager();
|
||||
BakedModel model = dispatcher.getModels().getModel(state.getBlock().getDefaultState());
|
||||
MinecraftClient.getInstance().getTextureManager().bindTexture(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 4, 23, Vec3f.POSITIVE_Y.getDegreesQuaternion(90F)); //left
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 4, Vec3f.NEGATIVE_X.getDegreesQuaternion(90F)); //top
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 4, 23, RotationAxis.POSITIVE_Y.rotationDegrees(90F)); //left
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 4, RotationAxis.NEGATIVE_X.rotationDegrees(90F)); //top
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 23, null); //centre
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 26, Vec3f.POSITIVE_X.getDegreesQuaternion(90F)); //bottom
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 42, 23, Vec3f.POSITIVE_Y.getDegreesQuaternion(90F)); //right
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 26, 42, Vec3f.POSITIVE_Y.getDegreesQuaternion(180F)); //back
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 26, RotationAxis.POSITIVE_X.rotationDegrees(90F)); //bottom
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 42, 23, RotationAxis.POSITIVE_Y.rotationDegrees(90F)); //right
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 26, 42, RotationAxis.POSITIVE_Y.rotationDegrees(180F)); //back
|
||||
|
||||
drawSateColor(matrixStack, gui.getMachine(), MachineFacing.UP.getFacing(machine), 22, -1, gui);
|
||||
drawSateColor(matrixStack, gui.getMachine(), MachineFacing.FRONT.getFacing(machine), 22, 18, gui);
|
||||
|
@ -178,7 +178,7 @@ public class FluidConfigPopupElement extends ElementBase {
|
|||
BlockRenderManager dispatcher,
|
||||
int x,
|
||||
int y,
|
||||
Quaternion quaternion) {
|
||||
Quaternionf quaternion) {
|
||||
|
||||
MatrixStack matrixStack = new MatrixStack();
|
||||
matrixStack.push();
|
||||
|
|
|
@ -37,9 +37,9 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.screen.PlayerScreenHandler;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import net.minecraft.world.World;
|
||||
import org.joml.Quaternionf;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.client.ClientNetworkManager;
|
||||
import reborncore.client.gui.GuiUtil;
|
||||
|
@ -79,12 +79,12 @@ public class SlotConfigPopupElement extends ElementBase {
|
|||
BlockRenderManager dispatcher = MinecraftClient.getInstance().getBlockRenderManager();
|
||||
BakedModel model = dispatcher.getModels().getModel(state.getBlock().getDefaultState());
|
||||
MinecraftClient.getInstance().getTextureManager().bindTexture(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 4, 23, Vec3f.POSITIVE_Y.getDegreesQuaternion(90F)); //left
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 4, Vec3f.NEGATIVE_X.getDegreesQuaternion(90F)); //top
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 4, 23, RotationAxis.POSITIVE_Y.rotationDegrees(90F)); //left
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 4, RotationAxis.NEGATIVE_X.rotationDegrees(90F)); //top
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 23, null); //centre
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 26, Vec3f.POSITIVE_X.getDegreesQuaternion(90F)); //bottom
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 42, 23, Vec3f.POSITIVE_Y.getDegreesQuaternion(90F)); //right
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 26, 42, Vec3f.POSITIVE_Y.getDegreesQuaternion(180F)); //back
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 26, RotationAxis.POSITIVE_X.rotationDegrees(90F)); //bottom
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 42, 23, RotationAxis.POSITIVE_Y.rotationDegrees(90F)); //right
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 26, 42, RotationAxis.POSITIVE_Y.rotationDegrees(180F)); //back
|
||||
|
||||
drawSlotSateColor(matrixStack, gui.getMachine(), MachineFacing.UP.getFacing(machine), id, 22, -1, gui);
|
||||
drawSlotSateColor(matrixStack, gui.getMachine(), MachineFacing.FRONT.getFacing(machine), id, 22, 18, gui);
|
||||
|
@ -184,7 +184,7 @@ public class SlotConfigPopupElement extends ElementBase {
|
|||
BlockRenderManager dispatcher,
|
||||
int x,
|
||||
int y,
|
||||
Quaternion quaternion) {
|
||||
Quaternionf quaternion) {
|
||||
|
||||
MatrixStack matrixStack = new MatrixStack();
|
||||
matrixStack.push();
|
||||
|
|
|
@ -25,19 +25,22 @@
|
|||
package reborncore.client.gui.builder.widget;
|
||||
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.text.MutableText;
|
||||
import net.minecraft.text.Text;
|
||||
import reborncore.common.misc.TriConsumer;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class GuiButtonExtended extends ButtonWidget {
|
||||
|
||||
private TriConsumer<GuiButtonExtended, Double, Double> clickHandler;
|
||||
|
||||
public GuiButtonExtended(int x, int y, Text buttonText, ButtonWidget.PressAction pressAction) {
|
||||
super(x, y, 20, 200, buttonText, pressAction);
|
||||
super(x, y, 20, 200, buttonText, pressAction, narrationSupplier());
|
||||
}
|
||||
|
||||
public GuiButtonExtended(int x, int y, int widthIn, int heightIn, Text buttonText, ButtonWidget.PressAction pressAction) {
|
||||
super(x, y, widthIn, heightIn, buttonText, pressAction);
|
||||
super(x, y, widthIn, heightIn, buttonText, pressAction, narrationSupplier());
|
||||
}
|
||||
|
||||
public GuiButtonExtended clickHandler(TriConsumer<GuiButtonExtended, Double, Double> consumer) {
|
||||
|
@ -52,4 +55,11 @@ public class GuiButtonExtended extends ButtonWidget {
|
|||
}
|
||||
super.onClick(mouseX, mouseY);
|
||||
}
|
||||
|
||||
private static NarrationSupplier narrationSupplier() {
|
||||
return textSupplier -> {
|
||||
// TODO 1.19.3
|
||||
return null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class GuiButtonSimple extends ButtonWidget {
|
|||
*/
|
||||
@Deprecated
|
||||
public GuiButtonSimple(int x, int y, Text buttonText, ButtonWidget.PressAction pressAction) {
|
||||
super(x, y, 20, 200, buttonText, pressAction);
|
||||
super(x, y, 20, 200, buttonText, pressAction, narrationSupplier());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,6 +42,13 @@ public class GuiButtonSimple extends ButtonWidget {
|
|||
*/
|
||||
@Deprecated
|
||||
public GuiButtonSimple(int x, int y, int widthIn, int heightIn, Text buttonText, ButtonWidget.PressAction pressAction) {
|
||||
super(x, y, widthIn, heightIn, buttonText, pressAction);
|
||||
super(x, y, widthIn, heightIn, buttonText, pressAction, narrationSupplier());
|
||||
}
|
||||
|
||||
private static NarrationSupplier narrationSupplier() {
|
||||
return textSupplier -> {
|
||||
// TODO 1.19.3
|
||||
return null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,16 +50,16 @@ public class GuiButtonUpDown extends GuiButtonExtended {
|
|||
RenderSystem.setShaderTexture(0, gui.builder.getResourceLocation());
|
||||
switch (type) {
|
||||
case FASTFORWARD:
|
||||
gui.drawTexture(matrixStack, x, y, 174, 74, 12, 12);
|
||||
gui.drawTexture(matrixStack, getX(), getY(), 174, 74, 12, 12);
|
||||
break;
|
||||
case FORWARD:
|
||||
gui.drawTexture(matrixStack, x, y, 174, 86, 12, 12);
|
||||
gui.drawTexture(matrixStack, getX(), getY(), 174, 86, 12, 12);
|
||||
break;
|
||||
case REWIND:
|
||||
gui.drawTexture(matrixStack, x, y, 174, 98, 12, 12);
|
||||
gui.drawTexture(matrixStack, getX(), getY(), 174, 98, 12, 12);
|
||||
break;
|
||||
case FASTREWIND:
|
||||
gui.drawTexture(matrixStack, x, y, 174, 110, 12, 12);
|
||||
gui.drawTexture(matrixStack, getX(), getY(), 174, 110, 12, 12);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* This file is part of RebornCore, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2021 TeamReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package reborncore.client.gui.componets;
|
||||
|
||||
public class BaseTextures {
|
||||
//
|
||||
// private static final ResourceLocation baseTexture = new ResourceLocation("reborncore", "textures/gui/base.png");
|
||||
//
|
||||
// public GuiTexture background;
|
||||
// public GuiTexture slot;
|
||||
// public GuiTexture burnBase;
|
||||
// public GuiTexture burnOverlay;
|
||||
// public GuiTexture powerBase;
|
||||
// public GuiTexture powerOverlay;
|
||||
// public GuiTexture progressBase;
|
||||
// public GuiTexture progressOverlay;
|
||||
// public GuiTexture tank;
|
||||
// public GuiTexture tankBase;
|
||||
// public GuiTexture tankScale;
|
||||
// public GuiTexture powerBaseOld;
|
||||
// public GuiTexture powerOverlayOld;
|
||||
//
|
||||
// public BaseTextures()
|
||||
// {
|
||||
// background = new GuiTexture(baseTexture, 176, 166, 0, 0);
|
||||
// slot = new GuiTexture(baseTexture, 18, 18, 176, 31);
|
||||
// burnBase = new GuiTexture(baseTexture, 14, 14, 176, 0);
|
||||
// burnOverlay = new GuiTexture(baseTexture, 13, 13, 176, 50);
|
||||
// powerBase = new GuiTexture(baseTexture, 7, 13, 190, 0);
|
||||
// powerOverlay = new GuiTexture(baseTexture, 7, 13, 197, 0);
|
||||
// progressBase = new GuiTexture(baseTexture, 22, 15, 200, 14);
|
||||
// progressOverlay = new GuiTexture(baseTexture, 22, 16, 177, 14);
|
||||
// tank = new GuiTexture(baseTexture, 20, 55, 176, 63);
|
||||
// tankBase = new GuiTexture(baseTexture, 20, 55, 196, 63);
|
||||
// tankScale = new GuiTexture(baseTexture, 20, 55, 216, 63);
|
||||
// powerBaseOld = new GuiTexture(baseTexture, 32, 17, 224, 13);
|
||||
// powerOverlayOld = new GuiTexture(baseTexture, 32, 17, 224, 30);
|
||||
// }
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* This file is part of RebornCore, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2021 TeamReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package reborncore.client.gui.componets;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public class GuiHiddenButton extends ButtonWidget {
|
||||
|
||||
public GuiHiddenButton(int xPosition, int yPosition, Text displayString) {
|
||||
super(xPosition, yPosition, 0, 0, displayString, var1 -> {
|
||||
});
|
||||
}
|
||||
|
||||
public GuiHiddenButton(int id, int xPosition, int yPosition, int width, int height, Text displayString) {
|
||||
super(xPosition, yPosition, width, height, displayString, var1 -> {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
if (this.visible) {
|
||||
TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||
RenderSystem.setShaderTexture(0, WIDGETS_TEXTURE);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.hovered = mouseX >= this.x && mouseY >= this.y
|
||||
&& mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFuncSeparate(770, 771, 1, 0);
|
||||
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
|
||||
int l = 14737632;
|
||||
|
||||
if (!this.active) {
|
||||
l = 10526880;
|
||||
} else if (this.isHovered()) {
|
||||
l = 16777120;
|
||||
}
|
||||
|
||||
this.drawTextWithShadow(matrixStack, textRenderer, this.getMessage(), this.x + this.width / 2,
|
||||
this.y + (this.height - 8) / 2, l);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -721,7 +721,7 @@ public class GuiBuilder {
|
|||
int color = FluidVariantRendering.getColor(fluid.getVariant());
|
||||
|
||||
final int drawHeight = (int) (fluid.getAmount().getRawValue() / (maxCapacity * 1F) * height);
|
||||
final int iconHeight = sprite.getHeight();
|
||||
final int iconHeight = sprite.getContents().getHeight();
|
||||
int offsetHeight = drawHeight;
|
||||
|
||||
RenderSystem.setShaderColor((color >> 16 & 255) / 255.0F, (float) (color >> 8 & 255) / 255.0F, (float) (color & 255) / 255.0F, 1F);
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"sources": [
|
||||
{
|
||||
"type": "single",
|
||||
"resource": "reborncore:gui/slot_sprites/armour_head"
|
||||
},
|
||||
{
|
||||
"type": "single",
|
||||
"resource": "reborncore:gui/slot_sprites/armour_chest"
|
||||
},
|
||||
{
|
||||
"type": "single",
|
||||
"resource": "reborncore:gui/slot_sprites/armour_legs"
|
||||
},
|
||||
{
|
||||
"type": "single",
|
||||
"resource": "reborncore:gui/slot_sprites/armour_feet"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue