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:
modmuss50 2022-12-07 16:28:29 +00:00 committed by GitHub
parent 7b7fba96c5
commit 573ba92920
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
162 changed files with 2049 additions and 1265 deletions

View file

@ -17,7 +17,7 @@ curseforge {
id = "237903"
changelog = ENV.CHANGELOG ?: "No changelog provided"
releaseType = ENV.RELEASE_CHANNEL ?: "release"
addGameVersion "1.19.2"
addGameVersion "1.19.3"
addGameVersion "Fabric"
mainArtifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"))

View file

@ -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());

View file

@ -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();
}

View file

@ -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);

View file

@ -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");

View file

@ -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();

View file

@ -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();
}
}

View file

@ -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());
}
}
}

View file

@ -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;
}
}

View file

@ -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();

View file

@ -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();

View file

@ -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;
};
}
}

View file

@ -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;
};
}
}

View file

@ -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;

View file

@ -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);
// }
}

View file

@ -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);
}
}
}

View file

@ -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);

View file

@ -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"
}
]
}

View file

@ -27,8 +27,9 @@ package reborncore;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registry;
import org.apache.commons.lang3.Validate;
import java.util.HashMap;
@ -49,15 +50,15 @@ public class RebornRegistry {
* @param name {@link Identifier} Registry name for block and item
*/
public static void registerBlock(Block block, Item.Settings builder, Identifier name) {
Registry.register(Registry.BLOCK, name, block);
Registry.register(Registries.BLOCK, name, block);
BlockItem itemBlock = new BlockItem(block, builder);
Registry.register(Registry.ITEM, name, itemBlock);
Registry.register(Registries.ITEM, name, itemBlock);
}
public static void registerBlock(Block block, Function<Block, BlockItem> blockItemFunction, Identifier name) {
Registry.register(Registry.BLOCK, name, block);
Registry.register(Registries.BLOCK, name, block);
BlockItem itemBlock = blockItemFunction.apply(block);
Registry.register(Registry.ITEM, name, itemBlock);
Registry.register(Registries.ITEM, name, itemBlock);
}
/**
@ -86,7 +87,7 @@ public class RebornRegistry {
*/
public static void registerBlockNoItem(Block block) {
Validate.isTrue(objIdentMap.containsKey(block));
Registry.register(Registry.BLOCK, objIdentMap.get(block), block);
Registry.register(Registries.BLOCK, objIdentMap.get(block), block);
}
@ -97,7 +98,7 @@ public class RebornRegistry {
* @param name {@link Identifier} Registry name for item
*/
public static void registerItem(Item item, Identifier name) {
Registry.register(Registry.ITEM, name, item);
Registry.register(Registries.ITEM, name, item);
}
/**

View file

@ -38,13 +38,14 @@ import net.minecraft.command.argument.EntityArgumentType;
import net.minecraft.command.argument.ItemStackArgumentType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerChunkManager;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.Text;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registry;
import net.minecraft.world.chunk.ChunkStatus;
import reborncore.common.network.ClientBoundPackets;
import reborncore.common.network.IdentifiedPacket;
@ -157,9 +158,9 @@ public class RebornCoreCommands {
private static int renderMod(CommandContext<ServerCommandSource> ctx) {
String modid = StringArgumentType.getString(ctx, "modid");
List<ItemStack> list = Registry.ITEM.getIds().stream()
List<ItemStack> list = Registries.ITEM.getIds().stream()
.filter(identifier -> identifier.getNamespace().equals(modid))
.map(Registry.ITEM::get)
.map(Registries.ITEM::get)
.map(ItemStack::new)
.collect(Collectors.toList());

View file

@ -36,7 +36,7 @@ import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.registry.RegistryKey;
import net.minecraft.world.PersistentState;
import net.minecraft.world.World;
import org.apache.commons.lang3.StringUtils;

View file

@ -32,9 +32,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registry;
import net.minecraft.world.World;
import reborncore.RebornCore;
import reborncore.api.recipe.IRecipeCrafterProvider;
@ -63,7 +64,7 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
@Override
public ItemStack createIcon() {
Optional<Item> catalyst = Registry.ITEM.getOrEmpty(type.name());
Optional<Item> catalyst = Registries.ITEM.getOrEmpty(type.name());
if (catalyst.isPresent())
return new ItemStack(catalyst.get());
else

View file

@ -24,8 +24,9 @@
package reborncore.common.crafting;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registry;
import reborncore.common.crafting.serde.RebornRecipeSerde;
import reborncore.common.crafting.serde.RecipeSerde;
@ -49,8 +50,8 @@ public class RecipeManager {
RebornRecipeType<R> type = new RebornRecipeType<>(recipeSerde, name);
recipeTypes.put(name, type);
Registry.register(Registry.RECIPE_TYPE, name, type);
Registry.register(Registry.RECIPE_SERIALIZER, name, type);
Registry.register(Registries.RECIPE_TYPE, name, type);
Registry.register(Registries.RECIPE_SERIALIZER, name, type);
return type;
}

View file

@ -37,10 +37,11 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtOps;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registry;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;
import reborncore.common.util.DefaultedListCollector;
@ -64,7 +65,7 @@ public class RecipeUtils {
private static ItemStack deserializeItem(JsonObject jsonObject) {
Identifier resourceLocation = new Identifier(JsonHelper.getString(jsonObject, "item"));
Item item = Registry.ITEM.get(resourceLocation);
Item item = Registries.ITEM.get(resourceLocation);
if (item == Items.AIR) {
throw new IllegalStateException(resourceLocation + " did not exist");
}

View file

@ -29,10 +29,11 @@ import com.google.gson.JsonObject;
import net.minecraft.item.Item;
import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.ShapedRecipe;
import net.minecraft.tag.TagKey;
import net.minecraft.registry.Registries;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.registry.Registry;
import net.minecraft.registry.entry.RegistryEntry;
import java.util.Map;
import java.util.stream.Stream;
@ -61,7 +62,7 @@ public class ShapedRecipeHelper {
for (Item item : items) {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("item", Registry.ITEM.getId(item).toString());
jsonObject.addProperty("item", Registries.ITEM.getId(item).toString());
entries.add(jsonObject);
}
} else {
@ -82,7 +83,7 @@ public class ShapedRecipeHelper {
}
private static Stream<Item> streamItemsFromTag(TagKey<Item> tag) {
return StreamSupport.stream(Registry.ITEM.iterateEntries(tag).spliterator(), false)
return StreamSupport.stream(Registries.ITEM.iterateEntries(tag).spliterator(), false)
.map(RegistryEntry::value);
}
}

View file

@ -34,10 +34,11 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.recipe.Ingredient;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.Lazy;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registry;
import reborncore.common.fluid.container.ItemFluidInfo;
import java.util.ArrayList;
@ -60,7 +61,7 @@ public class FluidIngredient extends RebornIngredient {
this.holders = holders;
this.count = count;
previewStacks = new Lazy<>(() -> Registry.ITEM.stream()
previewStacks = new Lazy<>(() -> Registries.ITEM.stream()
.filter(item -> item instanceof ItemFluidInfo)
.filter(item -> !holders.isPresent() || holders.get().stream().anyMatch(i -> i == item))
.map(item -> ((ItemFluidInfo) item).getFull(fluid))
@ -72,7 +73,7 @@ public class FluidIngredient extends RebornIngredient {
public static RebornIngredient deserialize(JsonObject json) {
Identifier identifier = new Identifier(JsonHelper.getString(json, "fluid"));
Fluid fluid = Registry.FLUID.get(identifier);
Fluid fluid = Registries.FLUID.get(identifier);
if (fluid == Fluids.EMPTY) {
throw new JsonParseException("Fluid could not be found: " + JsonHelper.getString(json, "fluid"));
}
@ -82,7 +83,7 @@ public class FluidIngredient extends RebornIngredient {
if (json.has("holder")) {
if (json.get("holder").isJsonPrimitive()) {
String ident = JsonHelper.getString(json, "holder");
Item item = Registry.ITEM.get(new Identifier(ident));
Item item = Registries.ITEM.get(new Identifier(ident));
if (item == Items.AIR) {
throw new JsonParseException("could not find item:" + ident);
}
@ -92,7 +93,7 @@ public class FluidIngredient extends RebornIngredient {
List<Item> itemList = new ArrayList<>();
for (int i = 0; i < jsonArray.size(); i++) {
String ident = jsonArray.get(i).getAsString();
Item item = Registry.ITEM.get(new Identifier(ident));
Item item = Registries.ITEM.get(new Identifier(ident));
if (item == Items.AIR) {
throw new JsonParseException("could not find item:" + ident);
}
@ -138,14 +139,14 @@ public class FluidIngredient extends RebornIngredient {
@Override
public JsonObject toJson(boolean networkSync) {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("fluid", Registry.FLUID.getId(fluid).toString());
jsonObject.addProperty("fluid", Registries.FLUID.getId(fluid).toString());
if (holders.isPresent()) {
List<Item> holderList = holders.get();
if (holderList.size() == 1) {
jsonObject.addProperty("holder", Registry.ITEM.getId(holderList.get(0)).toString());
jsonObject.addProperty("holder", Registries.ITEM.getId(holderList.get(0)).toString());
} else {
JsonArray holderArray = new JsonArray();
holderList.forEach(item -> holderArray.add(new JsonPrimitive(Registry.ITEM.getId(item).toString())));
holderList.forEach(item -> holderArray.add(new JsonPrimitive(Registries.ITEM.getId(item).toString())));
jsonObject.add("holder", holderArray);
}
}

View file

@ -34,9 +34,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtOps;
import net.minecraft.recipe.Ingredient;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registry;
import org.apache.commons.lang3.Validate;
import java.util.Collections;
@ -62,7 +63,7 @@ public class StackIngredient extends RebornIngredient {
public static RebornIngredient deserialize(JsonObject json) {
Identifier identifier = new Identifier(JsonHelper.getString(json, "item"));
Item item = Registry.ITEM.getOrEmpty(identifier).orElseThrow(() -> new JsonSyntaxException("Unknown item '" + identifier + "'"));
Item item = Registries.ITEM.getOrEmpty(identifier).orElseThrow(() -> new JsonSyntaxException("Unknown item '" + identifier + "'"));
Optional<Integer> stackSize = Optional.empty();
if (json.has("count")) {
@ -137,7 +138,7 @@ public class StackIngredient extends RebornIngredient {
public JsonObject toJson(boolean networkSync) {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("item", Registry.ITEM.getId(stack.getItem()).toString());
jsonObject.addProperty("item", Registries.ITEM.getId(stack.getItem()).toString());
count.ifPresent(integer -> jsonObject.addProperty("count", integer));
if (requireEmptyNbt) {

View file

@ -30,11 +30,13 @@ import com.google.gson.JsonObject;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Ingredient;
import net.minecraft.tag.TagKey;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.registry.Registry;
import net.minecraft.registry.entry.RegistryEntry;
import org.apache.commons.lang3.Validate;
import java.util.ArrayList;
@ -85,16 +87,16 @@ public class TagIngredient extends RebornIngredient {
final JsonArray itemsArray = JsonHelper.getArray(json, "items");
for (JsonElement jsonElement : itemsArray) {
Validate.isTrue(jsonElement.isJsonPrimitive());
Optional<RegistryEntry<Item>> entry = Registry.ITEM.getEntry(jsonElement.getAsInt());
items.add(entry.orElseThrow().value());
Item item = Registries.ITEM.get(jsonElement.getAsInt());
items.add(item);
}
return new Synced(TagKey.of(Registry.ITEM_KEY, tagIdent), count, items);
return new Synced(TagKey.of(RegistryKeys.ITEM, tagIdent), count, items);
}
Identifier identifier = new Identifier(JsonHelper.getString(json, "tag"));
TagKey<Item> tagKey = TagKey.of(Registry.ITEM_KEY, identifier);
TagKey<Item> tagKey = TagKey.of(RegistryKeys.ITEM, identifier);
return new TagIngredient(tagKey, count);
}
@ -118,7 +120,7 @@ public class TagIngredient extends RebornIngredient {
JsonArray itemArray = new JsonArray();
for (Item item : items) {
int rawId = Registry.ITEM.getRawId(item);
int rawId = Registries.ITEM.getRawId(item);
itemArray.add(rawId);
}
@ -130,7 +132,7 @@ public class TagIngredient extends RebornIngredient {
}
protected Stream<Item> streamItems() {
return StreamSupport.stream(Registry.ITEM.iterateEntries(tag).spliterator(), false)
return StreamSupport.stream(Registries.ITEM.iterateEntries(tag).spliterator(), false)
.map(RegistryEntry::value);
}

View file

@ -30,8 +30,9 @@ import com.mojang.serialization.Dynamic;
import com.mojang.serialization.JsonOps;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtOps;
import net.minecraft.registry.Registries;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registry;
import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RecipeUtils;
import reborncore.common.crafting.ingredient.IngredientFactory;
@ -72,7 +73,7 @@ public abstract class AbstractRecipeSerde<R extends RebornRecipe> implements Rec
for (ItemStack stack : recipe.getOutputs()) {
final JsonObject stackObject = new JsonObject();
stackObject.addProperty("item", Registry.ITEM.getId(stack.getItem()).toString());
stackObject.addProperty("item", Registries.ITEM.getId(stack.getItem()).toString());
if (stack.getCount() > 1) {
stackObject.addProperty("count", stack.getCount());

View file

@ -27,9 +27,10 @@ package reborncore.common.crafting.serde;
import com.google.gson.JsonObject;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.registry.Registry;
import org.jetbrains.annotations.NotNull;
import reborncore.common.crafting.RebornFluidRecipe;
import reborncore.common.crafting.RebornRecipeType;
@ -46,7 +47,7 @@ public abstract class RebornFluidRecipeSerde<R extends RebornFluidRecipe> extend
protected final R fromJson(JsonObject jsonObject, RebornRecipeType<R> type, Identifier name, List<RebornIngredient> ingredients, List<ItemStack> outputs, int power, int time) {
final JsonObject tank = JsonHelper.getObject(jsonObject, "tank");
final Identifier identifier = new Identifier(JsonHelper.getString(tank, "fluid"));
final Fluid fluid = Registry.FLUID.get(identifier);
final Fluid fluid = Registries.FLUID.get(identifier);
FluidValue value = FluidValue.BUCKET;
if (tank.has("amount")){
@ -61,7 +62,7 @@ public abstract class RebornFluidRecipeSerde<R extends RebornFluidRecipe> extend
@Override
public void collectJsonData(R recipe, JsonObject jsonObject, boolean networkSync) {
final JsonObject tankObject = new JsonObject();
tankObject.addProperty("fluid", Registry.FLUID.getId(recipe.getFluidInstance().getFluid()).toString());
tankObject.addProperty("fluid", Registries.FLUID.getId(recipe.getFluidInstance().getFluid()).toString());
var amountObject = new JsonObject();
amountObject.addProperty("droplets", recipe.getFluidInstance().getAmount().getRawValue());

View file

@ -41,9 +41,10 @@ import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.text.Text;
import net.minecraft.util.Hand;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registry;
import org.jetbrains.annotations.NotNull;
import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.util.Tank;
@ -64,7 +65,7 @@ public class FluidUtils {
}
public static List<Fluid> getAllFluids() {
return Registry.FLUID.stream().collect(Collectors.toList());
return Registries.FLUID.stream().collect(Collectors.toList());
}
public static boolean drainContainers(Tank tank, Inventory inventory, int inputSlot, int outputSlot) {

View file

@ -36,6 +36,7 @@ import net.minecraft.state.StateManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
@ -75,7 +76,7 @@ public abstract class RebornFluid extends FlowableFluid {
}
@Override
protected boolean isInfinite() {
protected boolean isInfinite(World world) {
return false;
}

View file

@ -24,8 +24,9 @@
package reborncore.common.fluid;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registry;
import java.util.HashMap;
import java.util.stream.Stream;
@ -36,7 +37,7 @@ public class RebornFluidManager {
public static void register(RebornFluid rebornFluid, Identifier identifier) {
fluids.put(identifier, rebornFluid);
Registry.register(Registry.FLUID, identifier, rebornFluid);
Registry.register(Registries.FLUID, identifier, rebornFluid);
}
public static HashMap<Identifier, RebornFluid> getFluids() {

View file

@ -28,8 +28,9 @@ import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registry;
import reborncore.common.fluid.FluidValue;
import reborncore.common.util.NBTSerializable;
@ -114,7 +115,7 @@ public class FluidInstance implements NBTSerializable {
@Override
public NbtCompound write() {
NbtCompound tag = new NbtCompound();
tag.putString(FLUID_KEY, Registry.FLUID.getId(fluid).toString());
tag.putString(FLUID_KEY, Registries.FLUID.getId(fluid).toString());
tag.putLong(AMOUNT_KEY, amount.getRawValue());
if (this.tag != null && !this.tag.isEmpty()) {
tag.put(TAG_KEY, this.tag);
@ -124,7 +125,7 @@ public class FluidInstance implements NBTSerializable {
@Override
public void read(NbtCompound tag) {
fluid = Registry.FLUID.get(new Identifier(tag.getString(FLUID_KEY)));
fluid = Registries.FLUID.get(new Identifier(tag.getString(FLUID_KEY)));
amount = FluidValue.fromRaw(tag.getLong(AMOUNT_KEY));
if (tag.contains(TAG_KEY)) {
this.tag = tag.getCompound(TAG_KEY);

View file

@ -24,9 +24,10 @@
package reborncore.common.misc;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
/**
* @author drcrazy
@ -41,6 +42,6 @@ public class ModSounds {
}
private static SoundEvent createSoundEvent(Identifier identifier) {
return Registry.register(Registry.SOUND_EVENT, identifier, new SoundEvent(identifier));
return Registry.register(Registries.SOUND_EVENT, identifier, SoundEvent.of(identifier));
}
}

View file

@ -25,10 +25,10 @@
package reborncore.common.misc;
import net.minecraft.item.Item;
import net.minecraft.tag.TagKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class RebornCoreTags {
public static final TagKey<Item> WATER_EXPLOSION_ITEM = TagKey.of(Registry.ITEM_KEY, new Identifier("reborncore", "water_explosion"));
public static final TagKey<Item> WATER_EXPLOSION_ITEM = TagKey.of(RegistryKeys.ITEM, new Identifier("reborncore", "water_explosion"));
}

View file

@ -26,7 +26,7 @@ package reborncore.common.misc;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.tag.TagKey;
import net.minecraft.registry.tag.TagKey;
import org.jetbrains.annotations.Contract;
/**

View file

@ -30,26 +30,29 @@ import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.recipe.ShapedRecipe;
import net.minecraft.recipe.book.CraftingRecipeCategory;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
import java.util.Map;
public class PaddedShapedRecipe extends ShapedRecipe {
public static final Identifier ID = new Identifier("reborncore", "padded");
public static final RecipeSerializer<ShapedRecipe> PADDED = Registry.register(Registry.RECIPE_SERIALIZER, ID, new Serializer());
public static final RecipeSerializer<ShapedRecipe> PADDED = Registry.register(Registries.RECIPE_SERIALIZER, ID, new Serializer());
public PaddedShapedRecipe(Identifier id, String group, int width, int height, DefaultedList<Ingredient> input, ItemStack output) {
super(id, group, width, height, input, output);
public PaddedShapedRecipe(Identifier id, String group, CraftingRecipeCategory category, int width, int height, DefaultedList<Ingredient> input, ItemStack output) {
super(id, group, category, width, height, input, output);
}
private static class Serializer extends ShapedRecipe.Serializer {
@Override
public PaddedShapedRecipe read(Identifier identifier, JsonObject jsonObject) {
String group = JsonHelper.getString(jsonObject, "group", "");
CraftingRecipeCategory category = CraftingRecipeCategory.CODEC.byId(JsonHelper.getString(jsonObject, "category", null), CraftingRecipeCategory.MISC);
Map<String, Ingredient> map = readSymbols(JsonHelper.getObject(jsonObject, "key"));
String[] strings = getPattern(JsonHelper.getArray(jsonObject, "pattern"));
@ -58,7 +61,7 @@ public class PaddedShapedRecipe extends ShapedRecipe {
DefaultedList<Ingredient> ingredients = createPatternMatrix(strings, map, width, height);
ItemStack output = outputFromJson(JsonHelper.getObject(jsonObject, "result"));
return new PaddedShapedRecipe(identifier, group, width, height, ingredients, output);
return new PaddedShapedRecipe(identifier, group, category, width, height, ingredients, output);
}
}

View file

@ -165,7 +165,7 @@ public class BuiltScreenHandler extends ScreenHandler {
}
@Override
public ItemStack transferSlot(final PlayerEntity player, final int index) {
public ItemStack quickMove(final PlayerEntity player, final int index) {
ItemStack originalStack = ItemStack.EMPTY;

View file

@ -26,11 +26,11 @@ package reborncore.common.util;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
import reborncore.api.ICustomToolHandler;
@ -46,7 +46,7 @@ public class GenericWrenchHelper implements ICustomToolHandler {
@Override
public boolean canHandleTool(ItemStack stack) {
return Registry.ITEM.getId(stack.getItem()).equals(itemLocation);
return Registries.ITEM.getId(stack.getItem()).equals(itemLocation);
}
@Override

View file

@ -32,8 +32,9 @@ import net.fabricmc.fabric.api.transfer.v1.transaction.base.SnapshotParticipant;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registry;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;
@ -123,7 +124,7 @@ public class Tank extends SnapshotParticipant<FluidInstance> implements Syncable
@Override
public void getSyncPair(List<Pair<Supplier<?>, Consumer<?>>> pairList) {
pairList.add(Pair.of(() -> Registry.FLUID.getId(fluidInstance.getFluid()).toString(), (Consumer<String>) o -> fluidInstance.setFluid(Registry.FLUID.get(new Identifier(o)))));
pairList.add(Pair.of(() -> Registries.FLUID.getId(fluidInstance.getFluid()).toString(), (Consumer<String>) o -> fluidInstance.setFluid(Registries.FLUID.get(new Identifier(o)))));
pairList.add(Pair.of(() -> fluidInstance.getAmount(), o -> fluidInstance.setAmount((FluidValue) o)));
}

View file

@ -24,15 +24,20 @@
package reborncore.common.util;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.ItemEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkSectionPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import java.util.List;
@ -89,4 +94,8 @@ public class WorldUtils {
itemStack.setCount(0);
}
}
public static RegistryWrapper<Block> getBlockRegistryWrapper(@Nullable World world) {
return world != null ? world.createCommandRegistryWrapper(RegistryKeys.BLOCK) : Registries.BLOCK.getReadOnlyWrapper();
}
}

View file

@ -29,8 +29,9 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.StringNbtReader;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registry;
import java.lang.reflect.Type;
@ -68,8 +69,8 @@ public class ItemStackSerializer implements JsonSerializer<ItemStack>, JsonDeser
}
}
if (name != null && Registry.ITEM.get(new Identifier(name)) != null) {
ItemStack itemStack = new ItemStack(Registry.ITEM.get(new Identifier(name)), stackSize);
if (name != null && Registries.ITEM.get(new Identifier(name)) != null) {
ItemStack itemStack = new ItemStack(Registries.ITEM.get(new Identifier(name)), stackSize);
itemStack.setNbt(tagCompound);
return itemStack;
}
@ -84,8 +85,8 @@ public class ItemStackSerializer implements JsonSerializer<ItemStack>, JsonDeser
if (src != null && src.getItem() != null) {
JsonObject jsonObject = new JsonObject();
if (Registry.ITEM.getId(src.getItem()) != null) {
jsonObject.addProperty(NAME, Registry.ITEM.getId(src.getItem()).toString());
if (Registries.ITEM.getId(src.getItem()) != null) {
jsonObject.addProperty(NAME, Registries.ITEM.getId(src.getItem()).toString());
} else {
return JsonNull.INSTANCE;
}

View file

@ -50,7 +50,7 @@ public abstract class MixinItemEntity extends Entity {
public void tick(CallbackInfo info) {
if (!world.isClient && isTouchingWater() && !getStack().isEmpty()) {
if (getStack().isIn(RebornCoreTags.WATER_EXPLOSION_ITEM)) {
world.createExplosion(this, getX(), getY(), getZ(), 2F, Explosion.DestructionType.BREAK);
world.createExplosion(this, getX(), getY(), getZ(), 2F, World.ExplosionSourceType.NONE);
this.remove(RemovalReason.KILLED);
}
}

View file

@ -28,11 +28,11 @@
}
],
"depends": {
"fabricloader": ">=0.14.8",
"fabric-api": ">=0.66.0",
"fabricloader": ">=0.14.11",
"fabric-api": ">=0.68.1",
"team_reborn_energy": ">=2.3.0",
"fabric-biome-api-v1": ">=3.0.0",
"minecraft": "~1.19.2"
"minecraft": ">=1.19.3- <1.19.4-"
},
"authors": [
"Team Reborn",

View file

@ -8,7 +8,7 @@ accessible class net/minecraft/recipe/Ingredient$Entry
accessible class net/minecraft/recipe/Ingredient$TagEntry
accessible class net/minecraft/recipe/Ingredient$StackEntry
accessible field net/minecraft/recipe/Ingredient entries [Lnet/minecraft/recipe/Ingredient$Entry;
accessible field net/minecraft/recipe/Ingredient$TagEntry tag Lnet/minecraft/tag/TagKey;
accessible field net/minecraft/recipe/Ingredient$TagEntry tag Lnet/minecraft/registry/tag/TagKey;
accessible method net/minecraft/client/gui/screen/ingame/HandledScreen getSlotAt (DD)Lnet/minecraft/screen/slot/Slot;
@ -16,10 +16,13 @@ accessible method net/minecraft/client/render/WorldRenderer drawShapeOu
accessible method net/minecraft/world/gen/treedecorator/TreeDecoratorType <init> (Lcom/mojang/serialization/Codec;)V
accessible method net/minecraft/client/item/ModelPredicateProviderRegistry register (Lnet/minecraft/item/Item;Lnet/minecraft/util/Identifier;Lnet/minecraft/client/item/UnclampedModelPredicateProvider;)V
accessible field net/minecraft/client/gui/screen/Screen selectables Ljava/util/List;
accessible field net/minecraft/block/FluidBlock fluid Lnet/minecraft/fluid/FlowableFluid;
accessible method net/minecraft/world/gen/foliage/FoliagePlacerType register (Ljava/lang/String;Lcom/mojang/serialization/Codec;)Lnet/minecraft/world/gen/foliage/FoliagePlacerType;
accessible method net/minecraft/recipe/RecipeManager getAllOfType (Lnet/minecraft/recipe/RecipeType;)Ljava/util/Map;
accessible field net/minecraft/screen/ScreenHandler listeners Ljava/util/List;
accessible method net/minecraft/recipe/ShapedRecipe matchesPattern (Lnet/minecraft/inventory/CraftingInventory;IIZ)Z
accessible field net/minecraft/structure/pool/StructurePool elements Lit/unimi/dsi/fastutil/objects/ObjectArrayList;
extendable method net/minecraft/data/server/recipe/RecipeProvider getName ()Ljava/lang/String;