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
|
@ -17,7 +17,7 @@ curseforge {
|
||||||
id = "237903"
|
id = "237903"
|
||||||
changelog = ENV.CHANGELOG ?: "No changelog provided"
|
changelog = ENV.CHANGELOG ?: "No changelog provided"
|
||||||
releaseType = ENV.RELEASE_CHANNEL ?: "release"
|
releaseType = ENV.RELEASE_CHANNEL ?: "release"
|
||||||
addGameVersion "1.19.2"
|
addGameVersion "1.19.3"
|
||||||
addGameVersion "Fabric"
|
addGameVersion "Fabric"
|
||||||
|
|
||||||
mainArtifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"))
|
mainArtifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"))
|
||||||
|
|
|
@ -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.item.v1.ItemTooltipCallback;
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
|
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
|
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.api.blockentity.UnloadHandler;
|
||||||
import reborncore.client.*;
|
import reborncore.client.BlockOutlineRenderer;
|
||||||
import reborncore.common.screen.ScreenIcons;
|
import reborncore.client.ClientBoundPacketHandlers;
|
||||||
|
import reborncore.client.HolidayRenderManager;
|
||||||
|
import reborncore.client.ItemStackRenderer;
|
||||||
|
import reborncore.client.RebornFluidRenderManager;
|
||||||
|
import reborncore.client.StackToolTipHandler;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@ -44,12 +46,6 @@ public class RebornCoreClient implements ClientModInitializer {
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
RebornFluidRenderManager.setupClient();
|
RebornFluidRenderManager.setupClient();
|
||||||
HolidayRenderManager.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();
|
ClientBoundPacketHandlers.init();
|
||||||
HudRenderCallback.EVENT.register(new ItemStackRenderer());
|
HudRenderCallback.EVENT.register(new ItemStackRenderer());
|
||||||
ItemTooltipCallback.EVENT.register(new StackToolTipHandler());
|
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.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.Vec3f;
|
import net.minecraft.util.math.RotationAxis;
|
||||||
import reborncore.common.RebornCoreConfig;
|
import reborncore.common.RebornCoreConfig;
|
||||||
import reborncore.common.util.CalenderUtils;
|
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 yaw = player.prevYaw + (player.getYaw() - player.prevYaw) * tickDelta - (player.prevBodyYaw + (player.bodyYaw - player.prevBodyYaw) * tickDelta);
|
||||||
float pitch = player.prevPitch + (player.getPitch() - player.prevPitch) * tickDelta;
|
float pitch = player.prevPitch + (player.getPitch() - player.prevPitch) * tickDelta;
|
||||||
|
|
||||||
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(yaw));
|
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(yaw));
|
||||||
matrixStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(pitch));
|
matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(pitch));
|
||||||
santaHat.render(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlay(player, 0.0F), 1F, 1F, 1F, 1F);
|
santaHat.render(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlay(player, 0.0F), 1F, 1F, 1F, 1F);
|
||||||
matrixStack.pop();
|
matrixStack.pop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,10 @@ import net.minecraft.client.render.DiffuseLighting;
|
||||||
import net.minecraft.client.texture.NativeImage;
|
import net.minecraft.client.texture.NativeImage;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.Matrix4f;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.util.registry.Registry;
|
import org.joml.Matrix4f;
|
||||||
import org.lwjgl.opengl.GL12;
|
import org.lwjgl.opengl.GL12;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
@ -56,14 +57,15 @@ public class ItemStackRenderer implements HudRenderCallback {
|
||||||
public void onHudRender(MatrixStack matrixStack, float v) {
|
public void onHudRender(MatrixStack matrixStack, float v) {
|
||||||
if (!ItemStackRenderManager.RENDER_QUEUE.isEmpty()) {
|
if (!ItemStackRenderManager.RENDER_QUEUE.isEmpty()) {
|
||||||
ItemStack itemStack = ItemStackRenderManager.RENDER_QUEUE.remove();
|
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);
|
MinecraftClient.getInstance().textRenderer.draw(matrixStack, "Rendering " + id + ", " + ItemStackRenderManager.RENDER_QUEUE.size() + " items left", 5, 5, -1);
|
||||||
export(id, itemStack);
|
export(id, itemStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void export(Identifier identifier, ItemStack item) {
|
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();
|
MatrixStack stack = RenderSystem.getModelViewStack();
|
||||||
stack.loadIdentity();
|
stack.loadIdentity();
|
||||||
stack.translate(0, 0, -2000);
|
stack.translate(0, 0, -2000);
|
||||||
|
|
|
@ -25,16 +25,13 @@
|
||||||
package reborncore.client;
|
package reborncore.client;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
|
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.ResourceManagerHelper;
|
||||||
import net.fabricmc.fabric.api.resource.ResourceReloadListenerKeys;
|
import net.fabricmc.fabric.api.resource.ResourceReloadListenerKeys;
|
||||||
import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
|
import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
|
||||||
import net.minecraft.client.texture.Sprite;
|
import net.minecraft.client.texture.Sprite;
|
||||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.resource.ResourceManager;
|
import net.minecraft.resource.ResourceManager;
|
||||||
import net.minecraft.resource.ResourceType;
|
import net.minecraft.resource.ResourceType;
|
||||||
import net.minecraft.screen.PlayerScreenHandler;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import reborncore.common.fluid.FluidSettings;
|
import reborncore.common.fluid.FluidSettings;
|
||||||
import reborncore.common.fluid.RebornFluid;
|
import reborncore.common.fluid.RebornFluid;
|
||||||
|
@ -45,15 +42,13 @@ import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
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<>();
|
private static final Map<Fluid, TemporaryLazy<Sprite[]>> spriteMap = new HashMap<>();
|
||||||
|
|
||||||
public static void setupClient() {
|
public static void setupClient() {
|
||||||
RebornFluidRenderManager rebornFluidRenderManager = new RebornFluidRenderManager();
|
RebornFluidRenderManager rebornFluidRenderManager = new RebornFluidRenderManager();
|
||||||
ClientSpriteRegistryCallback.event(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE).register(rebornFluidRenderManager);
|
|
||||||
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(rebornFluidRenderManager);
|
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(rebornFluidRenderManager);
|
||||||
RebornFluidManager.getFluidStream().forEach(RebornFluidRenderManager::setupFluidRenderer);
|
RebornFluidManager.getFluidStream().forEach(RebornFluidRenderManager::setupFluidRenderer);
|
||||||
}
|
}
|
||||||
|
@ -70,14 +65,6 @@ public class RebornFluidRenderManager implements ClientSpriteRegistryCallback, S
|
||||||
FluidRenderHandlerRegistry.INSTANCE.register(fluid, (extendedBlockView, blockPos, fluidState) -> sprites.get());
|
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
|
@Override
|
||||||
public Identifier getFabricId() {
|
public Identifier getFabricId() {
|
||||||
return new Identifier("reborncore", "fluid_render_manager");
|
return new Identifier("reborncore", "fluid_render_manager");
|
||||||
|
|
|
@ -150,7 +150,7 @@ public class RenderUtil {
|
||||||
RenderSystem.disableTexture();
|
RenderSystem.disableTexture();
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc();
|
||||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||||
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
BufferBuilder bufferBuilder = tessellator.getBuffer();
|
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) {
|
for (Selectable selectable : selectables) {
|
||||||
if (selectable instanceof ClickableWidget clickable) {
|
if (selectable instanceof ClickableWidget clickable) {
|
||||||
if (clickable.isHovered()) {
|
if (clickable.isHovered()) {
|
||||||
clickable.renderTooltip(matrixStack, mouseX, mouseY);
|
// TODO 1.19.3
|
||||||
|
// clickable.renderTooltip(matrixStack, mouseX, mouseY);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,9 @@ import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.screen.PlayerScreenHandler;
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.math.Quaternion;
|
import net.minecraft.util.math.RotationAxis;
|
||||||
import net.minecraft.util.math.Vec3f;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import org.joml.Quaternionf;
|
||||||
import reborncore.RebornCore;
|
import reborncore.RebornCore;
|
||||||
import reborncore.client.ClientNetworkManager;
|
import reborncore.client.ClientNetworkManager;
|
||||||
import reborncore.client.gui.GuiUtil;
|
import reborncore.client.gui.GuiUtil;
|
||||||
|
@ -75,12 +75,12 @@ public class FluidConfigPopupElement extends ElementBase {
|
||||||
BlockRenderManager dispatcher = MinecraftClient.getInstance().getBlockRenderManager();
|
BlockRenderManager dispatcher = MinecraftClient.getInstance().getBlockRenderManager();
|
||||||
BakedModel model = dispatcher.getModels().getModel(state.getBlock().getDefaultState());
|
BakedModel model = dispatcher.getModels().getModel(state.getBlock().getDefaultState());
|
||||||
MinecraftClient.getInstance().getTextureManager().bindTexture(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
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, 4, 23, RotationAxis.POSITIVE_Y.rotationDegrees(90F)); //left
|
||||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 4, Vec3f.NEGATIVE_X.getDegreesQuaternion(90F)); //top
|
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, 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, 23, 26, RotationAxis.POSITIVE_X.rotationDegrees(90F)); //bottom
|
||||||
drawState(gui, world, model, actualState, pos, dispatcher, 42, 23, Vec3f.POSITIVE_Y.getDegreesQuaternion(90F)); //right
|
drawState(gui, world, model, actualState, pos, dispatcher, 42, 23, RotationAxis.POSITIVE_Y.rotationDegrees(90F)); //right
|
||||||
drawState(gui, world, model, actualState, pos, dispatcher, 26, 42, Vec3f.POSITIVE_Y.getDegreesQuaternion(180F)); //back
|
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.UP.getFacing(machine), 22, -1, gui);
|
||||||
drawSateColor(matrixStack, gui.getMachine(), MachineFacing.FRONT.getFacing(machine), 22, 18, gui);
|
drawSateColor(matrixStack, gui.getMachine(), MachineFacing.FRONT.getFacing(machine), 22, 18, gui);
|
||||||
|
@ -178,7 +178,7 @@ public class FluidConfigPopupElement extends ElementBase {
|
||||||
BlockRenderManager dispatcher,
|
BlockRenderManager dispatcher,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
Quaternion quaternion) {
|
Quaternionf quaternion) {
|
||||||
|
|
||||||
MatrixStack matrixStack = new MatrixStack();
|
MatrixStack matrixStack = new MatrixStack();
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
|
|
|
@ -37,9 +37,9 @@ import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.screen.PlayerScreenHandler;
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.math.Quaternion;
|
import net.minecraft.util.math.RotationAxis;
|
||||||
import net.minecraft.util.math.Vec3f;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import org.joml.Quaternionf;
|
||||||
import reborncore.RebornCore;
|
import reborncore.RebornCore;
|
||||||
import reborncore.client.ClientNetworkManager;
|
import reborncore.client.ClientNetworkManager;
|
||||||
import reborncore.client.gui.GuiUtil;
|
import reborncore.client.gui.GuiUtil;
|
||||||
|
@ -79,12 +79,12 @@ public class SlotConfigPopupElement extends ElementBase {
|
||||||
BlockRenderManager dispatcher = MinecraftClient.getInstance().getBlockRenderManager();
|
BlockRenderManager dispatcher = MinecraftClient.getInstance().getBlockRenderManager();
|
||||||
BakedModel model = dispatcher.getModels().getModel(state.getBlock().getDefaultState());
|
BakedModel model = dispatcher.getModels().getModel(state.getBlock().getDefaultState());
|
||||||
MinecraftClient.getInstance().getTextureManager().bindTexture(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
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, 4, 23, RotationAxis.POSITIVE_Y.rotationDegrees(90F)); //left
|
||||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 4, Vec3f.NEGATIVE_X.getDegreesQuaternion(90F)); //top
|
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, 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, 23, 26, RotationAxis.POSITIVE_X.rotationDegrees(90F)); //bottom
|
||||||
drawState(gui, world, model, actualState, pos, dispatcher, 42, 23, Vec3f.POSITIVE_Y.getDegreesQuaternion(90F)); //right
|
drawState(gui, world, model, actualState, pos, dispatcher, 42, 23, RotationAxis.POSITIVE_Y.rotationDegrees(90F)); //right
|
||||||
drawState(gui, world, model, actualState, pos, dispatcher, 26, 42, Vec3f.POSITIVE_Y.getDegreesQuaternion(180F)); //back
|
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.UP.getFacing(machine), id, 22, -1, gui);
|
||||||
drawSlotSateColor(matrixStack, gui.getMachine(), MachineFacing.FRONT.getFacing(machine), id, 22, 18, gui);
|
drawSlotSateColor(matrixStack, gui.getMachine(), MachineFacing.FRONT.getFacing(machine), id, 22, 18, gui);
|
||||||
|
@ -184,7 +184,7 @@ public class SlotConfigPopupElement extends ElementBase {
|
||||||
BlockRenderManager dispatcher,
|
BlockRenderManager dispatcher,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
Quaternion quaternion) {
|
Quaternionf quaternion) {
|
||||||
|
|
||||||
MatrixStack matrixStack = new MatrixStack();
|
MatrixStack matrixStack = new MatrixStack();
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
|
|
|
@ -25,19 +25,22 @@
|
||||||
package reborncore.client.gui.builder.widget;
|
package reborncore.client.gui.builder.widget;
|
||||||
|
|
||||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||||
|
import net.minecraft.text.MutableText;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import reborncore.common.misc.TriConsumer;
|
import reborncore.common.misc.TriConsumer;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class GuiButtonExtended extends ButtonWidget {
|
public class GuiButtonExtended extends ButtonWidget {
|
||||||
|
|
||||||
private TriConsumer<GuiButtonExtended, Double, Double> clickHandler;
|
private TriConsumer<GuiButtonExtended, Double, Double> clickHandler;
|
||||||
|
|
||||||
public GuiButtonExtended(int x, int y, Text buttonText, ButtonWidget.PressAction pressAction) {
|
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) {
|
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) {
|
public GuiButtonExtended clickHandler(TriConsumer<GuiButtonExtended, Double, Double> consumer) {
|
||||||
|
@ -52,4 +55,11 @@ public class GuiButtonExtended extends ButtonWidget {
|
||||||
}
|
}
|
||||||
super.onClick(mouseX, mouseY);
|
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
|
@Deprecated
|
||||||
public GuiButtonSimple(int x, int y, Text buttonText, ButtonWidget.PressAction pressAction) {
|
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
|
@Deprecated
|
||||||
public GuiButtonSimple(int x, int y, int widthIn, int heightIn, Text buttonText, ButtonWidget.PressAction pressAction) {
|
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());
|
RenderSystem.setShaderTexture(0, gui.builder.getResourceLocation());
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case FASTFORWARD:
|
case FASTFORWARD:
|
||||||
gui.drawTexture(matrixStack, x, y, 174, 74, 12, 12);
|
gui.drawTexture(matrixStack, getX(), getY(), 174, 74, 12, 12);
|
||||||
break;
|
break;
|
||||||
case FORWARD:
|
case FORWARD:
|
||||||
gui.drawTexture(matrixStack, x, y, 174, 86, 12, 12);
|
gui.drawTexture(matrixStack, getX(), getY(), 174, 86, 12, 12);
|
||||||
break;
|
break;
|
||||||
case REWIND:
|
case REWIND:
|
||||||
gui.drawTexture(matrixStack, x, y, 174, 98, 12, 12);
|
gui.drawTexture(matrixStack, getX(), getY(), 174, 98, 12, 12);
|
||||||
break;
|
break;
|
||||||
case FASTREWIND:
|
case FASTREWIND:
|
||||||
gui.drawTexture(matrixStack, x, y, 174, 110, 12, 12);
|
gui.drawTexture(matrixStack, getX(), getY(), 174, 110, 12, 12);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
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());
|
int color = FluidVariantRendering.getColor(fluid.getVariant());
|
||||||
|
|
||||||
final int drawHeight = (int) (fluid.getAmount().getRawValue() / (maxCapacity * 1F) * height);
|
final int drawHeight = (int) (fluid.getAmount().getRawValue() / (maxCapacity * 1F) * height);
|
||||||
final int iconHeight = sprite.getHeight();
|
final int iconHeight = sprite.getContents().getHeight();
|
||||||
int offsetHeight = drawHeight;
|
int offsetHeight = drawHeight;
|
||||||
|
|
||||||
RenderSystem.setShaderColor((color >> 16 & 255) / 255.0F, (float) (color >> 8 & 255) / 255.0F, (float) (color & 255) / 255.0F, 1F);
|
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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -27,8 +27,9 @@ package reborncore;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
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.Validate;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -49,15 +50,15 @@ public class RebornRegistry {
|
||||||
* @param name {@link Identifier} Registry name for block and item
|
* @param name {@link Identifier} Registry name for block and item
|
||||||
*/
|
*/
|
||||||
public static void registerBlock(Block block, Item.Settings builder, Identifier name) {
|
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);
|
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) {
|
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);
|
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) {
|
public static void registerBlockNoItem(Block block) {
|
||||||
Validate.isTrue(objIdentMap.containsKey(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
|
* @param name {@link Identifier} Registry name for item
|
||||||
*/
|
*/
|
||||||
public static void registerItem(Item item, Identifier name) {
|
public static void registerItem(Item item, Identifier name) {
|
||||||
Registry.register(Registry.ITEM, name, item);
|
Registry.register(Registries.ITEM, name, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -38,13 +38,14 @@ import net.minecraft.command.argument.EntityArgumentType;
|
||||||
import net.minecraft.command.argument.ItemStackArgumentType;
|
import net.minecraft.command.argument.ItemStackArgumentType;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.server.command.CommandManager;
|
import net.minecraft.server.command.CommandManager;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.server.world.ServerChunkManager;
|
import net.minecraft.server.world.ServerChunkManager;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.world.chunk.ChunkStatus;
|
import net.minecraft.world.chunk.ChunkStatus;
|
||||||
import reborncore.common.network.ClientBoundPackets;
|
import reborncore.common.network.ClientBoundPackets;
|
||||||
import reborncore.common.network.IdentifiedPacket;
|
import reborncore.common.network.IdentifiedPacket;
|
||||||
|
@ -157,9 +158,9 @@ public class RebornCoreCommands {
|
||||||
private static int renderMod(CommandContext<ServerCommandSource> ctx) {
|
private static int renderMod(CommandContext<ServerCommandSource> ctx) {
|
||||||
String modid = StringArgumentType.getString(ctx, "modid");
|
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))
|
.filter(identifier -> identifier.getNamespace().equals(modid))
|
||||||
.map(Registry.ITEM::get)
|
.map(Registries.ITEM::get)
|
||||||
.map(ItemStack::new)
|
.map(ItemStack::new)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.ChunkPos;
|
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.PersistentState;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
|
@ -32,9 +32,10 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.recipe.Ingredient;
|
import net.minecraft.recipe.Ingredient;
|
||||||
import net.minecraft.recipe.Recipe;
|
import net.minecraft.recipe.Recipe;
|
||||||
import net.minecraft.recipe.RecipeSerializer;
|
import net.minecraft.recipe.RecipeSerializer;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.collection.DefaultedList;
|
import net.minecraft.util.collection.DefaultedList;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import reborncore.RebornCore;
|
import reborncore.RebornCore;
|
||||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||||
|
@ -63,7 +64,7 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack createIcon() {
|
public ItemStack createIcon() {
|
||||||
Optional<Item> catalyst = Registry.ITEM.getOrEmpty(type.name());
|
Optional<Item> catalyst = Registries.ITEM.getOrEmpty(type.name());
|
||||||
if (catalyst.isPresent())
|
if (catalyst.isPresent())
|
||||||
return new ItemStack(catalyst.get());
|
return new ItemStack(catalyst.get());
|
||||||
else
|
else
|
||||||
|
|
|
@ -24,8 +24,9 @@
|
||||||
|
|
||||||
package reborncore.common.crafting;
|
package reborncore.common.crafting;
|
||||||
|
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
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.RebornRecipeSerde;
|
||||||
import reborncore.common.crafting.serde.RecipeSerde;
|
import reborncore.common.crafting.serde.RecipeSerde;
|
||||||
|
|
||||||
|
@ -49,8 +50,8 @@ public class RecipeManager {
|
||||||
RebornRecipeType<R> type = new RebornRecipeType<>(recipeSerde, name);
|
RebornRecipeType<R> type = new RebornRecipeType<>(recipeSerde, name);
|
||||||
recipeTypes.put(name, type);
|
recipeTypes.put(name, type);
|
||||||
|
|
||||||
Registry.register(Registry.RECIPE_TYPE, name, type);
|
Registry.register(Registries.RECIPE_TYPE, name, type);
|
||||||
Registry.register(Registry.RECIPE_SERIALIZER, name, type);
|
Registry.register(Registries.RECIPE_SERIALIZER, name, type);
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,11 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.nbt.NbtOps;
|
import net.minecraft.nbt.NbtOps;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.JsonHelper;
|
import net.minecraft.util.JsonHelper;
|
||||||
import net.minecraft.util.collection.DefaultedList;
|
import net.minecraft.util.collection.DefaultedList;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import reborncore.common.util.DefaultedListCollector;
|
import reborncore.common.util.DefaultedListCollector;
|
||||||
|
@ -64,7 +65,7 @@ public class RecipeUtils {
|
||||||
|
|
||||||
private static ItemStack deserializeItem(JsonObject jsonObject) {
|
private static ItemStack deserializeItem(JsonObject jsonObject) {
|
||||||
Identifier resourceLocation = new Identifier(JsonHelper.getString(jsonObject, "item"));
|
Identifier resourceLocation = new Identifier(JsonHelper.getString(jsonObject, "item"));
|
||||||
Item item = Registry.ITEM.get(resourceLocation);
|
Item item = Registries.ITEM.get(resourceLocation);
|
||||||
if (item == Items.AIR) {
|
if (item == Items.AIR) {
|
||||||
throw new IllegalStateException(resourceLocation + " did not exist");
|
throw new IllegalStateException(resourceLocation + " did not exist");
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,11 @@ import com.google.gson.JsonObject;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.recipe.Ingredient;
|
import net.minecraft.recipe.Ingredient;
|
||||||
import net.minecraft.recipe.ShapedRecipe;
|
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.JsonHelper;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.util.registry.RegistryEntry;
|
import net.minecraft.registry.entry.RegistryEntry;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
@ -61,7 +62,7 @@ public class ShapedRecipeHelper {
|
||||||
|
|
||||||
for (Item item : items) {
|
for (Item item : items) {
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
jsonObject.addProperty("item", Registry.ITEM.getId(item).toString());
|
jsonObject.addProperty("item", Registries.ITEM.getId(item).toString());
|
||||||
entries.add(jsonObject);
|
entries.add(jsonObject);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -82,7 +83,7 @@ public class ShapedRecipeHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Stream<Item> streamItemsFromTag(TagKey<Item> tag) {
|
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);
|
.map(RegistryEntry::value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,10 +34,11 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.recipe.Ingredient;
|
import net.minecraft.recipe.Ingredient;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.JsonHelper;
|
import net.minecraft.util.JsonHelper;
|
||||||
import net.minecraft.util.Lazy;
|
import net.minecraft.util.Lazy;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import reborncore.common.fluid.container.ItemFluidInfo;
|
import reborncore.common.fluid.container.ItemFluidInfo;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -60,7 +61,7 @@ public class FluidIngredient extends RebornIngredient {
|
||||||
this.holders = holders;
|
this.holders = holders;
|
||||||
this.count = count;
|
this.count = count;
|
||||||
|
|
||||||
previewStacks = new Lazy<>(() -> Registry.ITEM.stream()
|
previewStacks = new Lazy<>(() -> Registries.ITEM.stream()
|
||||||
.filter(item -> item instanceof ItemFluidInfo)
|
.filter(item -> item instanceof ItemFluidInfo)
|
||||||
.filter(item -> !holders.isPresent() || holders.get().stream().anyMatch(i -> i == item))
|
.filter(item -> !holders.isPresent() || holders.get().stream().anyMatch(i -> i == item))
|
||||||
.map(item -> ((ItemFluidInfo) item).getFull(fluid))
|
.map(item -> ((ItemFluidInfo) item).getFull(fluid))
|
||||||
|
@ -72,7 +73,7 @@ public class FluidIngredient extends RebornIngredient {
|
||||||
|
|
||||||
public static RebornIngredient deserialize(JsonObject json) {
|
public static RebornIngredient deserialize(JsonObject json) {
|
||||||
Identifier identifier = new Identifier(JsonHelper.getString(json, "fluid"));
|
Identifier identifier = new Identifier(JsonHelper.getString(json, "fluid"));
|
||||||
Fluid fluid = Registry.FLUID.get(identifier);
|
Fluid fluid = Registries.FLUID.get(identifier);
|
||||||
if (fluid == Fluids.EMPTY) {
|
if (fluid == Fluids.EMPTY) {
|
||||||
throw new JsonParseException("Fluid could not be found: " + JsonHelper.getString(json, "fluid"));
|
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.has("holder")) {
|
||||||
if (json.get("holder").isJsonPrimitive()) {
|
if (json.get("holder").isJsonPrimitive()) {
|
||||||
String ident = JsonHelper.getString(json, "holder");
|
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) {
|
if (item == Items.AIR) {
|
||||||
throw new JsonParseException("could not find item:" + ident);
|
throw new JsonParseException("could not find item:" + ident);
|
||||||
}
|
}
|
||||||
|
@ -92,7 +93,7 @@ public class FluidIngredient extends RebornIngredient {
|
||||||
List<Item> itemList = new ArrayList<>();
|
List<Item> itemList = new ArrayList<>();
|
||||||
for (int i = 0; i < jsonArray.size(); i++) {
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
String ident = jsonArray.get(i).getAsString();
|
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) {
|
if (item == Items.AIR) {
|
||||||
throw new JsonParseException("could not find item:" + ident);
|
throw new JsonParseException("could not find item:" + ident);
|
||||||
}
|
}
|
||||||
|
@ -138,14 +139,14 @@ public class FluidIngredient extends RebornIngredient {
|
||||||
@Override
|
@Override
|
||||||
public JsonObject toJson(boolean networkSync) {
|
public JsonObject toJson(boolean networkSync) {
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
jsonObject.addProperty("fluid", Registry.FLUID.getId(fluid).toString());
|
jsonObject.addProperty("fluid", Registries.FLUID.getId(fluid).toString());
|
||||||
if (holders.isPresent()) {
|
if (holders.isPresent()) {
|
||||||
List<Item> holderList = holders.get();
|
List<Item> holderList = holders.get();
|
||||||
if (holderList.size() == 1) {
|
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 {
|
} else {
|
||||||
JsonArray holderArray = new JsonArray();
|
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);
|
jsonObject.add("holder", holderArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,10 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.nbt.NbtOps;
|
import net.minecraft.nbt.NbtOps;
|
||||||
import net.minecraft.recipe.Ingredient;
|
import net.minecraft.recipe.Ingredient;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.JsonHelper;
|
import net.minecraft.util.JsonHelper;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -62,7 +63,7 @@ public class StackIngredient extends RebornIngredient {
|
||||||
|
|
||||||
public static RebornIngredient deserialize(JsonObject json) {
|
public static RebornIngredient deserialize(JsonObject json) {
|
||||||
Identifier identifier = new Identifier(JsonHelper.getString(json, "item"));
|
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();
|
Optional<Integer> stackSize = Optional.empty();
|
||||||
if (json.has("count")) {
|
if (json.has("count")) {
|
||||||
|
@ -137,7 +138,7 @@ public class StackIngredient extends RebornIngredient {
|
||||||
public JsonObject toJson(boolean networkSync) {
|
public JsonObject toJson(boolean networkSync) {
|
||||||
JsonObject jsonObject = new JsonObject();
|
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));
|
count.ifPresent(integer -> jsonObject.addProperty("count", integer));
|
||||||
|
|
||||||
if (requireEmptyNbt) {
|
if (requireEmptyNbt) {
|
||||||
|
|
|
@ -30,11 +30,13 @@ import com.google.gson.JsonObject;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.recipe.Ingredient;
|
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.Identifier;
|
||||||
import net.minecraft.util.JsonHelper;
|
import net.minecraft.util.JsonHelper;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.util.registry.RegistryEntry;
|
import net.minecraft.registry.entry.RegistryEntry;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -85,16 +87,16 @@ public class TagIngredient extends RebornIngredient {
|
||||||
final JsonArray itemsArray = JsonHelper.getArray(json, "items");
|
final JsonArray itemsArray = JsonHelper.getArray(json, "items");
|
||||||
for (JsonElement jsonElement : itemsArray) {
|
for (JsonElement jsonElement : itemsArray) {
|
||||||
Validate.isTrue(jsonElement.isJsonPrimitive());
|
Validate.isTrue(jsonElement.isJsonPrimitive());
|
||||||
Optional<RegistryEntry<Item>> entry = Registry.ITEM.getEntry(jsonElement.getAsInt());
|
Item item = Registries.ITEM.get(jsonElement.getAsInt());
|
||||||
items.add(entry.orElseThrow().value());
|
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"));
|
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);
|
return new TagIngredient(tagKey, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +120,7 @@ public class TagIngredient extends RebornIngredient {
|
||||||
JsonArray itemArray = new JsonArray();
|
JsonArray itemArray = new JsonArray();
|
||||||
|
|
||||||
for (Item item : items) {
|
for (Item item : items) {
|
||||||
int rawId = Registry.ITEM.getRawId(item);
|
int rawId = Registries.ITEM.getRawId(item);
|
||||||
itemArray.add(rawId);
|
itemArray.add(rawId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +132,7 @@ public class TagIngredient extends RebornIngredient {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Stream<Item> streamItems() {
|
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);
|
.map(RegistryEntry::value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,9 @@ import com.mojang.serialization.Dynamic;
|
||||||
import com.mojang.serialization.JsonOps;
|
import com.mojang.serialization.JsonOps;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NbtOps;
|
import net.minecraft.nbt.NbtOps;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.JsonHelper;
|
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.RebornRecipe;
|
||||||
import reborncore.common.crafting.RecipeUtils;
|
import reborncore.common.crafting.RecipeUtils;
|
||||||
import reborncore.common.crafting.ingredient.IngredientFactory;
|
import reborncore.common.crafting.ingredient.IngredientFactory;
|
||||||
|
@ -72,7 +73,7 @@ public abstract class AbstractRecipeSerde<R extends RebornRecipe> implements Rec
|
||||||
|
|
||||||
for (ItemStack stack : recipe.getOutputs()) {
|
for (ItemStack stack : recipe.getOutputs()) {
|
||||||
final JsonObject stackObject = new JsonObject();
|
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) {
|
if (stack.getCount() > 1) {
|
||||||
stackObject.addProperty("count", stack.getCount());
|
stackObject.addProperty("count", stack.getCount());
|
||||||
|
|
|
@ -27,9 +27,10 @@ package reborncore.common.crafting.serde;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.JsonHelper;
|
import net.minecraft.util.JsonHelper;
|
||||||
import net.minecraft.util.registry.Registry;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import reborncore.common.crafting.RebornFluidRecipe;
|
import reborncore.common.crafting.RebornFluidRecipe;
|
||||||
import reborncore.common.crafting.RebornRecipeType;
|
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) {
|
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 JsonObject tank = JsonHelper.getObject(jsonObject, "tank");
|
||||||
final Identifier identifier = new Identifier(JsonHelper.getString(tank, "fluid"));
|
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;
|
FluidValue value = FluidValue.BUCKET;
|
||||||
if (tank.has("amount")){
|
if (tank.has("amount")){
|
||||||
|
@ -61,7 +62,7 @@ public abstract class RebornFluidRecipeSerde<R extends RebornFluidRecipe> extend
|
||||||
@Override
|
@Override
|
||||||
public void collectJsonData(R recipe, JsonObject jsonObject, boolean networkSync) {
|
public void collectJsonData(R recipe, JsonObject jsonObject, boolean networkSync) {
|
||||||
final JsonObject tankObject = new JsonObject();
|
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();
|
var amountObject = new JsonObject();
|
||||||
amountObject.addProperty("droplets", recipe.getFluidInstance().getAmount().getRawValue());
|
amountObject.addProperty("droplets", recipe.getFluidInstance().getAmount().getRawValue());
|
||||||
|
|
|
@ -41,9 +41,10 @@ import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
import net.minecraft.inventory.Inventory;
|
import net.minecraft.inventory.Inventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import reborncore.common.fluid.container.FluidInstance;
|
import reborncore.common.fluid.container.FluidInstance;
|
||||||
import reborncore.common.util.Tank;
|
import reborncore.common.util.Tank;
|
||||||
|
@ -64,7 +65,7 @@ public class FluidUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Fluid> getAllFluids() {
|
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) {
|
public static boolean drainContainers(Tank tank, Inventory inventory, int inputSlot, int outputSlot) {
|
||||||
|
|
|
@ -36,6 +36,7 @@ import net.minecraft.state.StateManager;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.world.BlockView;
|
import net.minecraft.world.BlockView;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldAccess;
|
import net.minecraft.world.WorldAccess;
|
||||||
import net.minecraft.world.WorldView;
|
import net.minecraft.world.WorldView;
|
||||||
|
|
||||||
|
@ -75,7 +76,7 @@ public abstract class RebornFluid extends FlowableFluid {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isInfinite() {
|
protected boolean isInfinite(World world) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,9 @@
|
||||||
|
|
||||||
package reborncore.common.fluid;
|
package reborncore.common.fluid;
|
||||||
|
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
@ -36,7 +37,7 @@ public class RebornFluidManager {
|
||||||
|
|
||||||
public static void register(RebornFluid rebornFluid, Identifier identifier) {
|
public static void register(RebornFluid rebornFluid, Identifier identifier) {
|
||||||
fluids.put(identifier, rebornFluid);
|
fluids.put(identifier, rebornFluid);
|
||||||
Registry.register(Registry.FLUID, identifier, rebornFluid);
|
Registry.register(Registries.FLUID, identifier, rebornFluid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<Identifier, RebornFluid> getFluids() {
|
public static HashMap<Identifier, RebornFluid> getFluids() {
|
||||||
|
|
|
@ -28,8 +28,9 @@ import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import reborncore.common.fluid.FluidValue;
|
import reborncore.common.fluid.FluidValue;
|
||||||
import reborncore.common.util.NBTSerializable;
|
import reborncore.common.util.NBTSerializable;
|
||||||
|
|
||||||
|
@ -114,7 +115,7 @@ public class FluidInstance implements NBTSerializable {
|
||||||
@Override
|
@Override
|
||||||
public NbtCompound write() {
|
public NbtCompound write() {
|
||||||
NbtCompound tag = new NbtCompound();
|
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());
|
tag.putLong(AMOUNT_KEY, amount.getRawValue());
|
||||||
if (this.tag != null && !this.tag.isEmpty()) {
|
if (this.tag != null && !this.tag.isEmpty()) {
|
||||||
tag.put(TAG_KEY, this.tag);
|
tag.put(TAG_KEY, this.tag);
|
||||||
|
@ -124,7 +125,7 @@ public class FluidInstance implements NBTSerializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(NbtCompound tag) {
|
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));
|
amount = FluidValue.fromRaw(tag.getLong(AMOUNT_KEY));
|
||||||
if (tag.contains(TAG_KEY)) {
|
if (tag.contains(TAG_KEY)) {
|
||||||
this.tag = tag.getCompound(TAG_KEY);
|
this.tag = tag.getCompound(TAG_KEY);
|
||||||
|
|
|
@ -24,9 +24,10 @@
|
||||||
|
|
||||||
package reborncore.common.misc;
|
package reborncore.common.misc;
|
||||||
|
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.sound.SoundEvent;
|
import net.minecraft.sound.SoundEvent;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author drcrazy
|
* @author drcrazy
|
||||||
|
@ -41,6 +42,6 @@ public class ModSounds {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SoundEvent createSoundEvent(Identifier identifier) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,10 @@
|
||||||
package reborncore.common.misc;
|
package reborncore.common.misc;
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
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.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
|
||||||
|
|
||||||
public class RebornCoreTags {
|
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"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ package reborncore.common.misc;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.tag.TagKey;
|
import net.minecraft.registry.tag.TagKey;
|
||||||
import org.jetbrains.annotations.Contract;
|
import org.jetbrains.annotations.Contract;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,26 +30,29 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.recipe.Ingredient;
|
import net.minecraft.recipe.Ingredient;
|
||||||
import net.minecraft.recipe.RecipeSerializer;
|
import net.minecraft.recipe.RecipeSerializer;
|
||||||
import net.minecraft.recipe.ShapedRecipe;
|
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.Identifier;
|
||||||
import net.minecraft.util.JsonHelper;
|
import net.minecraft.util.JsonHelper;
|
||||||
import net.minecraft.util.collection.DefaultedList;
|
import net.minecraft.util.collection.DefaultedList;
|
||||||
import net.minecraft.util.registry.Registry;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class PaddedShapedRecipe extends ShapedRecipe {
|
public class PaddedShapedRecipe extends ShapedRecipe {
|
||||||
public static final Identifier ID = new Identifier("reborncore", "padded");
|
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) {
|
public PaddedShapedRecipe(Identifier id, String group, CraftingRecipeCategory category, int width, int height, DefaultedList<Ingredient> input, ItemStack output) {
|
||||||
super(id, group, width, height, input, output);
|
super(id, group, category, width, height, input, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Serializer extends ShapedRecipe.Serializer {
|
private static class Serializer extends ShapedRecipe.Serializer {
|
||||||
@Override
|
@Override
|
||||||
public PaddedShapedRecipe read(Identifier identifier, JsonObject jsonObject) {
|
public PaddedShapedRecipe read(Identifier identifier, JsonObject jsonObject) {
|
||||||
String group = JsonHelper.getString(jsonObject, "group", "");
|
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"));
|
Map<String, Ingredient> map = readSymbols(JsonHelper.getObject(jsonObject, "key"));
|
||||||
String[] strings = getPattern(JsonHelper.getArray(jsonObject, "pattern"));
|
String[] strings = getPattern(JsonHelper.getArray(jsonObject, "pattern"));
|
||||||
|
|
||||||
|
@ -58,7 +61,7 @@ public class PaddedShapedRecipe extends ShapedRecipe {
|
||||||
|
|
||||||
DefaultedList<Ingredient> ingredients = createPatternMatrix(strings, map, width, height);
|
DefaultedList<Ingredient> ingredients = createPatternMatrix(strings, map, width, height);
|
||||||
ItemStack output = outputFromJson(JsonHelper.getObject(jsonObject, "result"));
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class BuiltScreenHandler extends ScreenHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack transferSlot(final PlayerEntity player, final int index) {
|
public ItemStack quickMove(final PlayerEntity player, final int index) {
|
||||||
|
|
||||||
ItemStack originalStack = ItemStack.EMPTY;
|
ItemStack originalStack = ItemStack.EMPTY;
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,11 @@ package reborncore.common.util;
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.registry.Registry;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import reborncore.api.ICustomToolHandler;
|
import reborncore.api.ICustomToolHandler;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class GenericWrenchHelper implements ICustomToolHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHandleTool(ItemStack stack) {
|
public boolean canHandleTool(ItemStack stack) {
|
||||||
return Registry.ITEM.getId(stack.getItem()).equals(itemLocation);
|
return Registries.ITEM.getId(stack.getItem()).equals(itemLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -32,8 +32,9 @@ import net.fabricmc.fabric.api.transfer.v1.transaction.base.SnapshotParticipant;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
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.Validate;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -123,7 +124,7 @@ public class Tank extends SnapshotParticipant<FluidInstance> implements Syncable
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSyncPair(List<Pair<Supplier<?>, Consumer<?>>> pairList) {
|
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)));
|
pairList.add(Pair.of(() -> fluidInstance.getAmount(), o -> fluidInstance.setAmount((FluidValue) o)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,15 +24,20 @@
|
||||||
|
|
||||||
package reborncore.common.util;
|
package reborncore.common.util;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.ItemEntity;
|
import net.minecraft.entity.ItemEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
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.BlockPos;
|
||||||
import net.minecraft.util.math.ChunkSectionPos;
|
import net.minecraft.util.math.ChunkSectionPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.util.math.random.Random;
|
import net.minecraft.util.math.random.Random;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -89,4 +94,8 @@ public class WorldUtils {
|
||||||
itemStack.setCount(0);
|
itemStack.setCount(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static RegistryWrapper<Block> getBlockRegistryWrapper(@Nullable World world) {
|
||||||
|
return world != null ? world.createCommandRegistryWrapper(RegistryKeys.BLOCK) : Registries.BLOCK.getReadOnlyWrapper();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,9 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.nbt.StringNbtReader;
|
import net.minecraft.nbt.StringNbtReader;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
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) {
|
if (name != null && Registries.ITEM.get(new Identifier(name)) != null) {
|
||||||
ItemStack itemStack = new ItemStack(Registry.ITEM.get(new Identifier(name)), stackSize);
|
ItemStack itemStack = new ItemStack(Registries.ITEM.get(new Identifier(name)), stackSize);
|
||||||
itemStack.setNbt(tagCompound);
|
itemStack.setNbt(tagCompound);
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
@ -84,8 +85,8 @@ public class ItemStackSerializer implements JsonSerializer<ItemStack>, JsonDeser
|
||||||
if (src != null && src.getItem() != null) {
|
if (src != null && src.getItem() != null) {
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
|
|
||||||
if (Registry.ITEM.getId(src.getItem()) != null) {
|
if (Registries.ITEM.getId(src.getItem()) != null) {
|
||||||
jsonObject.addProperty(NAME, Registry.ITEM.getId(src.getItem()).toString());
|
jsonObject.addProperty(NAME, Registries.ITEM.getId(src.getItem()).toString());
|
||||||
} else {
|
} else {
|
||||||
return JsonNull.INSTANCE;
|
return JsonNull.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ public abstract class MixinItemEntity extends Entity {
|
||||||
public void tick(CallbackInfo info) {
|
public void tick(CallbackInfo info) {
|
||||||
if (!world.isClient && isTouchingWater() && !getStack().isEmpty()) {
|
if (!world.isClient && isTouchingWater() && !getStack().isEmpty()) {
|
||||||
if (getStack().isIn(RebornCoreTags.WATER_EXPLOSION_ITEM)) {
|
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);
|
this.remove(RemovalReason.KILLED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,11 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.14.8",
|
"fabricloader": ">=0.14.11",
|
||||||
"fabric-api": ">=0.66.0",
|
"fabric-api": ">=0.68.1",
|
||||||
"team_reborn_energy": ">=2.3.0",
|
"team_reborn_energy": ">=2.3.0",
|
||||||
"fabric-biome-api-v1": ">=3.0.0",
|
"fabric-biome-api-v1": ">=3.0.0",
|
||||||
"minecraft": "~1.19.2"
|
"minecraft": ">=1.19.3- <1.19.4-"
|
||||||
},
|
},
|
||||||
"authors": [
|
"authors": [
|
||||||
"Team Reborn",
|
"Team Reborn",
|
||||||
|
|
|
@ -8,7 +8,7 @@ accessible class net/minecraft/recipe/Ingredient$Entry
|
||||||
accessible class net/minecraft/recipe/Ingredient$TagEntry
|
accessible class net/minecraft/recipe/Ingredient$TagEntry
|
||||||
accessible class net/minecraft/recipe/Ingredient$StackEntry
|
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 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;
|
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/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/client/gui/screen/Screen selectables Ljava/util/List;
|
||||||
accessible field net/minecraft/block/FluidBlock fluid Lnet/minecraft/fluid/FlowableFluid;
|
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/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 method net/minecraft/recipe/RecipeManager getAllOfType (Lnet/minecraft/recipe/RecipeType;)Ljava/util/Map;
|
||||||
accessible field net/minecraft/screen/ScreenHandler listeners Ljava/util/List;
|
accessible field net/minecraft/screen/ScreenHandler listeners Ljava/util/List;
|
||||||
accessible method net/minecraft/recipe/ShapedRecipe matchesPattern (Lnet/minecraft/inventory/CraftingInventory;IIZ)Z
|
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;
|
||||||
|
|
11
build.gradle
11
build.gradle
|
@ -27,6 +27,7 @@ repositories {
|
||||||
includeGroup "dev.architectury"
|
includeGroup "dev.architectury"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
def ENV = System.getenv()
|
def ENV = System.getenv()
|
||||||
|
@ -180,12 +181,12 @@ dependencies {
|
||||||
|
|
||||||
include project(":RebornCore")
|
include project(":RebornCore")
|
||||||
|
|
||||||
optionalClientDependency("dev.architectury:architectury-fabric:${project.arch_version}")
|
optionalClientDependency("dev.architectury:architectury-fabric:${project.arch_version}", false)
|
||||||
optionalClientDependency("me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}")
|
optionalClientDependency("me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}", false)
|
||||||
|
|
||||||
// Use groovy for datagen/gametest, if you are copying this you prob dont want it.
|
// Use groovy for datagen/gametest, if you are copying this you prob dont want it.
|
||||||
gametestImplementation 'org.apache.groovy:groovy:4.0.4'
|
gametestImplementation 'org.apache.groovy:groovy:4.0.6'
|
||||||
datagenImplementation 'org.apache.groovy:groovy:4.0.4'
|
datagenImplementation 'org.apache.groovy:groovy:4.0.6'
|
||||||
|
|
||||||
gametestImplementation ("com.google.truth:truth:1.1.3") {
|
gametestImplementation ("com.google.truth:truth:1.1.3") {
|
||||||
exclude module: "guava"
|
exclude module: "guava"
|
||||||
|
@ -320,7 +321,7 @@ curseforge {
|
||||||
id = "233564"
|
id = "233564"
|
||||||
changelog = ENV.CHANGELOG ?: "No changelog provided"
|
changelog = ENV.CHANGELOG ?: "No changelog provided"
|
||||||
releaseType = ENV.RELEASE_CHANNEL ?: "release"
|
releaseType = ENV.RELEASE_CHANNEL ?: "release"
|
||||||
addGameVersion "1.19.2" // Also update in RebornCore/build.gradle
|
addGameVersion "1.19.3" // Also update in RebornCore/build.gradle
|
||||||
addGameVersion "Fabric"
|
addGameVersion "Fabric"
|
||||||
|
|
||||||
mainArtifact remapJar
|
mainArtifact remapJar
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
org.gradle.jvmargs=-Xmx2G
|
org.gradle.jvmargs=-Xmx2G
|
||||||
|
|
||||||
# Mod properties
|
# Mod properties
|
||||||
mod_version=5.4.0
|
mod_version=5.5.0
|
||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://modmuss50.me/fabric.html
|
# check these on https://modmuss50.me/fabric.html
|
||||||
minecraft_version=1.19.2
|
minecraft_version=1.19.3
|
||||||
yarn_version=1.19.2+build.10
|
yarn_version=1.19.3+build.1
|
||||||
loader_version=0.14.9
|
loader_version=0.14.11
|
||||||
fapi_version=0.66.0+1.19.2
|
fapi_version=0.68.1+1.19.3
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
energy_version=2.3.0
|
energy_version=2.3.0
|
||||||
|
|
|
@ -30,10 +30,11 @@ import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||||
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
|
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
|
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
|
||||||
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
|
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
|
||||||
|
import net.minecraft.client.item.ClampedModelPredicateProvider;
|
||||||
import net.minecraft.client.item.ModelPredicateProviderRegistry;
|
import net.minecraft.client.item.ModelPredicateProviderRegistry;
|
||||||
import net.minecraft.client.item.UnclampedModelPredicateProvider;
|
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
import net.minecraft.client.render.model.BakedModel;
|
import net.minecraft.client.render.model.BakedModel;
|
||||||
|
import net.minecraft.client.render.model.Baker;
|
||||||
import net.minecraft.client.render.model.ModelBakeSettings;
|
import net.minecraft.client.render.model.ModelBakeSettings;
|
||||||
import net.minecraft.client.render.model.ModelLoader;
|
import net.minecraft.client.render.model.ModelLoader;
|
||||||
import net.minecraft.client.render.model.UnbakedModel;
|
import net.minecraft.client.render.model.UnbakedModel;
|
||||||
|
@ -47,8 +48,9 @@ import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import reborncore.client.ClientJumpEvent;
|
import reborncore.client.ClientJumpEvent;
|
||||||
import reborncore.client.gui.builder.GuiBase;
|
import reborncore.client.gui.builder.GuiBase;
|
||||||
|
@ -60,6 +62,7 @@ import techreborn.client.ClientGuiType;
|
||||||
import techreborn.client.ClientboundPacketHandlers;
|
import techreborn.client.ClientboundPacketHandlers;
|
||||||
import techreborn.client.events.ClientJumpHandler;
|
import techreborn.client.events.ClientJumpHandler;
|
||||||
import techreborn.client.events.StackToolTipHandler;
|
import techreborn.client.events.StackToolTipHandler;
|
||||||
|
import techreborn.client.render.BaseDynamicFluidBakedModel;
|
||||||
import techreborn.client.render.DynamicBucketBakedModel;
|
import techreborn.client.render.DynamicBucketBakedModel;
|
||||||
import techreborn.client.render.DynamicCellBakedModel;
|
import techreborn.client.render.DynamicCellBakedModel;
|
||||||
import techreborn.client.render.entitys.CableCoverRenderer;
|
import techreborn.client.render.entitys.CableCoverRenderer;
|
||||||
|
@ -80,6 +83,7 @@ import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class TechRebornClient implements ClientModInitializer {
|
public class TechRebornClient implements ClientModInitializer {
|
||||||
|
|
||||||
|
@ -103,47 +107,15 @@ public class TechRebornClient implements ClientModInitializer {
|
||||||
return JsonUnbakedModel.deserialize("{\"parent\":\"minecraft:item/generated\",\"textures\":{\"layer0\":\"techreborn:item/cell_background\"}}");
|
return JsonUnbakedModel.deserialize("{\"parent\":\"minecraft:item/generated\",\"textures\":{\"layer0\":\"techreborn:item/cell_background\"}}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new UnbakedModel() {
|
return new UnbakedDynamicModel(DynamicCellBakedModel::new);
|
||||||
@Override
|
|
||||||
public Collection<Identifier> getModelDependencies() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<SpriteIdentifier> getTextureDependencies(Function<Identifier, UnbakedModel> unbakedModelGetter, Set<Pair<String, String>> unresolvedTextureReferences) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
|
|
||||||
return new DynamicCellBakedModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
Fluid fluid = Registry.FLUID.get(new Identifier(TechReborn.MOD_ID, modelIdentifier.getPath().split("_bucket")[0]));
|
Fluid fluid = Registries.FLUID.get(new Identifier(TechReborn.MOD_ID, modelIdentifier.getPath().split("_bucket")[0]));
|
||||||
if (modelIdentifier.getPath().endsWith("_bucket") && fluid != Fluids.EMPTY) {
|
if (modelIdentifier.getPath().endsWith("_bucket") && fluid != Fluids.EMPTY) {
|
||||||
if (!RendererAccess.INSTANCE.hasRenderer()) {
|
if (!RendererAccess.INSTANCE.hasRenderer()) {
|
||||||
return JsonUnbakedModel.deserialize("{\"parent\":\"minecraft:item/generated\",\"textures\":{\"layer0\":\"minecraft:item/bucket\"}}");
|
return JsonUnbakedModel.deserialize("{\"parent\":\"minecraft:item/generated\",\"textures\":{\"layer0\":\"minecraft:item/bucket\"}}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new UnbakedModel() {
|
return new UnbakedDynamicModel(DynamicBucketBakedModel::new);
|
||||||
@Override
|
|
||||||
public Collection<Identifier> getModelDependencies() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<SpriteIdentifier> getTextureDependencies(Function<Identifier, UnbakedModel> unbakedModelGetter, Set<Pair<String, String>> unresolvedTextureReferences) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
|
|
||||||
return new DynamicBucketBakedModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -252,13 +224,13 @@ public class TechRebornClient implements ClientModInitializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T extends Item> void registerPredicateProvider(Class<T> itemClass, Identifier identifier, ItemModelPredicateProvider<T> modelPredicateProvider) {
|
private static <T extends Item> void registerPredicateProvider(Class<T> itemClass, Identifier identifier, ItemModelPredicateProvider<T> modelPredicateProvider) {
|
||||||
Registry.ITEM.stream()
|
Registries.ITEM.stream()
|
||||||
.filter(item -> item.getClass().isAssignableFrom(itemClass))
|
.filter(item -> item.getClass().isAssignableFrom(itemClass))
|
||||||
.forEach(item -> ModelPredicateProviderRegistry.register(item, identifier, modelPredicateProvider));
|
.forEach(item -> ModelPredicateProviderRegistry.register(item, identifier, modelPredicateProvider));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Need the item instance in a few places, this makes it easier
|
//Need the item instance in a few places, this makes it easier
|
||||||
private interface ItemModelPredicateProvider<T extends Item> extends UnclampedModelPredicateProvider {
|
private interface ItemModelPredicateProvider<T extends Item> extends ClampedModelPredicateProvider {
|
||||||
|
|
||||||
float call(T item, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity, int seed);
|
float call(T item, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity, int seed);
|
||||||
|
|
||||||
|
@ -268,4 +240,28 @@ public class TechRebornClient implements ClientModInitializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class UnbakedDynamicModel implements UnbakedModel {
|
||||||
|
private final Supplier<BaseDynamicFluidBakedModel> supplier;
|
||||||
|
|
||||||
|
public UnbakedDynamicModel(Supplier<BaseDynamicFluidBakedModel> supplier) {
|
||||||
|
this.supplier = supplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Identifier> getModelDependencies() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setParents(Function<Identifier, UnbakedModel> modelLoader) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public BakedModel bake(Baker baker, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
|
||||||
|
return supplier.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,7 +373,7 @@ public class ReiPlugin implements REIClientPlugin {
|
||||||
final Sprite sprite = handler.getFluidSprites(MinecraftClient.getInstance().world, BlockPos.ORIGIN, fluid.getDefaultState())[0];
|
final Sprite sprite = handler.getFluidSprites(MinecraftClient.getInstance().world, BlockPos.ORIGIN, fluid.getDefaultState())[0];
|
||||||
int color = FluidRenderHandlerRegistry.INSTANCE.get(fluid).getFluidColor(MinecraftClient.getInstance().world, BlockPos.ORIGIN, fluid.getDefaultState());
|
int color = FluidRenderHandlerRegistry.INSTANCE.get(fluid).getFluidColor(MinecraftClient.getInstance().world, BlockPos.ORIGIN, fluid.getDefaultState());
|
||||||
|
|
||||||
final int iconHeight = sprite.getHeight();
|
final int iconHeight = sprite.getContents().getHeight();
|
||||||
int offsetHeight = drawHeight;
|
int offsetHeight = drawHeight;
|
||||||
|
|
||||||
RenderSystem.setShaderColor((color >> 16 & 255) / 255.0F, (float) (color >> 8 & 255) / 255.0F, (float) (color & 255) / 255.0F, 1F);
|
RenderSystem.setShaderColor((color >> 16 & 255) / 255.0F, (float) (color >> 8 & 255) / 255.0F, (float) (color & 255) / 255.0F, 1F);
|
||||||
|
|
|
@ -40,10 +40,11 @@ import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import reborncore.api.IListInfoProvider;
|
import reborncore.api.IListInfoProvider;
|
||||||
import reborncore.common.BaseBlockEntityProvider;
|
import reborncore.common.BaseBlockEntityProvider;
|
||||||
import techreborn.blocks.cable.CableBlock;
|
import techreborn.blocks.cable.CableBlock;
|
||||||
|
@ -135,7 +136,7 @@ public class StackToolTipHandler implements ItemTooltipCallback {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isTRItem(Item item) {
|
private static boolean isTRItem(Item item) {
|
||||||
return Registry.ITEM.getId(item).getNamespace().equals("techreborn");
|
return Registries.ITEM.getId(item).getNamespace().equals("techreborn");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Text getOreDepthText(OreDepth depth) {
|
private static Text getOreDepthText(OreDepth depth) {
|
||||||
|
|
|
@ -53,7 +53,10 @@ public class GuiChunkLoader extends GuiBase<BuiltScreenHandler> {
|
||||||
addDrawableChild(new GuiButtonUpDown(x + 64 + 24, y + 40, this, b -> onClick(-1), UpDownButtonType.REWIND));
|
addDrawableChild(new GuiButtonUpDown(x + 64 + 24, y + 40, this, b -> onClick(-1), UpDownButtonType.REWIND));
|
||||||
addDrawableChild(new GuiButtonUpDown(x + 64 + 36, y + 40, this, b -> onClick(-5), UpDownButtonType.FASTREWIND));
|
addDrawableChild(new GuiButtonUpDown(x + 64 + 36, y + 40, this, b -> onClick(-5), UpDownButtonType.FASTREWIND));
|
||||||
|
|
||||||
addDrawableChild(new ButtonWidget(x + 10, y + 70, 155, 20, Text.literal("Toggle Loaded Chunks"), b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos())));
|
addDrawableChild(ButtonWidget.builder(Text.literal("Toggle Loaded Chunks"), b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos()))
|
||||||
|
.position(x + 10, y + 70)
|
||||||
|
.size(155, 20)
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
|
|
||||||
package techreborn.client.gui;
|
package techreborn.client.gui;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
|
||||||
import net.minecraft.client.gui.widget.TexturedButtonWidget;
|
import net.minecraft.client.gui.widget.TexturedButtonWidget;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
@ -37,7 +35,6 @@ import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||||
import reborncore.common.screen.BuiltScreenHandler;
|
import reborncore.common.screen.BuiltScreenHandler;
|
||||||
import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity;
|
import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity;
|
||||||
import techreborn.packets.ServerboundPackets;
|
import techreborn.packets.ServerboundPackets;
|
||||||
import techreborn.utils.PlayerUtils;
|
|
||||||
|
|
||||||
public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
|
public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
|
||||||
|
|
||||||
|
@ -57,34 +54,35 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
super.init();
|
super.init();
|
||||||
ButtonWidget.TooltipSupplier tooltipSupplier = (button, matrices, mouseX, mouseY) -> {
|
// TODO 1.19.3
|
||||||
PlayerEntity player = MinecraftClient.getInstance().player;
|
// ButtonWidget.TooltipSupplier tooltipSupplier = (button, matrices, mouseX, mouseY) -> {
|
||||||
if (player == null) { return; }
|
// PlayerEntity player = MinecraftClient.getInstance().player;
|
||||||
String message = "Experience: ";
|
// if (player == null) { return; }
|
||||||
|
// String message = "Experience: ";
|
||||||
float furnaceExp = blockEntity.experience;
|
//
|
||||||
if (furnaceExp <= 0) {
|
// float furnaceExp = blockEntity.experience;
|
||||||
message = message + "0";
|
// if (furnaceExp <= 0) {
|
||||||
} else {
|
// message = message + "0";
|
||||||
float expTillLevel = (1.0F - player.experienceProgress) * player.getNextLevelExperience();
|
// } else {
|
||||||
if (furnaceExp <= expTillLevel) {
|
// float expTillLevel = (1.0F - player.experienceProgress) * player.getNextLevelExperience();
|
||||||
int percentage = (int) (blockEntity.experience * 100 / player.getNextLevelExperience());
|
// if (furnaceExp <= expTillLevel) {
|
||||||
message = message + "+"
|
// int percentage = (int) (blockEntity.experience * 100 / player.getNextLevelExperience());
|
||||||
+ (percentage > 0 ? String.valueOf(percentage) : "<1")
|
// message = message + "+"
|
||||||
+ "%";
|
// + (percentage > 0 ? String.valueOf(percentage) : "<1")
|
||||||
} else {
|
// + "%";
|
||||||
int levels = 0;
|
// } else {
|
||||||
furnaceExp -= expTillLevel;
|
// int levels = 0;
|
||||||
while (furnaceExp > 0) {
|
// furnaceExp -= expTillLevel;
|
||||||
furnaceExp -= PlayerUtils.getLevelExperience(player.experienceLevel);
|
// while (furnaceExp > 0) {
|
||||||
++levels;
|
// furnaceExp -= PlayerUtils.getLevelExperience(player.experienceLevel);
|
||||||
}
|
// ++levels;
|
||||||
message = message + "+" + levels + "L";
|
// }
|
||||||
}
|
// message = message + "+" + levels + "L";
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
renderTooltip(matrices, Text.literal(message), mouseX, mouseY);
|
//
|
||||||
};
|
// renderTooltip(matrices, Text.literal(message), mouseX, mouseY);
|
||||||
|
// };
|
||||||
|
|
||||||
addDrawableChild(new TexturedButtonWidget(
|
addDrawableChild(new TexturedButtonWidget(
|
||||||
getGuiLeft() + 116,
|
getGuiLeft() + 116,
|
||||||
|
@ -98,7 +96,6 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
|
||||||
16,
|
16,
|
||||||
16,
|
16,
|
||||||
b -> onClick(),
|
b -> onClick(),
|
||||||
tooltipSupplier,
|
|
||||||
Text.empty()));
|
Text.empty()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.screen.PlayerScreenHandler;
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3f;
|
import net.minecraft.util.math.RotationAxis;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import techreborn.entities.EntityNukePrimed;
|
import techreborn.entities.EntityNukePrimed;
|
||||||
import techreborn.init.TRContent;
|
import techreborn.init.TRContent;
|
||||||
|
@ -69,7 +69,7 @@ public class NukeRenderer extends EntityRenderer<EntityNukePrimed> {
|
||||||
matrixStack.scale(j, j, j);
|
matrixStack.scale(j, j, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-90.0F));
|
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-90.0F));
|
||||||
matrixStack.translate(-0.5D, -0.5D, 0.5D);
|
matrixStack.translate(-0.5D, -0.5D, 0.5D);
|
||||||
TntMinecartEntityRenderer.renderFlashingBlock(blockRenderManager, TRContent.NUKE.getDefaultState(), matrixStack, vertexConsumerProvider, i, entity.getFuse() / 5 % 2 == 0);
|
TntMinecartEntityRenderer.renderFlashingBlock(blockRenderManager, TRContent.NUKE.getDefaultState(), matrixStack, vertexConsumerProvider, i, entity.getFuse() / 5 % 2 == 0);
|
||||||
matrixStack.pop();
|
matrixStack.pop();
|
||||||
|
|
|
@ -35,7 +35,7 @@ import net.minecraft.client.render.model.json.ModelTransformation;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.math.Vec3f;
|
import net.minecraft.util.math.RotationAxis;
|
||||||
import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity;
|
import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +59,7 @@ public class StorageUnitRenderer implements BlockEntityRenderer<StorageUnitBaseB
|
||||||
// Item rendering
|
// Item rendering
|
||||||
matrices.push();
|
matrices.push();
|
||||||
Direction direction = storage.getFacing();
|
Direction direction = storage.getFacing();
|
||||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion((direction.getHorizontal() - 2) * 90F));
|
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees((direction.getHorizontal() - 2) * 90F));
|
||||||
matrices.scale(0.5F, 0.5F, 0.5F);
|
matrices.scale(0.5F, 0.5F, 0.5F);
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case NORTH, WEST -> matrices.translate(1, 1, 0);
|
case NORTH, WEST -> matrices.translate(1, 1, 0);
|
||||||
|
@ -78,7 +78,7 @@ public class StorageUnitRenderer implements BlockEntityRenderer<StorageUnitBaseB
|
||||||
// Render item only on horizontal facing #2183
|
// Render item only on horizontal facing #2183
|
||||||
if (Direction.Type.HORIZONTAL.test(facing) ){
|
if (Direction.Type.HORIZONTAL.test(facing) ){
|
||||||
matrices.translate(0.5, 0.5, 0.5); // Translate center
|
matrices.translate(0.5, 0.5, 0.5); // Translate center
|
||||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-facing.rotateYCounterclockwise().asRotation() + 90)); // Rotate depending on face
|
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-facing.rotateYCounterclockwise().asRotation() + 90)); // Rotate depending on face
|
||||||
matrices.translate(0, 0, -0.505); // Translate forward
|
matrices.translate(0, 0, -0.505); // Translate forward
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.math.Vec3f;
|
import net.minecraft.util.math.RotationAxis;
|
||||||
import techreborn.blockentity.generator.basic.WindMillBlockEntity;
|
import techreborn.blockentity.generator.basic.WindMillBlockEntity;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -58,7 +58,7 @@ public class TurbineRenderer implements BlockEntityRenderer<WindMillBlockEntity>
|
||||||
|
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
matrixStack.translate(0.5, 0, 0.5);
|
matrixStack.translate(0.5, 0, 0.5);
|
||||||
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-facing.rotateYCounterclockwise().asRotation() + 90));
|
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-facing.rotateYCounterclockwise().asRotation() + 90));
|
||||||
matrixStack.translate(0, -1, -0.56);
|
matrixStack.translate(0, -1, -0.56);
|
||||||
|
|
||||||
float spin = blockEntity.bladeAngle + tickDelta * blockEntity.spinSpeed;
|
float spin = blockEntity.bladeAngle + tickDelta * blockEntity.spinSpeed;
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class DestructoPackScreenHandler extends ScreenHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack transferSlot(PlayerEntity player, int index) {
|
public ItemStack quickMove(PlayerEntity player, int index) {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ package techreborn.datagen
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint
|
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||||
|
import net.minecraft.registry.RegistryBuilder
|
||||||
|
import net.minecraft.registry.RegistryKeys
|
||||||
import techreborn.TechReborn
|
import techreborn.TechReborn
|
||||||
import techreborn.datagen.models.BlockLootTableProvider
|
import techreborn.datagen.models.BlockLootTableProvider
|
||||||
import techreborn.datagen.models.ModelProvider
|
import techreborn.datagen.models.ModelProvider
|
||||||
|
@ -42,35 +44,50 @@ import techreborn.datagen.recipes.smelting.SmeltingRecipesProvider
|
||||||
import techreborn.datagen.tags.TRBlockTagProvider
|
import techreborn.datagen.tags.TRBlockTagProvider
|
||||||
import techreborn.datagen.tags.TRItemTagProvider
|
import techreborn.datagen.tags.TRItemTagProvider
|
||||||
import techreborn.datagen.tags.TRPointOfInterestTagProvider
|
import techreborn.datagen.tags.TRPointOfInterestTagProvider
|
||||||
import techreborn.datagen.tags.WaterExplosionTagProvider
|
import techreborn.datagen.worldgen.TRWorldGenBootstrap
|
||||||
|
import techreborn.datagen.worldgen.TRWorldGenProvider
|
||||||
|
|
||||||
class TechRebornDataGen implements DataGeneratorEntrypoint {
|
class TechRebornDataGen implements DataGeneratorEntrypoint {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
|
void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
|
||||||
fabricDataGenerator.addProvider(WaterExplosionTagProvider.&new)
|
def pack = fabricDataGenerator.createPack()
|
||||||
fabricDataGenerator.addProvider(TRItemTagProvider.&new)
|
|
||||||
fabricDataGenerator.addProvider(TRPointOfInterestTagProvider.&new)
|
def add = { FabricDataGenerator.Pack.RegistryDependentFactory factory ->
|
||||||
fabricDataGenerator.addProvider(TRBlockTagProvider.&new)
|
pack.addProvider factory
|
||||||
|
}
|
||||||
|
|
||||||
|
add TRItemTagProvider::new
|
||||||
|
add TRPointOfInterestTagProvider::new
|
||||||
|
|
||||||
|
add TRBlockTagProvider::new
|
||||||
// tags before all else, very important!!
|
// tags before all else, very important!!
|
||||||
fabricDataGenerator.addProvider(SmeltingRecipesProvider.&new)
|
add SmeltingRecipesProvider::new
|
||||||
fabricDataGenerator.addProvider(CraftingRecipesProvider.&new)
|
add CraftingRecipesProvider::new
|
||||||
|
|
||||||
fabricDataGenerator.addProvider(GrinderRecipesProvider.&new)
|
add GrinderRecipesProvider::new
|
||||||
fabricDataGenerator.addProvider(CompressorRecipesProvider.&new)
|
add CompressorRecipesProvider::new
|
||||||
fabricDataGenerator.addProvider(ExtractorRecipesProvider.&new)
|
add ExtractorRecipesProvider::new
|
||||||
fabricDataGenerator.addProvider(ChemicalReactorRecipesProvider.&new)
|
add ChemicalReactorRecipesProvider::new
|
||||||
fabricDataGenerator.addProvider(AssemblingMachineRecipesProvider.&new)
|
add AssemblingMachineRecipesProvider::new
|
||||||
fabricDataGenerator.addProvider(BlastFurnaceRecipesProvider.&new)
|
add BlastFurnaceRecipesProvider::new
|
||||||
fabricDataGenerator.addProvider(IndustrialGrinderRecipesProvider.&new)
|
add IndustrialGrinderRecipesProvider::new
|
||||||
fabricDataGenerator.addProvider(IndustrialSawmillRecipesProvider.&new)
|
add IndustrialSawmillRecipesProvider::new
|
||||||
|
|
||||||
fabricDataGenerator.addProvider(ModelProvider.&new)
|
add ModelProvider::new
|
||||||
fabricDataGenerator.addProvider(BlockLootTableProvider.&new)
|
add BlockLootTableProvider::new
|
||||||
|
|
||||||
|
add TRWorldGenProvider::new
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
String getEffectiveModId() {
|
String getEffectiveModId() {
|
||||||
return TechReborn.MOD_ID
|
return TechReborn.MOD_ID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void buildRegistry(RegistryBuilder registryBuilder) {
|
||||||
|
registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, TRWorldGenBootstrap::configuredFeatures)
|
||||||
|
registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, TRWorldGenBootstrap::placedFeatures)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,20 @@
|
||||||
package techreborn.datagen.models
|
package techreborn.datagen.models
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider
|
||||||
import net.fabricmc.fabric.api.resource.conditions.v1.ConditionJsonProvider
|
import net.minecraft.registry.RegistryWrapper
|
||||||
import net.minecraft.data.DataWriter
|
|
||||||
import net.minecraft.data.server.BlockLootTableGenerator
|
|
||||||
import net.minecraft.loot.LootTable
|
|
||||||
import net.minecraft.util.Identifier
|
|
||||||
import org.jetbrains.annotations.NotNull
|
|
||||||
import techreborn.init.TRContent
|
import techreborn.init.TRContent
|
||||||
|
|
||||||
import java.util.function.BiConsumer
|
import java.util.concurrent.CompletableFuture
|
||||||
import java.util.function.Consumer
|
|
||||||
|
|
||||||
class BlockLootTableProvider extends FabricBlockLootTableProvider{
|
class BlockLootTableProvider extends FabricBlockLootTableProvider{
|
||||||
|
|
||||||
BlockLootTableProvider(FabricDataGenerator dataGenerator) {
|
BlockLootTableProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
super(dataGenerator)
|
super(output)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void generateBlockLootTables() {
|
public void generate() {
|
||||||
TRContent.StorageBlocks.values().each {
|
TRContent.StorageBlocks.values().each {
|
||||||
addDrop(it.getBlock())
|
addDrop(it.getBlock())
|
||||||
addDrop(it.getSlabBlock())
|
addDrop(it.getSlabBlock())
|
||||||
|
|
|
@ -24,19 +24,20 @@
|
||||||
|
|
||||||
package techreborn.datagen.models
|
package techreborn.datagen.models
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider
|
||||||
import net.minecraft.block.Blocks
|
|
||||||
import net.minecraft.data.client.BlockStateModelGenerator
|
import net.minecraft.data.client.BlockStateModelGenerator
|
||||||
import net.minecraft.data.client.ItemModelGenerator
|
import net.minecraft.data.client.ItemModelGenerator
|
||||||
import net.minecraft.data.client.Models
|
import net.minecraft.data.client.Models
|
||||||
import net.minecraft.data.family.BlockFamilies
|
import net.minecraft.data.family.BlockFamilies
|
||||||
import net.minecraft.data.family.BlockFamily
|
import net.minecraft.registry.RegistryWrapper
|
||||||
import techreborn.init.TRContent
|
import techreborn.init.TRContent
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
class ModelProvider extends FabricModelProvider {
|
class ModelProvider extends FabricModelProvider {
|
||||||
ModelProvider(FabricDataGenerator dataGenerator) {
|
ModelProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
super(dataGenerator)
|
super(output)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,13 +24,14 @@
|
||||||
|
|
||||||
package techreborn.datagen.recipes
|
package techreborn.datagen.recipes
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider
|
||||||
import net.minecraft.advancement.criterion.CriterionConditions
|
import net.minecraft.advancement.criterion.CriterionConditions
|
||||||
import net.minecraft.data.server.recipe.RecipeJsonProvider
|
import net.minecraft.data.server.recipe.RecipeJsonProvider
|
||||||
import net.minecraft.item.ItemConvertible
|
import net.minecraft.item.ItemConvertible
|
||||||
import net.minecraft.recipe.Ingredient
|
import net.minecraft.recipe.Ingredient
|
||||||
import net.minecraft.tag.TagKey
|
import net.minecraft.registry.RegistryWrapper
|
||||||
|
import net.minecraft.registry.tag.TagKey
|
||||||
import net.minecraft.util.Identifier
|
import net.minecraft.util.Identifier
|
||||||
import techreborn.datagen.recipes.machine.MachineRecipeJsonFactory
|
import techreborn.datagen.recipes.machine.MachineRecipeJsonFactory
|
||||||
import techreborn.datagen.recipes.machine.blast_furnace.BlastFurnaceRecipeJsonFactory
|
import techreborn.datagen.recipes.machine.blast_furnace.BlastFurnaceRecipeJsonFactory
|
||||||
|
@ -38,23 +39,24 @@ import techreborn.datagen.recipes.machine.industrial_grinder.IndustrialGrinderRe
|
||||||
import techreborn.datagen.recipes.machine.industrial_sawmill.IndustrialSawmillRecipeJsonFactory
|
import techreborn.datagen.recipes.machine.industrial_sawmill.IndustrialSawmillRecipeJsonFactory
|
||||||
import techreborn.init.ModRecipes
|
import techreborn.init.ModRecipes
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
|
|
||||||
abstract class TechRebornRecipesProvider extends FabricRecipeProvider {
|
abstract class TechRebornRecipesProvider extends FabricRecipeProvider {
|
||||||
protected Consumer<RecipeJsonProvider> exporter
|
protected Consumer<RecipeJsonProvider> exporter
|
||||||
TechRebornRecipesProvider(FabricDataGenerator dataGenerator) {
|
TechRebornRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
super(dataGenerator)
|
super(output)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void generateRecipes(Consumer<RecipeJsonProvider> exporter) {
|
final void generate(Consumer<RecipeJsonProvider> exporter) {
|
||||||
this.exporter = exporter
|
this.exporter = exporter
|
||||||
generateRecipes()
|
generateRecipes()
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract void generateRecipes()
|
abstract void generateRecipes()
|
||||||
|
|
||||||
static Ingredient createIngredient(def input) {
|
static Ingredient createIngredient(def input) {
|
||||||
if (input instanceof Ingredient) {
|
if (input instanceof Ingredient) {
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
|
@ -161,4 +163,9 @@ abstract class TechRebornRecipesProvider extends FabricRecipeProvider {
|
||||||
protected Identifier getRecipeIdentifier(Identifier identifier) {
|
protected Identifier getRecipeIdentifier(Identifier identifier) {
|
||||||
return new Identifier("techreborn", super.getRecipeIdentifier(identifier).path)
|
return new Identifier("techreborn", super.getRecipeIdentifier(identifier).path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Recipes / " + getClass().name
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,21 +25,26 @@
|
||||||
package techreborn.datagen.recipes.crafting
|
package techreborn.datagen.recipes.crafting
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||||
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder
|
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder
|
||||||
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder
|
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder
|
||||||
import net.minecraft.data.server.recipe.SingleItemRecipeJsonBuilder
|
import net.minecraft.data.server.recipe.SingleItemRecipeJsonBuilder
|
||||||
import net.minecraft.item.ItemConvertible
|
import net.minecraft.item.ItemConvertible
|
||||||
import net.minecraft.item.Items
|
import net.minecraft.item.Items
|
||||||
|
import net.minecraft.recipe.RecipeSerializer
|
||||||
|
import net.minecraft.recipe.book.RecipeCategory
|
||||||
|
import net.minecraft.registry.RegistryWrapper
|
||||||
import net.minecraft.util.Identifier
|
import net.minecraft.util.Identifier
|
||||||
import techreborn.TechReborn
|
import techreborn.TechReborn
|
||||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||||
import techreborn.init.TRContent
|
import techreborn.init.TRContent
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
import java.util.function.Function
|
import java.util.function.Function
|
||||||
|
|
||||||
class CraftingRecipesProvider extends TechRebornRecipesProvider {
|
class CraftingRecipesProvider extends TechRebornRecipesProvider {
|
||||||
CraftingRecipesProvider(FabricDataGenerator dataGenerator) {
|
CraftingRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
super(dataGenerator)
|
super(output, registriesFuture)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -191,8 +196,8 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
|
||||||
return s.toString()
|
return s.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
def offerMonoShapelessRecipe(def input, int inputSize, ItemConvertible output, int outputSize, String source, prefix = "", String result = null) {
|
def offerMonoShapelessRecipe(def input, int inputSize, ItemConvertible output, int outputSize, String source, prefix = "", String result = null, RecipeCategory category = RecipeCategory.MISC) {
|
||||||
ShapelessRecipeJsonBuilder.create(output, outputSize).input(createIngredient(input), inputSize)
|
new ShapelessRecipeJsonBuilder(category, output, outputSize).input(createIngredient(input), inputSize)
|
||||||
.criterion(getCriterionName(input), getCriterionConditions(input))
|
.criterion(getCriterionName(input), getCriterionConditions(input))
|
||||||
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(prefix, input, output, source, result)))
|
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(prefix, input, output, source, result)))
|
||||||
}
|
}
|
||||||
|
@ -206,14 +211,14 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
|
||||||
return s.toString()
|
return s.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
def static createMonoShapeRecipe(def input, ItemConvertible output, char character, int outputAmount = 1) {
|
def static createMonoShapeRecipe(def input, ItemConvertible output, char character, int outputAmount = 1, RecipeCategory category = RecipeCategory.MISC) {
|
||||||
return ShapedRecipeJsonBuilder.create(output, outputAmount)
|
return new ShapedRecipeJsonBuilder(category, output, outputAmount)
|
||||||
.input(character, createIngredient(input))
|
.input(character, createIngredient(input))
|
||||||
.criterion(getCriterionName(input), getCriterionConditions(input))
|
.criterion(getCriterionName(input), getCriterionConditions(input))
|
||||||
}
|
}
|
||||||
|
|
||||||
def static createDuoShapeRecipe(def input1, def input2, ItemConvertible output, char char1, char char2, boolean crit1 = true, boolean crit2 = false) {
|
def static createDuoShapeRecipe(def input1, def input2, ItemConvertible output, char char1, char char2, boolean crit1 = true, boolean crit2 = false, RecipeCategory category = RecipeCategory.MISC) {
|
||||||
ShapedRecipeJsonBuilder factory = ShapedRecipeJsonBuilder.create(output)
|
ShapedRecipeJsonBuilder factory = ShapedRecipeJsonBuilder.create(category, output)
|
||||||
.input(char1, createIngredient(input1))
|
.input(char1, createIngredient(input1))
|
||||||
.input(char2, createIngredient(input2))
|
.input(char2, createIngredient(input2))
|
||||||
if (crit1)
|
if (crit1)
|
||||||
|
@ -223,8 +228,8 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
|
||||||
return factory
|
return factory
|
||||||
}
|
}
|
||||||
|
|
||||||
def static createStonecutterRecipe(def input, ItemConvertible output, int outputAmount = 1) {
|
def static createStonecutterRecipe(def input, ItemConvertible output, int outputAmount = 1, RecipeCategory category = RecipeCategory.MISC) {
|
||||||
return SingleItemRecipeJsonBuilder.createStonecutting(createIngredient(input), output, outputAmount)
|
return new SingleItemRecipeJsonBuilder(category, RecipeSerializer.STONECUTTING, createIngredient(input), output, outputAmount)
|
||||||
.criterion(getCriterionName(input), getCriterionConditions(input))
|
.criterion(getCriterionName(input), getCriterionConditions(input))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ package techreborn.datagen.recipes.machine
|
||||||
import net.minecraft.item.Item
|
import net.minecraft.item.Item
|
||||||
import net.minecraft.item.ItemConvertible
|
import net.minecraft.item.ItemConvertible
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.tag.TagKey
|
import net.minecraft.registry.tag.TagKey
|
||||||
import net.minecraft.util.Identifier
|
import net.minecraft.util.Identifier
|
||||||
import reborncore.common.crafting.ingredient.RebornIngredient
|
import reborncore.common.crafting.ingredient.RebornIngredient
|
||||||
import reborncore.common.crafting.ingredient.StackIngredient
|
import reborncore.common.crafting.ingredient.StackIngredient
|
||||||
|
|
|
@ -26,6 +26,7 @@ package techreborn.datagen.recipes.machine
|
||||||
|
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import net.fabricmc.fabric.api.resource.conditions.v1.ConditionJsonProvider
|
import net.fabricmc.fabric.api.resource.conditions.v1.ConditionJsonProvider
|
||||||
|
import net.fabricmc.fabric.api.resource.conditions.v1.DefaultResourceConditions
|
||||||
import net.fabricmc.fabric.impl.datagen.FabricDataGenHelper
|
import net.fabricmc.fabric.impl.datagen.FabricDataGenHelper
|
||||||
import net.minecraft.advancement.Advancement.Builder
|
import net.minecraft.advancement.Advancement.Builder
|
||||||
import net.minecraft.advancement.criterion.CriterionConditions
|
import net.minecraft.advancement.criterion.CriterionConditions
|
||||||
|
@ -33,15 +34,16 @@ import net.minecraft.data.server.recipe.RecipeJsonProvider
|
||||||
import net.minecraft.item.ItemConvertible
|
import net.minecraft.item.ItemConvertible
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.recipe.RecipeSerializer
|
import net.minecraft.recipe.RecipeSerializer
|
||||||
import net.minecraft.tag.TagKey
|
import net.minecraft.registry.Registries
|
||||||
|
import net.minecraft.registry.Registry
|
||||||
|
import net.minecraft.registry.tag.TagKey
|
||||||
|
import net.minecraft.resource.featuretoggle.FeatureFlag
|
||||||
import net.minecraft.util.Identifier
|
import net.minecraft.util.Identifier
|
||||||
import net.minecraft.util.registry.Registry
|
|
||||||
import org.jetbrains.annotations.NotNull
|
import org.jetbrains.annotations.NotNull
|
||||||
import reborncore.common.crafting.RebornRecipe
|
import reborncore.common.crafting.RebornRecipe
|
||||||
import reborncore.common.crafting.RebornRecipeType
|
import reborncore.common.crafting.RebornRecipeType
|
||||||
import reborncore.common.crafting.RecipeUtils
|
import reborncore.common.crafting.RecipeUtils
|
||||||
import reborncore.common.crafting.ingredient.RebornIngredient
|
import reborncore.common.crafting.ingredient.RebornIngredient
|
||||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
|
||||||
|
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
|
|
||||||
|
@ -209,10 +211,14 @@ class MachineRecipeJsonFactory<R extends RebornRecipe> {
|
||||||
throw new IllegalStateException("Recipe has no outputs")
|
throw new IllegalStateException("Recipe has no outputs")
|
||||||
}
|
}
|
||||||
|
|
||||||
def outputId = Registry.ITEM.getId(outputs[0].item)
|
def outputId = Registries.ITEM.getId(outputs[0].item)
|
||||||
return new Identifier("techreborn", "${type.name().path}/${outputId.path}${getSourceAppendix()}")
|
return new Identifier("techreborn", "${type.name().path}/${outputId.path}${getSourceAppendix()}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def feature(FeatureFlag flag) {
|
||||||
|
condition(DefaultResourceConditions.featuresEnabled(flag))
|
||||||
|
}
|
||||||
|
|
||||||
static class MachineRecipeJsonProvider<R extends RebornRecipe> implements RecipeJsonProvider {
|
static class MachineRecipeJsonProvider<R extends RebornRecipe> implements RecipeJsonProvider {
|
||||||
private final RebornRecipeType<R> type
|
private final RebornRecipeType<R> type
|
||||||
private final R recipe
|
private final R recipe
|
||||||
|
|
|
@ -24,16 +24,19 @@
|
||||||
|
|
||||||
package techreborn.datagen.recipes.machine.assembling_machine
|
package techreborn.datagen.recipes.machine.assembling_machine
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.item.Items
|
import net.minecraft.item.Items
|
||||||
import net.minecraft.tag.ItemTags
|
import net.minecraft.registry.RegistryWrapper
|
||||||
|
import net.minecraft.registry.tag.ItemTags
|
||||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
class AssemblingMachineRecipesProvider extends TechRebornRecipesProvider {
|
class AssemblingMachineRecipesProvider extends TechRebornRecipesProvider {
|
||||||
|
|
||||||
AssemblingMachineRecipesProvider(FabricDataGenerator dataGenerator) {
|
AssemblingMachineRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
super(dataGenerator)
|
super(output, registriesFuture)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,12 +24,15 @@
|
||||||
|
|
||||||
package techreborn.datagen.recipes.machine.blast_furnace
|
package techreborn.datagen.recipes.machine.blast_furnace
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.item.Items
|
import net.minecraft.item.Items
|
||||||
|
import net.minecraft.registry.RegistryWrapper
|
||||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||||
import techreborn.init.TRContent
|
import techreborn.init.TRContent
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider {
|
class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider {
|
||||||
|
|
||||||
public final int ARMOR_POWER = 128
|
public final int ARMOR_POWER = 128
|
||||||
|
@ -39,8 +42,8 @@ class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider {
|
||||||
public final int TOOL_TIME = ARMOR_TIME
|
public final int TOOL_TIME = ARMOR_TIME
|
||||||
public final int TOOL_HEAT = ARMOR_HEAT
|
public final int TOOL_HEAT = ARMOR_HEAT
|
||||||
|
|
||||||
BlastFurnaceRecipesProvider(FabricDataGenerator dataGenerator) {
|
BlastFurnaceRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
super(dataGenerator)
|
super(output, registriesFuture)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,18 +24,21 @@
|
||||||
|
|
||||||
package techreborn.datagen.recipes.machine.chemical_reactor
|
package techreborn.datagen.recipes.machine.chemical_reactor
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.registry.RegistryWrapper
|
||||||
import reborncore.common.util.ColoredItem
|
import reborncore.common.util.ColoredItem
|
||||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
class ChemicalReactorRecipesProvider extends TechRebornRecipesProvider {
|
class ChemicalReactorRecipesProvider extends TechRebornRecipesProvider {
|
||||||
|
|
||||||
public final int DYE_POWER = 25
|
public final int DYE_POWER = 25
|
||||||
public final int DYE_TIME = 250
|
public final int DYE_TIME = 250
|
||||||
|
|
||||||
ChemicalReactorRecipesProvider(FabricDataGenerator dataGenerator) {
|
ChemicalReactorRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
super(dataGenerator)
|
super(output, registriesFuture)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,15 +24,18 @@
|
||||||
|
|
||||||
package techreborn.datagen.recipes.machine.compressor
|
package techreborn.datagen.recipes.machine.compressor
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.registry.RegistryWrapper
|
||||||
import reborncore.common.misc.TagConvertible
|
import reborncore.common.misc.TagConvertible
|
||||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||||
import techreborn.init.TRContent
|
import techreborn.init.TRContent
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
class CompressorRecipesProvider extends TechRebornRecipesProvider {
|
class CompressorRecipesProvider extends TechRebornRecipesProvider {
|
||||||
CompressorRecipesProvider(FabricDataGenerator dataGenerator) {
|
CompressorRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
super(dataGenerator)
|
super(output, registriesFuture)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,15 +24,18 @@
|
||||||
|
|
||||||
package techreborn.datagen.recipes.machine.extractor
|
package techreborn.datagen.recipes.machine.extractor
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.item.Items
|
import net.minecraft.item.Items
|
||||||
|
import net.minecraft.registry.RegistryWrapper
|
||||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||||
import techreborn.init.TRContent
|
import techreborn.init.TRContent
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
class ExtractorRecipesProvider extends TechRebornRecipesProvider {
|
class ExtractorRecipesProvider extends TechRebornRecipesProvider {
|
||||||
ExtractorRecipesProvider(FabricDataGenerator dataGenerator) {
|
ExtractorRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
super(dataGenerator)
|
super(output, registriesFuture)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,19 +24,23 @@
|
||||||
|
|
||||||
package techreborn.datagen.recipes.machine.grinder
|
package techreborn.datagen.recipes.machine.grinder
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.item.Items
|
import net.minecraft.item.Items
|
||||||
import net.minecraft.tag.ItemTags
|
import net.minecraft.registry.Registry
|
||||||
import net.minecraft.tag.TagKey
|
import net.minecraft.registry.RegistryKeys
|
||||||
|
import net.minecraft.registry.RegistryWrapper
|
||||||
|
import net.minecraft.registry.tag.ItemTags
|
||||||
|
import net.minecraft.registry.tag.TagKey
|
||||||
import net.minecraft.util.Identifier
|
import net.minecraft.util.Identifier
|
||||||
import net.minecraft.util.registry.Registry
|
|
||||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||||
import techreborn.init.TRContent
|
import techreborn.init.TRContent
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
class GrinderRecipesProvider extends TechRebornRecipesProvider {
|
class GrinderRecipesProvider extends TechRebornRecipesProvider {
|
||||||
GrinderRecipesProvider(FabricDataGenerator dataGenerator) {
|
GrinderRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
super(dataGenerator)
|
super(output, registriesFuture)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -57,9 +61,9 @@ class GrinderRecipesProvider extends TechRebornRecipesProvider {
|
||||||
|
|
||||||
void generateVanillaRawMetals() {
|
void generateVanillaRawMetals() {
|
||||||
[
|
[
|
||||||
(Items.RAW_IRON) : (TagKey.of(Registry.ITEM_KEY, new Identifier("c", "iron_ores"))),
|
(Items.RAW_IRON) : (TagKey.of(RegistryKeys.ITEM, new Identifier("c", "iron_ores"))),
|
||||||
(Items.RAW_COPPER): (TagKey.of(Registry.ITEM_KEY, new Identifier("c", "copper_ores"))),
|
(Items.RAW_COPPER): (TagKey.of(RegistryKeys.ITEM, new Identifier("c", "copper_ores"))),
|
||||||
(Items.RAW_GOLD) : (TagKey.of(Registry.ITEM_KEY, new Identifier("c", "gold_ores")))
|
(Items.RAW_GOLD) : (TagKey.of(RegistryKeys.ITEM, new Identifier("c", "gold_ores")))
|
||||||
].each { raw, oreTag ->
|
].each { raw, oreTag ->
|
||||||
offerGrinderRecipe {
|
offerGrinderRecipe {
|
||||||
ingredients oreTag
|
ingredients oreTag
|
||||||
|
@ -249,5 +253,4 @@ class GrinderRecipesProvider extends TechRebornRecipesProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -24,13 +24,16 @@
|
||||||
|
|
||||||
package techreborn.datagen.recipes.machine.industrial_grinder
|
package techreborn.datagen.recipes.machine.industrial_grinder
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.item.Items
|
import net.minecraft.item.Items
|
||||||
|
import net.minecraft.registry.RegistryWrapper
|
||||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||||
import techreborn.init.ModFluids
|
import techreborn.init.ModFluids
|
||||||
import techreborn.init.TRContent
|
import techreborn.init.TRContent
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
class IndustrialGrinderRecipesProvider extends TechRebornRecipesProvider {
|
class IndustrialGrinderRecipesProvider extends TechRebornRecipesProvider {
|
||||||
|
|
||||||
public final int ARMOR_POWER = 128
|
public final int ARMOR_POWER = 128
|
||||||
|
@ -41,8 +44,8 @@ class IndustrialGrinderRecipesProvider extends TechRebornRecipesProvider {
|
||||||
public final long TOOL_FLUID_AMOUNT = 500L // in millibuckets
|
public final long TOOL_FLUID_AMOUNT = 500L // in millibuckets
|
||||||
var dustMap = TRContent.SmallDusts.SD2DMap
|
var dustMap = TRContent.SmallDusts.SD2DMap
|
||||||
|
|
||||||
IndustrialGrinderRecipesProvider(FabricDataGenerator dataGenerator) {
|
IndustrialGrinderRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
super(dataGenerator)
|
super(output, registriesFuture)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,17 +24,21 @@
|
||||||
|
|
||||||
package techreborn.datagen.recipes.machine.industrial_sawmill
|
package techreborn.datagen.recipes.machine.industrial_sawmill
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.item.Items
|
import net.minecraft.item.Items
|
||||||
import net.minecraft.tag.ItemTags
|
import net.minecraft.registry.RegistryWrapper
|
||||||
|
import net.minecraft.registry.tag.ItemTags
|
||||||
|
import net.minecraft.resource.featuretoggle.FeatureFlags
|
||||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||||
import techreborn.init.TRContent
|
import techreborn.init.TRContent
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
|
class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
|
||||||
|
|
||||||
IndustrialSawmillRecipesProvider(FabricDataGenerator dataGenerator) {
|
IndustrialSawmillRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
super(dataGenerator)
|
super(output, registriesFuture)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -59,6 +63,14 @@ class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
|
||||||
fluidAmount 1000 // in millibuckets
|
fluidAmount 1000 // in millibuckets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
offerIndustrialSawmillRecipe {
|
||||||
|
ingredients ItemTags.BAMBOO_BLOCKS
|
||||||
|
outputs new ItemStack(Items.BAMBOO_PLANKS,2), new ItemStack(TRContent.Dusts.SAW, 1)
|
||||||
|
power 40
|
||||||
|
time 100
|
||||||
|
fluidAmount 500 // in millibuckets
|
||||||
|
feature FeatureFlags.UPDATE_1_20
|
||||||
|
}
|
||||||
[
|
[
|
||||||
(Items.ACACIA_STAIRS): Items.ACACIA_SLAB,
|
(Items.ACACIA_STAIRS): Items.ACACIA_SLAB,
|
||||||
(Items.BIRCH_STAIRS): Items.BIRCH_SLAB,
|
(Items.BIRCH_STAIRS): Items.BIRCH_SLAB,
|
||||||
|
@ -81,6 +93,21 @@ class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
|
||||||
criterion getCriterionName(stairs), getCriterionConditions(stairs)
|
criterion getCriterionName(stairs), getCriterionConditions(stairs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[
|
||||||
|
(Items.BAMBOO_STAIRS): Items.BAMBOO_SLAB,
|
||||||
|
(Items.BAMBOO_MOSAIC_STAIRS): Items.BAMBOO_MOSAIC_SLAB
|
||||||
|
].each { stairs, slab ->
|
||||||
|
offerIndustrialSawmillRecipe {
|
||||||
|
ingredients stairs
|
||||||
|
outputs slab, new ItemStack(TRContent.Dusts.SAW, 2)
|
||||||
|
power 30
|
||||||
|
time 100
|
||||||
|
fluidAmount 250 // in millibuckets
|
||||||
|
source "stairs"
|
||||||
|
criterion getCriterionName(stairs), getCriterionConditions(stairs)
|
||||||
|
feature FeatureFlags.UPDATE_1_20
|
||||||
|
}
|
||||||
|
}
|
||||||
[
|
[
|
||||||
(Items.ACACIA_SLAB): Items.ACACIA_PRESSURE_PLATE,
|
(Items.ACACIA_SLAB): Items.ACACIA_PRESSURE_PLATE,
|
||||||
(Items.BIRCH_SLAB): Items.BIRCH_PRESSURE_PLATE,
|
(Items.BIRCH_SLAB): Items.BIRCH_PRESSURE_PLATE,
|
||||||
|
@ -103,6 +130,21 @@ class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
|
||||||
criterion getCriterionName(slab), getCriterionConditions(slab)
|
criterion getCriterionName(slab), getCriterionConditions(slab)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[
|
||||||
|
(Items.BAMBOO_SLAB): Items.BAMBOO_PRESSURE_PLATE,
|
||||||
|
(Items.BAMBOO_MOSAIC_SLAB): Items.BAMBOO_PRESSURE_PLATE
|
||||||
|
].each { slab, plate ->
|
||||||
|
offerIndustrialSawmillRecipe {
|
||||||
|
ingredients slab
|
||||||
|
outputs new ItemStack(plate, 2), new ItemStack(TRContent.Dusts.SAW, 2)
|
||||||
|
power 30
|
||||||
|
time 200
|
||||||
|
fluidAmount 250 // in millibuckets
|
||||||
|
source ((slab == Items.BAMBOO_MOSAIC_SLAB ? "mosaic_" : "") + "slab")
|
||||||
|
criterion getCriterionName(slab), getCriterionConditions(slab)
|
||||||
|
feature FeatureFlags.UPDATE_1_20
|
||||||
|
}
|
||||||
|
}
|
||||||
[
|
[
|
||||||
(ItemTags.PLANKS): 8,
|
(ItemTags.PLANKS): 8,
|
||||||
// stairs would be 6, slabs 4
|
// stairs would be 6, slabs 4
|
||||||
|
|
|
@ -24,18 +24,22 @@
|
||||||
|
|
||||||
package techreborn.datagen.recipes.smelting
|
package techreborn.datagen.recipes.smelting
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
import net.minecraft.data.server.recipe.CookingRecipeJsonBuilder
|
import net.minecraft.data.server.recipe.CookingRecipeJsonBuilder
|
||||||
import net.minecraft.item.ItemConvertible
|
import net.minecraft.item.ItemConvertible
|
||||||
import net.minecraft.item.Items
|
import net.minecraft.item.Items
|
||||||
import net.minecraft.recipe.CookingRecipeSerializer
|
import net.minecraft.recipe.CookingRecipeSerializer
|
||||||
import net.minecraft.recipe.RecipeSerializer
|
import net.minecraft.recipe.RecipeSerializer
|
||||||
|
import net.minecraft.recipe.book.RecipeCategory
|
||||||
|
import net.minecraft.registry.RegistryWrapper
|
||||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||||
import techreborn.init.TRContent
|
import techreborn.init.TRContent
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
class SmeltingRecipesProvider extends TechRebornRecipesProvider {
|
class SmeltingRecipesProvider extends TechRebornRecipesProvider {
|
||||||
SmeltingRecipesProvider(FabricDataGenerator dataGenerator) {
|
SmeltingRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
super(dataGenerator)
|
super(output, registriesFuture)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,8 +77,8 @@ class SmeltingRecipesProvider extends TechRebornRecipesProvider {
|
||||||
offerCookingRecipe(input, output, experience, cookingTime, RecipeSerializer.BLASTING, "blasting/")
|
offerCookingRecipe(input, output, experience, cookingTime, RecipeSerializer.BLASTING, "blasting/")
|
||||||
}
|
}
|
||||||
|
|
||||||
def offerCookingRecipe(def input, ItemConvertible output, float experience, int cookingTime, CookingRecipeSerializer<?> serializer, String prefix = "") {
|
def offerCookingRecipe(def input, ItemConvertible output, float experience, int cookingTime, CookingRecipeSerializer<?> serializer, String prefix = "", RecipeCategory category = RecipeCategory.MISC) {
|
||||||
CookingRecipeJsonBuilder.create(createIngredient(input), output, experience, cookingTime, serializer)
|
CookingRecipeJsonBuilder.create(createIngredient(input), category, output, experience, cookingTime, serializer)
|
||||||
.criterion(getCriterionName(input), getCriterionConditions(input))
|
.criterion(getCriterionName(input), getCriterionConditions(input))
|
||||||
.offerTo(this.exporter, prefix + getInputPath(output) + "_from_" + getInputPath(input))
|
.offerTo(this.exporter, prefix + getInputPath(output) + "_from_" + getInputPath(input))
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,22 +24,25 @@
|
||||||
|
|
||||||
package techreborn.datagen.tags
|
package techreborn.datagen.tags
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider
|
||||||
import net.fabricmc.fabric.api.mininglevel.v1.FabricMineableTags
|
import net.fabricmc.fabric.api.mininglevel.v1.FabricMineableTags
|
||||||
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBlockTags
|
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBlockTags
|
||||||
import net.minecraft.tag.BlockTags
|
import net.minecraft.registry.RegistryWrapper
|
||||||
|
import net.minecraft.registry.tag.BlockTags
|
||||||
import net.minecraft.util.Identifier
|
import net.minecraft.util.Identifier
|
||||||
import techreborn.init.TRContent
|
import techreborn.init.TRContent
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
class TRBlockTagProvider extends FabricTagProvider.BlockTagProvider {
|
class TRBlockTagProvider extends FabricTagProvider.BlockTagProvider {
|
||||||
|
|
||||||
TRBlockTagProvider(FabricDataGenerator dataGenerator) {
|
TRBlockTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
super(dataGenerator)
|
super(output, registriesFuture)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void generateTags() {
|
protected void configure(RegistryWrapper.WrapperLookup lookup) {
|
||||||
getOrCreateTagBuilder(TRContent.BlockTags.DRILL_MINEABLE)
|
getOrCreateTagBuilder(TRContent.BlockTags.DRILL_MINEABLE)
|
||||||
.addOptionalTag(BlockTags.PICKAXE_MINEABLE.id())
|
.addOptionalTag(BlockTags.PICKAXE_MINEABLE.id())
|
||||||
.addOptionalTag(BlockTags.SHOVEL_MINEABLE.id())
|
.addOptionalTag(BlockTags.SHOVEL_MINEABLE.id())
|
||||||
|
|
|
@ -24,19 +24,23 @@
|
||||||
|
|
||||||
package techreborn.datagen.tags
|
package techreborn.datagen.tags
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider.ItemTagProvider
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider.ItemTagProvider
|
||||||
import net.minecraft.tag.BlockTags
|
import net.minecraft.registry.RegistryWrapper
|
||||||
import net.minecraft.tag.ItemTags
|
import net.minecraft.registry.tag.ItemTags
|
||||||
|
import reborncore.common.misc.RebornCoreTags
|
||||||
|
import techreborn.init.ModFluids
|
||||||
import techreborn.init.TRContent
|
import techreborn.init.TRContent
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
class TRItemTagProvider extends ItemTagProvider {
|
class TRItemTagProvider extends ItemTagProvider {
|
||||||
TRItemTagProvider(FabricDataGenerator dataGenerator) {
|
TRItemTagProvider(FabricDataOutput dataOutput, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
super(dataGenerator)
|
super(dataOutput, registriesFuture)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void generateTags() {
|
protected void configure(RegistryWrapper.WrapperLookup arg) {
|
||||||
TRContent.Ores.values().each { ore ->
|
TRContent.Ores.values().each { ore ->
|
||||||
getOrCreateTagBuilder(ore.asTag()).add(ore.asItem())
|
getOrCreateTagBuilder(ore.asTag()).add(ore.asItem())
|
||||||
getOrCreateTagBuilder(TRContent.ItemTags.ORES).add(ore.asItem())
|
getOrCreateTagBuilder(TRContent.ItemTags.ORES).add(ore.asItem())
|
||||||
|
@ -176,5 +180,8 @@ class TRItemTagProvider extends ItemTagProvider {
|
||||||
|
|
||||||
getOrCreateTagBuilder(ItemTags.WOODEN_TRAPDOORS)
|
getOrCreateTagBuilder(ItemTags.WOODEN_TRAPDOORS)
|
||||||
.add(TRContent.RUBBER_TRAPDOOR.asItem())
|
.add(TRContent.RUBBER_TRAPDOOR.asItem())
|
||||||
|
|
||||||
|
getOrCreateTagBuilder(RebornCoreTags.WATER_EXPLOSION_ITEM)
|
||||||
|
.add(ModFluids.SODIUM.getBucket())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,20 +24,23 @@
|
||||||
|
|
||||||
package techreborn.datagen.tags
|
package techreborn.datagen.tags
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider
|
||||||
import net.minecraft.tag.PointOfInterestTypeTags
|
import net.minecraft.registry.RegistryKeys
|
||||||
import net.minecraft.util.registry.Registry
|
import net.minecraft.registry.RegistryWrapper
|
||||||
|
import net.minecraft.registry.tag.PointOfInterestTypeTags
|
||||||
import net.minecraft.world.poi.PointOfInterestType
|
import net.minecraft.world.poi.PointOfInterestType
|
||||||
import techreborn.init.TRVillager
|
import techreborn.init.TRVillager
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
class TRPointOfInterestTagProvider extends FabricTagProvider<PointOfInterestType> {
|
class TRPointOfInterestTagProvider extends FabricTagProvider<PointOfInterestType> {
|
||||||
TRPointOfInterestTagProvider(FabricDataGenerator dataGenerator) {
|
TRPointOfInterestTagProvider(FabricDataOutput dataOutput, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
super(dataGenerator, Registry.POINT_OF_INTEREST_TYPE)
|
super(dataOutput, RegistryKeys.POINT_OF_INTEREST_TYPE, registriesFuture)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void generateTags() {
|
protected void configure(RegistryWrapper.WrapperLookup arg) {
|
||||||
getOrCreateTagBuilder(PointOfInterestTypeTags.ACQUIRABLE_JOB_SITE)
|
getOrCreateTagBuilder(PointOfInterestTypeTags.ACQUIRABLE_JOB_SITE)
|
||||||
.add(TRVillager.METALLURGIST_POI)
|
.add(TRVillager.METALLURGIST_POI)
|
||||||
.add(TRVillager.ELECTRICIAN_POI)
|
.add(TRVillager.ELECTRICIAN_POI)
|
||||||
|
|
|
@ -0,0 +1,185 @@
|
||||||
|
package techreborn.datagen.worldgen
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState
|
||||||
|
import net.minecraft.block.Blocks
|
||||||
|
import net.minecraft.registry.Registerable
|
||||||
|
import net.minecraft.registry.RegistryEntryLookup
|
||||||
|
import net.minecraft.registry.RegistryKeys
|
||||||
|
import net.minecraft.registry.tag.BlockTags
|
||||||
|
import net.minecraft.structure.rule.BlockMatchRuleTest
|
||||||
|
import net.minecraft.structure.rule.BlockStateMatchRuleTest
|
||||||
|
import net.minecraft.structure.rule.RuleTest
|
||||||
|
import net.minecraft.structure.rule.TagMatchRuleTest
|
||||||
|
import net.minecraft.util.collection.DataPool
|
||||||
|
import net.minecraft.util.math.BlockPos
|
||||||
|
import net.minecraft.util.math.Direction
|
||||||
|
import net.minecraft.util.math.intprovider.ConstantIntProvider
|
||||||
|
import net.minecraft.world.Heightmap
|
||||||
|
import net.minecraft.world.gen.YOffset
|
||||||
|
import net.minecraft.world.gen.blockpredicate.BlockPredicate
|
||||||
|
import net.minecraft.world.gen.feature.*
|
||||||
|
import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize
|
||||||
|
import net.minecraft.world.gen.foliage.BlobFoliagePlacer
|
||||||
|
import net.minecraft.world.gen.heightprovider.UniformHeightProvider
|
||||||
|
import net.minecraft.world.gen.placementmodifier.*
|
||||||
|
import net.minecraft.world.gen.stateprovider.BlockStateProvider
|
||||||
|
import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider
|
||||||
|
import net.minecraft.world.gen.trunk.StraightTrunkPlacer
|
||||||
|
import techreborn.blocks.misc.BlockRubberLog
|
||||||
|
import techreborn.init.ModFluids
|
||||||
|
import techreborn.init.TRContent
|
||||||
|
import techreborn.world.RubberTreeSpikeDecorator
|
||||||
|
import techreborn.world.TROreFeatureConfig
|
||||||
|
import techreborn.world.TargetDimension
|
||||||
|
import techreborn.world.WorldGenerator
|
||||||
|
|
||||||
|
class TRWorldGenBootstrap {
|
||||||
|
static void configuredFeatures(Registerable<ConfiguredFeature> registry) {
|
||||||
|
def placedFeatureLookup = registry.getRegistryLookup(RegistryKeys.PLACED_FEATURE)
|
||||||
|
|
||||||
|
WorldGenerator.ORE_FEATURES.forEach {
|
||||||
|
registry.register(it.configuredFeature(), createOreConfiguredFeature(it))
|
||||||
|
}
|
||||||
|
|
||||||
|
registry.register(WorldGenerator.OIL_LAKE_FEATURE, createOilLakeConfiguredFeature())
|
||||||
|
registry.register(WorldGenerator.RUBBER_TREE_FEATURE, createRubberTreeConfiguredFeature())
|
||||||
|
registry.register(WorldGenerator.RUBBER_TREE_PATCH_FEATURE, createRubberPatchTreeConfiguredFeature(placedFeatureLookup))
|
||||||
|
}
|
||||||
|
|
||||||
|
static void placedFeatures(Registerable<PlacedFeature> registry) {
|
||||||
|
def configuredFeatureLookup = registry.getRegistryLookup(RegistryKeys.CONFIGURED_FEATURE)
|
||||||
|
|
||||||
|
WorldGenerator.ORE_FEATURES.forEach {
|
||||||
|
registry.register(it.placedFeature(), createOrePlacedFeature(configuredFeatureLookup, it))
|
||||||
|
}
|
||||||
|
|
||||||
|
registry.register(WorldGenerator.OIL_LAKE_PLACED_FEATURE, createOilLakePlacedFeature(configuredFeatureLookup))
|
||||||
|
registry.register(WorldGenerator.RUBBER_TREE_PLACED_FEATURE, createRubberTreePlacedFeature(configuredFeatureLookup))
|
||||||
|
registry.register(WorldGenerator.RUBBER_TREE_PATCH_PLACED_FEATURE, createRubberTreePatchPlacedFeature(configuredFeatureLookup))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ores
|
||||||
|
private static ConfiguredFeature createOreConfiguredFeature(TROreFeatureConfig config) {
|
||||||
|
def oreFeatureConfig = switch (config.ore().distribution.dimension) {
|
||||||
|
case TargetDimension.OVERWORLD -> createOverworldOreFeatureConfig(config)
|
||||||
|
case TargetDimension.NETHER -> createSimpleOreFeatureConfig(new BlockMatchRuleTest(Blocks.NETHERRACK), config)
|
||||||
|
case TargetDimension.END -> createSimpleOreFeatureConfig(new BlockStateMatchRuleTest(Blocks.END_STONE.getDefaultState()), config)
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ConfiguredFeature<>(Feature.ORE, oreFeatureConfig)
|
||||||
|
}
|
||||||
|
|
||||||
|
private static OreFeatureConfig createOverworldOreFeatureConfig(TROreFeatureConfig config) {
|
||||||
|
if (config.ore().getDeepslate() != null) {
|
||||||
|
return new OreFeatureConfig(List.of(
|
||||||
|
OreFeatureConfig.createTarget(new TagMatchRuleTest(BlockTags.STONE_ORE_REPLACEABLES), config.ore().block.getDefaultState()),
|
||||||
|
OreFeatureConfig.createTarget(new TagMatchRuleTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES), config.ore().getDeepslate().block.getDefaultState())
|
||||||
|
), config.ore().distribution.veinSize)
|
||||||
|
}
|
||||||
|
|
||||||
|
return createSimpleOreFeatureConfig(new TagMatchRuleTest(BlockTags.STONE_ORE_REPLACEABLES), config)
|
||||||
|
}
|
||||||
|
|
||||||
|
private static OreFeatureConfig createSimpleOreFeatureConfig(RuleTest test, TROreFeatureConfig config) {
|
||||||
|
return new OreFeatureConfig(test, config.ore().block.getDefaultState(), config.ore().distribution.veinSize)
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PlacedFeature createOrePlacedFeature(RegistryEntryLookup<ConfiguredFeature> configuredFeatureLookup, TROreFeatureConfig config) {
|
||||||
|
return new PlacedFeature(configuredFeatureLookup.getOrThrow(config.configuredFeature()), getOrePlacementModifiers(config))
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<PlacementModifier> getOrePlacementModifiers(TROreFeatureConfig config) {
|
||||||
|
return oreModifiers(
|
||||||
|
CountPlacementModifier.of(config.ore().distribution.veinsPerChunk),
|
||||||
|
HeightRangePlacementModifier.uniform(
|
||||||
|
config.ore().distribution.minOffset,
|
||||||
|
YOffset.fixed(config.ore().distribution.maxY)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<PlacementModifier> oreModifiers(PlacementModifier first, PlacementModifier second) {
|
||||||
|
return List.of(first, SquarePlacementModifier.of(), second, BiomePlacementModifier.of())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Oil lake
|
||||||
|
private static ConfiguredFeature createOilLakeConfiguredFeature() {
|
||||||
|
return new ConfiguredFeature<>(Feature.LAKE,
|
||||||
|
new LakeFeature.Config(
|
||||||
|
BlockStateProvider.of(ModFluids.OIL.getBlock().getDefaultState()),
|
||||||
|
BlockStateProvider.of(Blocks.STONE.getDefaultState())
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PlacedFeature createOilLakePlacedFeature(RegistryEntryLookup<ConfiguredFeature> lookup) {
|
||||||
|
return new PlacedFeature(
|
||||||
|
lookup.getOrThrow(WorldGenerator.OIL_LAKE_FEATURE), List.of(
|
||||||
|
RarityFilterPlacementModifier.of(20),
|
||||||
|
HeightRangePlacementModifier.of(UniformHeightProvider.create(YOffset.fixed(0), YOffset.getTop())),
|
||||||
|
EnvironmentScanPlacementModifier.of(Direction.DOWN, BlockPredicate.bothOf(BlockPredicate.not(BlockPredicate.IS_AIR), BlockPredicate.insideWorldBounds(new BlockPos(0, -5, 0))), 32),
|
||||||
|
SurfaceThresholdFilterPlacementModifier.of(Heightmap.Type.OCEAN_FLOOR_WG, Integer.MIN_VALUE, -5)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rubber tree
|
||||||
|
private static ConfiguredFeature createRubberTreeConfiguredFeature() {
|
||||||
|
final DataPool.Builder<BlockState> logDataPool = DataPool.<BlockState>builder()
|
||||||
|
.add(TRContent.RUBBER_LOG.getDefaultState(), 6)
|
||||||
|
|
||||||
|
Arrays.stream(Direction.values())
|
||||||
|
.filter(direction -> direction.getAxis().isHorizontal())
|
||||||
|
.map(direction -> TRContent.RUBBER_LOG.getDefaultState()
|
||||||
|
.with(BlockRubberLog.HAS_SAP, true)
|
||||||
|
.with(BlockRubberLog.SAP_SIDE, direction)
|
||||||
|
)
|
||||||
|
.forEach(state -> logDataPool.add(state, 1))
|
||||||
|
|
||||||
|
return new ConfiguredFeature<>(Feature.TREE,
|
||||||
|
new TreeFeatureConfig.Builder(
|
||||||
|
new WeightedBlockStateProvider(logDataPool),
|
||||||
|
new StraightTrunkPlacer(6, 3, 0),
|
||||||
|
BlockStateProvider.of(TRContent.RUBBER_LEAVES.getDefaultState()),
|
||||||
|
new BlobFoliagePlacer(
|
||||||
|
ConstantIntProvider.create(2),
|
||||||
|
ConstantIntProvider.create(0),
|
||||||
|
3
|
||||||
|
),
|
||||||
|
new TwoLayersFeatureSize(
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
1
|
||||||
|
))
|
||||||
|
.decorators(List.of(
|
||||||
|
new RubberTreeSpikeDecorator(4, BlockStateProvider.of(TRContent.RUBBER_LEAVES.getDefaultState()))
|
||||||
|
)).build()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PlacedFeature createRubberTreePlacedFeature(RegistryEntryLookup<ConfiguredFeature> lookup) {
|
||||||
|
return new PlacedFeature(lookup.getOrThrow(WorldGenerator.RUBBER_TREE_FEATURE), List.of(
|
||||||
|
PlacedFeatures.wouldSurvive(TRContent.RUBBER_SAPLING)
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ConfiguredFeature createRubberPatchTreeConfiguredFeature(RegistryEntryLookup<PlacedFeature> lookup) {
|
||||||
|
return new ConfiguredFeature<>(Feature.RANDOM_PATCH,
|
||||||
|
ConfiguredFeatures.createRandomPatchFeatureConfig(
|
||||||
|
6, lookup.getOrThrow(WorldGenerator.RUBBER_TREE_PLACED_FEATURE)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PlacedFeature createRubberTreePatchPlacedFeature(RegistryEntryLookup<ConfiguredFeature> lookup) {
|
||||||
|
return new PlacedFeature(
|
||||||
|
lookup.getOrThrow(WorldGenerator.RUBBER_TREE_PATCH_FEATURE),
|
||||||
|
List.of(
|
||||||
|
RarityFilterPlacementModifier.of(3),
|
||||||
|
SquarePlacementModifier.of(),
|
||||||
|
PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP,
|
||||||
|
BiomePlacementModifier.of()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package techreborn.datagen.worldgen
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||||
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider
|
||||||
|
import net.minecraft.registry.RegistryKeys
|
||||||
|
import net.minecraft.registry.RegistryWrapper
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
|
class TRWorldGenProvider extends FabricDynamicRegistryProvider {
|
||||||
|
TRWorldGenProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
|
super(output, registriesFuture)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) {
|
||||||
|
entries.addAll(registries.getWrapperOrThrow(RegistryKeys.CONFIGURED_FEATURE))
|
||||||
|
entries.addAll(registries.getWrapperOrThrow(RegistryKeys.PLACED_FEATURE))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
String getName() {
|
||||||
|
return "TechReborn World gen"
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,7 +26,7 @@ package techreborn
|
||||||
|
|
||||||
import net.minecraft.Bootstrap
|
import net.minecraft.Bootstrap
|
||||||
import net.minecraft.SharedConstants
|
import net.minecraft.SharedConstants
|
||||||
import net.minecraft.util.registry.BuiltinRegistries
|
import net.minecraft.registry.BuiltinRegistries
|
||||||
import net.minecraft.world.EmptyBlockView
|
import net.minecraft.world.EmptyBlockView
|
||||||
import net.minecraft.world.gen.HeightContext
|
import net.minecraft.world.gen.HeightContext
|
||||||
import net.minecraft.world.gen.chunk.DebugChunkGenerator
|
import net.minecraft.world.gen.chunk.DebugChunkGenerator
|
||||||
|
|
|
@ -25,12 +25,9 @@
|
||||||
package techreborn;
|
package techreborn;
|
||||||
|
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
|
||||||
import net.minecraft.block.ComposterBlock;
|
import net.minecraft.block.ComposterBlock;
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
import net.minecraft.item.ItemGroup;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import reborncore.common.blockentity.RedstoneConfiguration;
|
import reborncore.common.blockentity.RedstoneConfiguration;
|
||||||
|
@ -42,7 +39,15 @@ import techreborn.config.TechRebornConfig;
|
||||||
import techreborn.events.ApplyArmorToDamageHandler;
|
import techreborn.events.ApplyArmorToDamageHandler;
|
||||||
import techreborn.events.OreDepthSyncHandler;
|
import techreborn.events.OreDepthSyncHandler;
|
||||||
import techreborn.events.UseBlockHandler;
|
import techreborn.events.UseBlockHandler;
|
||||||
import techreborn.init.*;
|
import techreborn.init.FluidGeneratorRecipes;
|
||||||
|
import techreborn.init.FuelRecipes;
|
||||||
|
import techreborn.init.ModLoot;
|
||||||
|
import techreborn.init.ModRecipes;
|
||||||
|
import techreborn.init.ModSounds;
|
||||||
|
import techreborn.init.TRBlockEntities;
|
||||||
|
import techreborn.init.TRCauldronBehavior;
|
||||||
|
import techreborn.init.TRContent;
|
||||||
|
import techreborn.init.TRDispenserBehavior;
|
||||||
import techreborn.init.template.TechRebornTemplates;
|
import techreborn.init.template.TechRebornTemplates;
|
||||||
import techreborn.items.DynamicCellItem;
|
import techreborn.items.DynamicCellItem;
|
||||||
import techreborn.packets.ServerboundPackets;
|
import techreborn.packets.ServerboundPackets;
|
||||||
|
@ -55,10 +60,6 @@ public class TechReborn implements ModInitializer {
|
||||||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
||||||
public static TechReborn INSTANCE;
|
public static TechReborn INSTANCE;
|
||||||
|
|
||||||
public static ItemGroup ITEMGROUP = FabricItemGroupBuilder.build(
|
|
||||||
new Identifier("techreborn", "item_group"),
|
|
||||||
() -> new ItemStack(TRContent.NUKE));
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
INSTANCE = this;
|
INSTANCE = this;
|
||||||
|
|
|
@ -30,13 +30,14 @@ import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.network.PacketByteBuf;
|
import net.minecraft.network.PacketByteBuf;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.screen.ScreenHandler;
|
import net.minecraft.screen.ScreenHandler;
|
||||||
import net.minecraft.screen.ScreenHandlerType;
|
import net.minecraft.screen.ScreenHandlerType;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import reborncore.api.blockentity.IMachineGuiHandler;
|
import reborncore.api.blockentity.IMachineGuiHandler;
|
||||||
|
@ -142,7 +143,7 @@ public final class GuiType<T extends BlockEntity> implements IMachineGuiHandler
|
||||||
|
|
||||||
private GuiType(Identifier identifier) {
|
private GuiType(Identifier identifier) {
|
||||||
this.identifier = identifier;
|
this.identifier = identifier;
|
||||||
this.screenHandlerType = Registry.register(Registry.SCREEN_HANDLER, identifier, new ExtendedScreenHandlerType<>(getScreenHandlerFactory()));
|
this.screenHandlerType = Registry.register(Registries.SCREEN_HANDLER, identifier, new ExtendedScreenHandlerType<>(getScreenHandlerFactory()));
|
||||||
|
|
||||||
TYPES.put(identifier, this);
|
TYPES.put(identifier, this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,9 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.nbt.NbtHelper;
|
import net.minecraft.nbt.NbtHelper;
|
||||||
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
|
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
|
import net.minecraft.registry.RegistryKeys;
|
||||||
|
import net.minecraft.registry.RegistryWrapper;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
|
@ -48,6 +51,7 @@ import reborncore.common.network.ClientBoundPackets;
|
||||||
import reborncore.common.network.NetworkManager;
|
import reborncore.common.network.NetworkManager;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.powerSystem.PowerSystem;
|
||||||
import reborncore.common.util.StringUtils;
|
import reborncore.common.util.StringUtils;
|
||||||
|
import reborncore.common.util.WorldUtils;
|
||||||
import team.reborn.energy.api.EnergyStorage;
|
import team.reborn.energy.api.EnergyStorage;
|
||||||
import team.reborn.energy.api.base.SimpleSidedEnergyContainer;
|
import team.reborn.energy.api.base.SimpleSidedEnergyContainer;
|
||||||
import techreborn.blocks.cable.CableBlock;
|
import techreborn.blocks.cable.CableBlock;
|
||||||
|
@ -232,7 +236,7 @@ public class CableBlockEntity extends BlockEntity
|
||||||
energyContainer.amount = compound.getLong("energy");
|
energyContainer.amount = compound.getLong("energy");
|
||||||
}
|
}
|
||||||
if (compound.contains("cover")) {
|
if (compound.contains("cover")) {
|
||||||
cover = NbtHelper.toBlockState(compound.getCompound("cover"));
|
cover = NbtHelper.toBlockState(WorldUtils.getBlockRegistryWrapper(world), compound.getCompound("cover"));
|
||||||
} else {
|
} else {
|
||||||
cover = null;
|
cover = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class IronAlloyFurnaceBlockEntity extends AbstractIronMachineBlockEntity
|
||||||
return false;
|
return false;
|
||||||
if (inventory.getStack(OUTPUT_SLOT).isEmpty())
|
if (inventory.getStack(OUTPUT_SLOT).isEmpty())
|
||||||
return true;
|
return true;
|
||||||
if (!inventory.getStack(OUTPUT_SLOT).isItemEqualIgnoreDamage(itemstack))
|
if (!inventory.getStack(OUTPUT_SLOT).isItemEqual(itemstack))
|
||||||
return false;
|
return false;
|
||||||
int result = inventory.getStack(OUTPUT_SLOT).getCount() + itemstack.getCount();
|
int result = inventory.getStack(OUTPUT_SLOT).getCount() + itemstack.getCount();
|
||||||
return result <= inventory.getStackLimit() && result <= inventory.getStack(OUTPUT_SLOT).getMaxCount();
|
return result <= inventory.getStackLimit() && result <= inventory.getStack(OUTPUT_SLOT).getMaxCount();
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple
|
||||||
// Fast fail if there is no input, no point checking the recipes if the machine is empty
|
// Fast fail if there is no input, no point checking the recipes if the machine is empty
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
if (previousStack.isItemEqualIgnoreDamage(stack) && !previousValid){
|
if (previousStack.isItemEqual(stack) && !previousValid){
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple
|
||||||
|
|
||||||
if (inventory.getStack(OUTPUT_SLOT).isEmpty()) {
|
if (inventory.getStack(OUTPUT_SLOT).isEmpty()) {
|
||||||
inventory.setStack(OUTPUT_SLOT, resultStack.copy());
|
inventory.setStack(OUTPUT_SLOT, resultStack.copy());
|
||||||
} else if (inventory.getStack(OUTPUT_SLOT).isItemEqualIgnoreDamage(resultStack)) {
|
} else if (inventory.getStack(OUTPUT_SLOT).isItemEqual(resultStack)) {
|
||||||
inventory.getStack(OUTPUT_SLOT).increment(resultStack.getCount());
|
inventory.getStack(OUTPUT_SLOT).increment(resultStack.getCount());
|
||||||
}
|
}
|
||||||
experience += getExperienceFor();
|
experience += getExperienceFor();
|
||||||
|
@ -158,7 +158,7 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple
|
||||||
ItemStack outputSlotStack = inventory.getStack(OUTPUT_SLOT);
|
ItemStack outputSlotStack = inventory.getStack(OUTPUT_SLOT);
|
||||||
if (outputSlotStack.isEmpty())
|
if (outputSlotStack.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
if (!outputSlotStack.isItemEqualIgnoreDamage(outputStack))
|
if (!outputSlotStack.isItemEqual(outputStack))
|
||||||
return false;
|
return false;
|
||||||
int result = outputSlotStack.getCount() + outputStack.getCount();
|
int result = outputSlotStack.getCount() + outputStack.getCount();
|
||||||
return result <= inventory.getStackLimit() && result <= outputStack.getMaxCount();
|
return result <= inventory.getStackLimit() && result <= outputStack.getMaxCount();
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem
|
||||||
private static IInventoryAccess<FluidReplicatorBlockEntity> getInventoryAccess() {
|
private static IInventoryAccess<FluidReplicatorBlockEntity> getInventoryAccess() {
|
||||||
return (slotID, stack, face, direction, blockEntity) -> {
|
return (slotID, stack, face, direction, blockEntity) -> {
|
||||||
if (slotID == 0) {
|
if (slotID == 0) {
|
||||||
return stack.isItemEqualIgnoreDamage(TRContent.Parts.UU_MATTER.getStack());
|
return stack.isItemEqual(TRContent.Parts.UU_MATTER.getStack());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
@ -132,7 +132,7 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem
|
||||||
@Override
|
@Override
|
||||||
public BuiltScreenHandler createScreenHandler(int syncID, PlayerEntity player) {
|
public BuiltScreenHandler createScreenHandler(int syncID, PlayerEntity player) {
|
||||||
return new ScreenHandlerBuilder("fluidreplicator").player(player.getInventory()).inventory().hotbar().addInventory()
|
return new ScreenHandlerBuilder("fluidreplicator").player(player.getInventory()).inventory().hotbar().addInventory()
|
||||||
.blockEntity(this).fluidSlot(1, 124, 35).filterSlot(0, 55, 45, stack -> stack.isItemEqualIgnoreDamage(TRContent.Parts.UU_MATTER.getStack()))
|
.blockEntity(this).fluidSlot(1, 124, 35).filterSlot(0, 55, 45, stack -> stack.isItemEqual(TRContent.Parts.UU_MATTER.getStack()))
|
||||||
.outputSlot(2, 124, 55).energySlot(3, 8, 72).sync(tank).syncEnergyValue().syncCrafterValue().addInventory()
|
.outputSlot(2, 124, 55).energySlot(3, 8, 72).sync(tank).syncEnergyValue().syncCrafterValue().addInventory()
|
||||||
.create(this, syncID);
|
.create(this, syncID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.item.Items;
|
||||||
import net.minecraft.loot.context.LootContext;
|
import net.minecraft.loot.context.LootContext;
|
||||||
import net.minecraft.loot.context.LootContextParameters;
|
import net.minecraft.loot.context.LootContextParameters;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.tag.BlockTags;
|
import net.minecraft.registry.tag.BlockTags;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
|
@ -125,7 +125,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
|
||||||
if (inventoryCrafting == null) {
|
if (inventoryCrafting == null) {
|
||||||
inventoryCrafting = new CraftingInventory(new ScreenHandler(null, -1) {
|
inventoryCrafting = new CraftingInventory(new ScreenHandler(null, -1) {
|
||||||
@Override
|
@Override
|
||||||
public ItemStack transferSlot(PlayerEntity player, int index) {
|
public ItemStack quickMove(PlayerEntity player, int index) {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,9 @@ import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import reborncore.api.blockentity.IUpgrade;
|
import reborncore.api.blockentity.IUpgrade;
|
||||||
import reborncore.common.screen.BuiltScreenHandler;
|
import reborncore.common.screen.BuiltScreenHandler;
|
||||||
import reborncore.common.screen.BuiltScreenHandlerProvider;
|
import reborncore.common.screen.BuiltScreenHandlerProvider;
|
||||||
|
@ -56,7 +57,7 @@ public class RecyclerBlockEntity extends GenericMachineBlockEntity implements Bu
|
||||||
if ((item instanceof IUpgrade)) {
|
if ((item instanceof IUpgrade)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return !TechRebornConfig.recyclerBlackList.contains(Registry.ITEM.getId(item).toString());
|
return !TechRebornConfig.recyclerBlackList.contains(Registries.ITEM.getId(item).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// BuiltScreenHandlerProvider
|
// BuiltScreenHandlerProvider
|
||||||
|
|
|
@ -433,7 +433,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack transferSlot(PlayerEntity player, int index) {
|
public ItemStack quickMove(PlayerEntity player, int slot) {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class MatterFabricatorBlockEntity extends PowerAcceptorBlockEntity
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getValue(ItemStack itemStack) {
|
public int getValue(ItemStack itemStack) {
|
||||||
if (itemStack.isItemEqualIgnoreDamage(TRContent.Parts.SCRAP.getStack())) {
|
if (itemStack.isItemEqual(TRContent.Parts.SCRAP.getStack())) {
|
||||||
return 200;
|
return 200;
|
||||||
} else if (itemStack.getItem() == TRContent.SCRAP_BOX) {
|
} else if (itemStack.getItem() == TRContent.SCRAP_BOX) {
|
||||||
return 2000;
|
return 2000;
|
||||||
|
|
|
@ -155,7 +155,7 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
|
||||||
// MachineBaseBlockEntity
|
// MachineBaseBlockEntity
|
||||||
@Override
|
@Override
|
||||||
public boolean isUpgradeValid(IUpgrade upgrade, ItemStack stack) {
|
public boolean isUpgradeValid(IUpgrade upgrade, ItemStack stack) {
|
||||||
return stack.isItemEqual(new ItemStack(TRContent.Upgrades.SUPERCONDUCTOR.item));
|
return stack.isOf(TRContent.Upgrades.SUPERCONDUCTOR.item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IContainerProvider
|
// IContainerProvider
|
||||||
|
|
|
@ -181,7 +181,7 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
|
||||||
public BlockState getStateForNeighborUpdate(BlockState ourState, Direction direction, BlockState otherState,
|
public BlockState getStateForNeighborUpdate(BlockState ourState, Direction direction, BlockState otherState,
|
||||||
WorldAccess worldIn, BlockPos ourPos, BlockPos otherPos) {
|
WorldAccess worldIn, BlockPos ourPos, BlockPos otherPos) {
|
||||||
if (ourState.get(WATERLOGGED)) {
|
if (ourState.get(WATERLOGGED)) {
|
||||||
worldIn.createAndScheduleFluidTick(ourPos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn));
|
worldIn.scheduleFluidTick(ourPos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn));
|
||||||
}
|
}
|
||||||
return ourState;
|
return ourState;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ import net.minecraft.state.StateManager;
|
||||||
import net.minecraft.state.property.BooleanProperty;
|
import net.minecraft.state.property.BooleanProperty;
|
||||||
import net.minecraft.state.property.DirectionProperty;
|
import net.minecraft.state.property.DirectionProperty;
|
||||||
import net.minecraft.state.property.Properties;
|
import net.minecraft.state.property.Properties;
|
||||||
import net.minecraft.tag.BlockTags;
|
import net.minecraft.registry.tag.BlockTags;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.hit.BlockHitResult;
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
|
|
|
@ -24,15 +24,16 @@
|
||||||
|
|
||||||
package techreborn.blocks.misc;
|
package techreborn.blocks.misc;
|
||||||
|
|
||||||
import net.minecraft.block.WoodenButtonBlock;
|
import net.minecraft.block.ButtonBlock;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
import techreborn.utils.InitUtils;
|
import techreborn.utils.InitUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author drcrazy
|
* @author drcrazy
|
||||||
*/
|
*/
|
||||||
public class RubberButtonBlock extends WoodenButtonBlock {
|
public class RubberButtonBlock extends ButtonBlock {
|
||||||
|
|
||||||
public RubberButtonBlock() {
|
public RubberButtonBlock() {
|
||||||
super(InitUtils.setupRubberBlockSettings(true, 0.5F, 0.5F));
|
super(InitUtils.setupRubberBlockSettings(true, 0.5F, 0.5F), 30, true, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_ON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
package techreborn.blocks.misc;
|
package techreborn.blocks.misc;
|
||||||
|
|
||||||
import net.minecraft.block.DoorBlock;
|
import net.minecraft.block.DoorBlock;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
import techreborn.utils.InitUtils;
|
import techreborn.utils.InitUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,6 +34,6 @@ import techreborn.utils.InitUtils;
|
||||||
public class RubberDoorBlock extends DoorBlock {
|
public class RubberDoorBlock extends DoorBlock {
|
||||||
|
|
||||||
public RubberDoorBlock() {
|
public RubberDoorBlock() {
|
||||||
super(InitUtils.setupRubberBlockSettings(3.0F, 3.0F));
|
super(InitUtils.setupRubberBlockSettings(3.0F, 3.0F), SoundEvents.BLOCK_NETHER_WOOD_TRAPDOOR_CLOSE, SoundEvents.BLOCK_NETHER_WOOD_TRAPDOOR_OPEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
package techreborn.blocks.misc;
|
package techreborn.blocks.misc;
|
||||||
|
|
||||||
import net.minecraft.block.PressurePlateBlock;
|
import net.minecraft.block.PressurePlateBlock;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
import techreborn.utils.InitUtils;
|
import techreborn.utils.InitUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +34,7 @@ import techreborn.utils.InitUtils;
|
||||||
public class RubberPressurePlateBlock extends PressurePlateBlock {
|
public class RubberPressurePlateBlock extends PressurePlateBlock {
|
||||||
|
|
||||||
public RubberPressurePlateBlock() {
|
public RubberPressurePlateBlock() {
|
||||||
super(PressurePlateBlock.ActivationRule.EVERYTHING, InitUtils.setupRubberBlockSettings(true, 0.5F, 0.5F));
|
super(PressurePlateBlock.ActivationRule.EVERYTHING, InitUtils.setupRubberBlockSettings(true, 0.5F, 0.5F), SoundEvents.BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_OFF, SoundEvents.BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
package techreborn.blocks.misc;
|
package techreborn.blocks.misc;
|
||||||
|
|
||||||
import net.minecraft.block.TrapdoorBlock;
|
import net.minecraft.block.TrapdoorBlock;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
import techreborn.utils.InitUtils;
|
import techreborn.utils.InitUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,6 +34,6 @@ import techreborn.utils.InitUtils;
|
||||||
public class RubberTrapdoorBlock extends TrapdoorBlock {
|
public class RubberTrapdoorBlock extends TrapdoorBlock {
|
||||||
|
|
||||||
public RubberTrapdoorBlock() {
|
public RubberTrapdoorBlock() {
|
||||||
super(InitUtils.setupRubberBlockSettings(3.0F, 3.0F));
|
super(InitUtils.setupRubberBlockSettings(3.0F, 3.0F), SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE, SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -694,4 +694,10 @@ public class TechRebornConfig {
|
||||||
|
|
||||||
@Config(config = "world", category = "generation", key = "enableOilLakeGeneration", comment = "When enabled oil lakes will generate in the world")
|
@Config(config = "world", category = "generation", key = "enableOilLakeGeneration", comment = "When enabled oil lakes will generate in the world")
|
||||||
public static boolean enableOilLakeGeneration = true;
|
public static boolean enableOilLakeGeneration = true;
|
||||||
|
|
||||||
|
@Config(config = "world", category = "generation", key = "enableMetallurgistGeneration", comment = "When enabled metallurgist houses can generate in villages")
|
||||||
|
public static boolean enableMetallurgistGeneration = true;
|
||||||
|
|
||||||
|
@Config(config = "world", category = "generation", key = "enableElectricianGeneration", comment = "When enabled electrician houses can generate in villages")
|
||||||
|
public static boolean enableElectricianGeneration = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.Item.Settings;
|
import net.minecraft.item.Item.Settings;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.sound.BlockSoundGroup;
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
import reborncore.RebornRegistry;
|
import reborncore.RebornRegistry;
|
||||||
import reborncore.common.powerSystem.RcEnergyTier;
|
import reborncore.common.powerSystem.RcEnergyTier;
|
||||||
import team.reborn.energy.api.EnergyStorage;
|
import team.reborn.energy.api.EnergyStorage;
|
||||||
|
@ -72,10 +73,11 @@ public class ModRegistry {
|
||||||
registerApis();
|
registerApis();
|
||||||
TRVillager.registerVillagerTrades();
|
TRVillager.registerVillagerTrades();
|
||||||
TRVillager.registerWanderingTraderTrades();
|
TRVillager.registerWanderingTraderTrades();
|
||||||
|
TRVillager.registerVillagerHouses();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerBlocks() {
|
private static void registerBlocks() {
|
||||||
Settings itemGroup = new Item.Settings().group(TechReborn.ITEMGROUP);
|
Settings itemGroup = new Item.Settings();
|
||||||
Arrays.stream(Ores.values()).forEach(value -> RebornRegistry.registerBlock(value.block, itemGroup));
|
Arrays.stream(Ores.values()).forEach(value -> RebornRegistry.registerBlock(value.block, itemGroup));
|
||||||
StorageBlocks.blockStream().forEach(block -> RebornRegistry.registerBlock(block, itemGroup));
|
StorageBlocks.blockStream().forEach(block -> RebornRegistry.registerBlock(block, itemGroup));
|
||||||
Arrays.stream(MachineBlocks.values()).forEach(value -> {
|
Arrays.stream(MachineBlocks.values()).forEach(value -> {
|
||||||
|
@ -103,7 +105,7 @@ public class ModRegistry {
|
||||||
RebornRegistry.registerBlock(TRContent.RUBBER_SAPLING = InitUtils.setup(new BlockRubberSapling(), "rubber_sapling"), itemGroup);
|
RebornRegistry.registerBlock(TRContent.RUBBER_SAPLING = InitUtils.setup(new BlockRubberSapling(), "rubber_sapling"), itemGroup);
|
||||||
RebornRegistry.registerBlock(TRContent.RUBBER_SLAB = InitUtils.setup(new SlabBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F)), "rubber_slab"), itemGroup);
|
RebornRegistry.registerBlock(TRContent.RUBBER_SLAB = InitUtils.setup(new SlabBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F)), "rubber_slab"), itemGroup);
|
||||||
RebornRegistry.registerBlock(TRContent.RUBBER_FENCE = InitUtils.setup(new FenceBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F)), "rubber_fence"), itemGroup);
|
RebornRegistry.registerBlock(TRContent.RUBBER_FENCE = InitUtils.setup(new FenceBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F)), "rubber_fence"), itemGroup);
|
||||||
RebornRegistry.registerBlock(TRContent.RUBBER_FENCE_GATE = InitUtils.setup(new FenceGateBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F)), "rubber_fence_gate"), itemGroup);
|
RebornRegistry.registerBlock(TRContent.RUBBER_FENCE_GATE = InitUtils.setup(new FenceGateBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F), SoundEvents.BLOCK_FENCE_GATE_CLOSE, SoundEvents.BLOCK_FENCE_GATE_OPEN), "rubber_fence_gate"), itemGroup);
|
||||||
RebornRegistry.registerBlock(TRContent.RUBBER_STAIR = InitUtils.setup(new BlockRubberPlankStair(), "rubber_stair"), itemGroup);
|
RebornRegistry.registerBlock(TRContent.RUBBER_STAIR = InitUtils.setup(new BlockRubberPlankStair(), "rubber_stair"), itemGroup);
|
||||||
RebornRegistry.registerBlock(TRContent.RUBBER_TRAPDOOR = InitUtils.setup(new RubberTrapdoorBlock(), "rubber_trapdoor"), itemGroup);
|
RebornRegistry.registerBlock(TRContent.RUBBER_TRAPDOOR = InitUtils.setup(new RubberTrapdoorBlock(), "rubber_trapdoor"), itemGroup);
|
||||||
RebornRegistry.registerBlock(TRContent.RUBBER_BUTTON = InitUtils.setup(new RubberButtonBlock(), "rubber_button"), itemGroup);
|
RebornRegistry.registerBlock(TRContent.RUBBER_BUTTON = InitUtils.setup(new RubberButtonBlock(), "rubber_button"), itemGroup);
|
||||||
|
|
|
@ -26,7 +26,7 @@ package techreborn.events;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registries;
|
||||||
import reborncore.common.network.NetworkManager;
|
import reborncore.common.network.NetworkManager;
|
||||||
import techreborn.packets.ClientboundPackets;
|
import techreborn.packets.ClientboundPackets;
|
||||||
import techreborn.world.OreDepth;
|
import techreborn.world.OreDepth;
|
||||||
|
@ -52,7 +52,7 @@ public final class OreDepthSyncHandler {
|
||||||
public static void updateDepths(List<OreDepth> list) {
|
public static void updateDepths(List<OreDepth> list) {
|
||||||
synchronized (OreDepthSyncHandler.class) {
|
synchronized (OreDepthSyncHandler.class) {
|
||||||
oreDepthMap = list.stream()
|
oreDepthMap = list.stream()
|
||||||
.collect(Collectors.toMap(oreDepth -> Registry.BLOCK.get(oreDepth.identifier()), Function.identity()));
|
.collect(Collectors.toMap(oreDepth -> Registries.BLOCK.get(oreDepth.identifier()), Function.identity()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue