mirror of
https://github.com/TicTicBoooom-Mods/MasterfulMachinery.git
synced 2026-03-18 21:40:34 +01:00
some jei bug fixes
This commit is contained in:
17
build.gradle
17
build.gradle
@@ -20,7 +20,7 @@ apply plugin: 'net.minecraftforge.gradle'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = '1.16.5-0.1.31-T' + System.currentTimeMillis()
|
||||
version = '1.16.5-0.1.32-T' + System.currentTimeMillis()
|
||||
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'MasterfulMachinery'
|
||||
|
||||
@@ -152,22 +152,23 @@ dependencies {
|
||||
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
|
||||
compileOnly 'org.projectlombok:lombok:1.18.18'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.18'
|
||||
minecraft 'net.minecraftforge:forge:1.16.5-36.1.16'
|
||||
minecraft 'net.minecraftforge:forge:1.16.5-36.1.23'
|
||||
|
||||
shade 'com.github.marschall:memoryfilesystem:2.1.0'
|
||||
|
||||
implementation fg.deobf("mekanism:Mekanism:${mekanism_version}")// core
|
||||
runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:additions")// Mekanism: Additions
|
||||
runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:generators")// Mekanism: Generators
|
||||
runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:tools")// Mekanism: Tools
|
||||
compileOnly fg.deobf("mekanism:Mekanism:${mekanism_version}")// core
|
||||
// runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:additions")// Mekanism: Additions
|
||||
// runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:generators")// Mekanism: Generators
|
||||
// runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:tools")// Mekanism: Tools
|
||||
|
||||
compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api")
|
||||
// at runtime, use the full JEI jar
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}")
|
||||
implementation fg.deobf('me.desht.pneumaticcraft:pneumaticcraft-repressurized:1.16.5-2.12.2-186');
|
||||
implementation fg.deobf("curse.maven:create-328085:3278516")
|
||||
// implementation fg.deobf("curse.maven:astral-sorcery-241721:3156477")
|
||||
// implementation fg.deobf("curse.maven:curios-309927:3275653")
|
||||
implementation fg.deobf("curse.maven:astral-sorcery-241721:3156477")
|
||||
implementation fg.deobf("curse.maven:curios-309927:3275653")
|
||||
implementation fg.deobf("curse.maven:observerlib-316833:3162044")
|
||||
|
||||
|
||||
// You may put jars on which you depend on in ./libs or you may define them like so..
|
||||
|
||||
@@ -3,33 +3,21 @@ package com.ticticboooom.mods.mm.client.jei.category;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.ticticboooom.mods.mm.MM;
|
||||
import com.ticticboooom.mods.mm.data.MachineProcessRecipe;
|
||||
import com.ticticboooom.mods.mm.helper.RLUtils;
|
||||
import com.ticticboooom.mods.mm.ports.MasterfulPortType;
|
||||
import com.ticticboooom.mods.mm.ports.state.FluidPortState;
|
||||
import com.ticticboooom.mods.mm.ports.state.ItemPortState;
|
||||
import com.ticticboooom.mods.mm.ports.state.PortState;
|
||||
import com.ticticboooom.mods.mm.ports.storage.MekGasPortStorage;
|
||||
import com.ticticboooom.mods.mm.registration.MMPorts;
|
||||
import com.ticticboooom.mods.mm.registration.RecipeTypes;
|
||||
import mekanism.api.chemical.gas.GasStack;
|
||||
import mekanism.api.recipes.inputs.chemical.ChemicalIngredientDeserializer;
|
||||
import mekanism.api.recipes.inputs.chemical.GasStackIngredient;
|
||||
import mekanism.client.jei.MekanismJEI;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.drawable.IDrawable;
|
||||
import mezz.jei.api.gui.drawable.IDrawableStatic;
|
||||
import mezz.jei.api.gui.ingredient.IGuiIngredientGroup;
|
||||
import mezz.jei.api.helpers.IJeiHelpers;
|
||||
import mezz.jei.api.ingredients.IIngredientType;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MachineProcessRecipeCategory implements IRecipeCategory<MachineProcessRecipe> {
|
||||
|
||||
@@ -75,19 +63,15 @@ public class MachineProcessRecipeCategory implements IRecipeCategory<MachineProc
|
||||
Map<ResourceLocation, List<?>> inputStacks = new HashMap<>();
|
||||
Map<ResourceLocation, List<?>> outputStacks = new HashMap<>();
|
||||
|
||||
for (Map.Entry<ResourceLocation, MasterfulPortType> resource : MMPorts.PORTS.entrySet()) {
|
||||
ResourceLocation registryName = resource.getKey();
|
||||
inputStacks.put(registryName, new ArrayList<MasterfulPortType>());
|
||||
outputStacks.put(registryName, new ArrayList<MasterfulPortType>());
|
||||
}
|
||||
|
||||
for (PortState input : recipe.getInputs()) {
|
||||
inputStacks.putIfAbsent(input.getName(), new ArrayList<MasterfulPortType>());
|
||||
List<?> stacks = inputStacks.getOrDefault(input.getName(), new ArrayList<>());
|
||||
stacks.addAll(input.getIngredient(true));
|
||||
inputStacks.put(input.getName(), stacks);
|
||||
}
|
||||
|
||||
for (PortState output : recipe.getOutputs()) {
|
||||
outputStacks.putIfAbsent(output.getName(), new ArrayList<MasterfulPortType>());
|
||||
List<?> stacks = outputStacks.getOrDefault(output.getName(), new ArrayList<>());
|
||||
stacks.addAll(output.getIngredient(true));
|
||||
outputStacks.put(output.getName(), stacks);
|
||||
|
||||
@@ -20,6 +20,8 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -31,7 +33,9 @@ import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MachineStructureRecipeCategory implements IRecipeCategory<MachineStructureRecipe> {
|
||||
@@ -48,7 +52,8 @@ public class MachineStructureRecipeCategory implements IRecipeCategory<MachineSt
|
||||
private double yLastMousePosition = 0;
|
||||
private int sliceY = 0;
|
||||
private boolean slicingActive = false;
|
||||
|
||||
private Map<Integer, Integer> tagIndexes = new HashMap<>();
|
||||
private Map<Integer, Integer> tagIndexCounter = new HashMap<>();
|
||||
public MachineStructureRecipeCategory(IJeiHelpers helpers, ControllerBlock controller) {
|
||||
this.helpers = helpers;
|
||||
this.controller = controller;
|
||||
@@ -146,7 +151,10 @@ public class MachineStructureRecipeCategory implements IRecipeCategory<MachineSt
|
||||
parts = parts.stream().filter(x -> x.getPos().getY() == sliceY).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for (MachineStructureRecipeKeyModel part : parts) {
|
||||
tagIndexes.putIfAbsent(i, 0);
|
||||
tagIndexCounter.putIfAbsent(i, 0);
|
||||
if (part.getBlock().isEmpty() && part.getTag().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
@@ -156,13 +164,41 @@ public class MachineStructureRecipeCategory implements IRecipeCategory<MachineSt
|
||||
if (!part.getBlock().equals("")) {
|
||||
ResourceLocation resourceLocation = new ResourceLocation(part.getBlock());
|
||||
Block block = ForgeRegistries.BLOCKS.getValue(resourceLocation);
|
||||
if (block != null){
|
||||
BlockState defaultState = block.getDefaultState();
|
||||
new GuiBlockRenderBuilder(defaultState).at(bp)
|
||||
.withPrePosition(new Vector3f(6.5f, -5, 10))
|
||||
.withRotation(new Quaternion(new Vector3f(1, 0, 0), 15 + yRotation, true))
|
||||
.withRotation(new Quaternion(new Vector3f(0, -1, 0), 225 - xRotation, true))
|
||||
.withScale(new Vector3f(12f, -12, 12))
|
||||
.finalize(matrixStack);
|
||||
new GuiBlockRenderBuilder(defaultState).at(bp)
|
||||
.withPrePosition(new Vector3f(6.5f, -5, 10))
|
||||
.withRotation(new Quaternion(new Vector3f(1, 0, 0), 15 + yRotation, true))
|
||||
.withRotation(new Quaternion(new Vector3f(0, -1, 0), 225 - xRotation, true))
|
||||
.withScale(new Vector3f(12f, -12, 12))
|
||||
.finalize(matrixStack);
|
||||
}
|
||||
} else if (!part.getTag().equals("")){
|
||||
ResourceLocation resourceLocation = new ResourceLocation(part.getTag());
|
||||
ITag<Block> tag = BlockTags.getCollection().getTagByID(resourceLocation);
|
||||
if (tag != null){
|
||||
Integer index = tagIndexes.get(i);
|
||||
|
||||
Block block = tag.getAllElements().get(index);
|
||||
tagIndexCounter.put(i, tagIndexCounter.get(i) + 1);
|
||||
if (tagIndexCounter.get(i) > 30){
|
||||
tagIndexCounter.put(i, 0);
|
||||
index++;
|
||||
}
|
||||
if (index >= tag.getAllElements().size()){
|
||||
index = 0;
|
||||
}
|
||||
tagIndexes.put(i, index);
|
||||
if (block != null) {
|
||||
BlockState defaultState = block.getDefaultState();
|
||||
new GuiBlockRenderBuilder(defaultState).at(bp)
|
||||
.withPrePosition(new Vector3f(6.5f, -5, 10))
|
||||
.withRotation(new Quaternion(new Vector3f(1, 0, 0), 15 + yRotation, true))
|
||||
.withRotation(new Quaternion(new Vector3f(0, -1, 0), 225 - xRotation, true))
|
||||
.withScale(new Vector3f(12f, -12, 12))
|
||||
.finalize(matrixStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sliceY == 0) {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.ticticboooom.mods.mm.client.jei.category.render;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class AirBlockReader implements IBlockReader {
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity getTileEntity(BlockPos pos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlockState(BlockPos pos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidState getFluidState(BlockPos pos) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.ticticboooom.mods.mm.client.util;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.ticticboooom.mods.mm.client.jei.category.render.AirBlockReader;
|
||||
import mekanism.client.model.BaseModelCache;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -16,6 +17,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.vector.Quaternion;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraftforge.client.model.data.EmptyModelData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -30,17 +32,20 @@ public class GuiBlockRenderBuilder {
|
||||
private Vector3f prePosition = new Vector3f();
|
||||
private TileEntityRenderer<TileEntity> ter = null;
|
||||
private TileEntity tile;
|
||||
|
||||
private static final IBlockReader reader= new AirBlockReader();
|
||||
public GuiBlockRenderBuilder(BlockState blockState) {
|
||||
this.blockState = blockState;
|
||||
position = new BlockPos(0, 0, 0);
|
||||
tile = blockState.createTileEntity(Minecraft.getInstance().world);
|
||||
tile = blockState.createTileEntity(reader);
|
||||
if (tile != null) {
|
||||
ter = TileEntityRendererDispatcher.instance.getRenderer(tile);
|
||||
}
|
||||
}
|
||||
|
||||
public GuiBlockRenderBuilder at(BlockPos position) {
|
||||
if (tile != null) {
|
||||
tile.setWorldAndPos(Minecraft.getInstance().world, BlockPos.ZERO);
|
||||
}
|
||||
this.position = position;
|
||||
return this;
|
||||
}
|
||||
@@ -81,9 +86,10 @@ public class GuiBlockRenderBuilder {
|
||||
BlockRendererDispatcher brd = Minecraft.getInstance().getBlockRendererDispatcher();
|
||||
ms.push();
|
||||
transformMatrix(ms);
|
||||
|
||||
brd.renderBlock(blockState, ms, buf, 0xF000F0, OverlayTexture.NO_OVERLAY, EmptyModelData.INSTANCE);
|
||||
if (ter != null) {
|
||||
ter.render(tile, 1.0f, ms, buf, 0, 1);
|
||||
ter.render(tile, 4.f, ms, buf, 0xF000F0, OverlayTexture.NO_OVERLAY);
|
||||
}
|
||||
buf.finish();
|
||||
ms.pop();
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.ticticboooom.mods.mm.inventory.astral;
|
||||
|
||||
import hellfirepvp.astralsorcery.common.starlight.IStarlightTransmission;
|
||||
import hellfirepvp.astralsorcery.common.starlight.transmission.base.SimplePrismTransmissionNode;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class MMStarlightTransmission implements IStarlightTransmission<SimplePrismTransmissionNode> {
|
||||
|
||||
private final World world;
|
||||
private final BlockPos pos;
|
||||
|
||||
public MMStarlightTransmission(World world, BlockPos pos) {
|
||||
this.world = world;
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockPos getTrPos() {
|
||||
return pos;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public World getTrWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public SimplePrismTransmissionNode provideTransmissionNode(BlockPos blockPos) {
|
||||
return new SimplePrismTransmissionNode(blockPos);
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,6 @@ import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.serialization.DataResult;
|
||||
import com.mojang.serialization.JsonOps;
|
||||
import com.ticticboooom.mods.mm.MM;
|
||||
import com.ticticboooom.mods.mm.client.jei.category.MMJeiPlugin;
|
||||
import com.ticticboooom.mods.mm.client.jei.ingredients.model.PressureStack;
|
||||
import com.ticticboooom.mods.mm.ports.state.PneumaticPortState;
|
||||
import com.ticticboooom.mods.mm.ports.state.PortState;
|
||||
import com.ticticboooom.mods.mm.ports.state.RotationPortState;
|
||||
import com.ticticboooom.mods.mm.ports.storage.PortStorage;
|
||||
|
||||
@@ -82,10 +82,11 @@ public class PneumaticPortStorage extends PortStorage {
|
||||
float amount = inv.getPressure() / inv.getCriticalPressure();
|
||||
screen.blit(stack, left + barOffsetX, top + barOffsetY, 193, 18, 18, (int) (108 * amount));
|
||||
|
||||
AbstractGui.drawString(stack, Minecraft.getInstance().fontRenderer, NumberFormat.getInstance().format(inv.getPressure()) + "P", left + 30, top + 60, 0xfefefe);
|
||||
AbstractGui.drawCenteredString(stack, Minecraft.getInstance().fontRenderer, inv.getAir() + " Air", left + mouseX + 9 + 1, top + mouseY + 30, 0xfefefe);
|
||||
AbstractGui.drawCenteredString(stack, Minecraft.getInstance().fontRenderer, NumberFormat.getInstance().format(inv.getPressure()) + "P", left + 50, top + 80, 0xfefefe);
|
||||
AbstractGui.drawCenteredString(stack, Minecraft.getInstance().fontRenderer, inv.getAir() + " Air", left + 50, top + 80, 0xfefefe);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(MachinePortBlockEntity tile) {
|
||||
this.inv.tick(tile);
|
||||
|
||||
Reference in New Issue
Block a user