fixed some bugs to progress to stable

This commit is contained in:
ticticboooom
2021-07-19 14:27:29 +01:00
parent 1459e53b15
commit 815e41a6e3
29 changed files with 233 additions and 58 deletions

View File

@@ -21,7 +21,7 @@ apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'org.spongepowered.mixin'
version = '1.16.5-0.1.52-B' + getVersionNumber()
version = '1.16.5-0.1.53-B' + getVersionNumber()
group = 'com.ticticboooom.mods.mm' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'MasterfulMachinery'
java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8.

View File

@@ -39,8 +39,10 @@ public class MachinePortBlock extends Block {
private String textureOverride;
@Getter
private ResourceLocation overlay;
@Getter
private ResourceLocation portTypeId;
public MachinePortBlock(RegistryObject<TileEntityType<?>> type, String name, String controllerId, String textureOverride, ResourceLocation overlay) {
public MachinePortBlock(RegistryObject<TileEntityType<?>> type, String name, String controllerId, String textureOverride, ResourceLocation overlay, ResourceLocation portTypeId) {
super(AbstractBlock.Properties.create(Material.IRON).setRequiresTool().hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL).harvestLevel(0)
.harvestTool(ToolType.PICKAXE));
this.type = type;
@@ -48,6 +50,7 @@ public class MachinePortBlock extends Block {
this.controllerId = controllerId;
this.textureOverride = textureOverride;
this.overlay = overlay;
this.portTypeId = portTypeId;
}
@Override

View File

@@ -19,8 +19,9 @@ import net.minecraftforge.fml.RegistryObject;
import java.util.Random;
public class RotationMachinePortBlock extends MachinePortBlock implements IRotate {
public RotationMachinePortBlock(RegistryObject<TileEntityType<?>> type, String name, String controllerId, String textureOverride, ResourceLocation overlay) {
super(type, name, controllerId, textureOverride, overlay);
public RotationMachinePortBlock(RegistryObject<TileEntityType<?>> type, String name, String controllerId, String textureOverride, ResourceLocation overlay, ResourceLocation portTypeId) {
super(type, name, controllerId, textureOverride, overlay, portTypeId);
}
@Override

View File

@@ -5,7 +5,21 @@ import com.ticticboooom.mods.mm.MM;
import com.ticticboooom.mods.mm.block.ControllerBlock;
import com.ticticboooom.mods.mm.client.jei.category.MachineProcessRecipeCategory;
import com.ticticboooom.mods.mm.client.jei.category.MachineStructureRecipeCategory;
import com.ticticboooom.mods.mm.client.jei.ingredients.*;
import com.ticticboooom.mods.mm.client.jei.ingredients.as.StarlightIngredientHelper;
import com.ticticboooom.mods.mm.client.jei.ingredients.as.StarlightIngredientRenderer;
import com.ticticboooom.mods.mm.client.jei.ingredients.as.StarlightIngredientType;
import com.ticticboooom.mods.mm.client.jei.ingredients.energy.EnergyIngredientHelper;
import com.ticticboooom.mods.mm.client.jei.ingredients.energy.EnergyIngredientRenderer;
import com.ticticboooom.mods.mm.client.jei.ingredients.energy.EnergyIngredientType;
import com.ticticboooom.mods.mm.client.jei.ingredients.mana.ManaIngredientHelper;
import com.ticticboooom.mods.mm.client.jei.ingredients.mana.ManaIngredientRenderer;
import com.ticticboooom.mods.mm.client.jei.ingredients.mana.ManaIngredientType;
import com.ticticboooom.mods.mm.client.jei.ingredients.pressure.PNCPressureIngredientHelper;
import com.ticticboooom.mods.mm.client.jei.ingredients.pressure.PNCPressureIngredientRenderer;
import com.ticticboooom.mods.mm.client.jei.ingredients.pressure.PNCPressureIngredientType;
import com.ticticboooom.mods.mm.client.jei.ingredients.rotation.RotationIngredientHelper;
import com.ticticboooom.mods.mm.client.jei.ingredients.rotation.RotationIngredientRenderer;
import com.ticticboooom.mods.mm.client.jei.ingredients.rotation.RotationIngredientType;
import com.ticticboooom.mods.mm.data.MachineProcessRecipe;
import com.ticticboooom.mods.mm.data.MachineStructureRecipe;
import com.ticticboooom.mods.mm.registration.MMLoader;
@@ -40,6 +54,10 @@ public class MMJeiPlugin implements IModPlugin {
public static final StarlightIngredientRenderer STAR_TYPE_RENDERER = new StarlightIngredientRenderer();
public static final StarlightIngredientHelper STAR_TYPE_HELPER = new StarlightIngredientHelper();
public static final RotationIngredientType ROT_TYPE = new RotationIngredientType();
public static final RotationIngredientRenderer ROT_RENDERER = new RotationIngredientRenderer();
public static final RotationIngredientHelper ROT_HELPER = new RotationIngredientHelper();
@Override
public ResourceLocation getPluginUid() {
return new ResourceLocation(MM.ID, "jei_main");
@@ -51,6 +69,7 @@ public class MMJeiPlugin implements IModPlugin {
registration.register(MMJeiPlugin.PRESSURE_TYPE, ImmutableList.of(), PRESSURE_TYPE_HELPER, PRESSURE_TYPE_RENDERER);
registration.register(MMJeiPlugin.MANA_TYPE, ImmutableList.of(), MANA_TYPE_HELPER, MANA_TYPE_RENDERER);
registration.register(MMJeiPlugin.STAR_TYPE, ImmutableList.of(), STAR_TYPE_HELPER, STAR_TYPE_RENDERER);
registration.register(MMJeiPlugin.ROT_TYPE, ImmutableList.of(), ROT_HELPER, ROT_RENDERER);
}
@Override
@@ -59,6 +78,7 @@ public class MMJeiPlugin implements IModPlugin {
PRESSURE_TYPE_RENDERER.setHelpers(registration.getJeiHelpers());
MANA_TYPE_RENDERER.setHelpers(registration.getJeiHelpers());
STAR_TYPE_RENDERER.setHelpers(registration.getJeiHelpers());
ROT_RENDERER.setHelpers(registration.getJeiHelpers());
List<MachineStructureRecipe> structureRecipes = Minecraft.getInstance().world.getRecipeManager().getRecipesForType(RecipeTypes.MACHINE_STRUCTURE);
for (RegistryObject<ControllerBlock> block : MMLoader.BLOCKS) {
registration.addRecipes(structureRecipes.stream().filter(x -> x.getControllerId().contains(block.get().getControllerId())).collect(Collectors.toList()), new ResourceLocation(MM.ID, "machine_structure_" + block.get().getControllerId()));

View File

@@ -57,6 +57,7 @@ public class MachineStructureRecipeCategory implements IRecipeCategory<MachineSt
private Map<Integer, Integer> tagIndexes = new HashMap<>();
private Map<Integer, Integer> tagIndexCounter = new HashMap<>();
private float scaleFactor = 1F;
public MachineStructureRecipeCategory(IJeiHelpers helpers, ControllerBlock controller) {
this.helpers = helpers;
this.controller = controller;
@@ -87,7 +88,9 @@ public class MachineStructureRecipeCategory implements IRecipeCategory<MachineSt
return helpers.getGuiHelper().createDrawableIngredient(new ItemStack(MMSetup.BLUEPRINT.get(), 1));
}
private IDrawable getButton() {return helpers.getGuiHelper().createDrawable(slotRl, 0, 44, 18, 18);}
private IDrawable getButton() {
return helpers.getGuiHelper().createDrawable(slotRl, 0, 44, 18, 18);
}
@Override
public void setIngredients(MachineStructureRecipe machineStructureRecipe, IIngredients iIngredients) {
@@ -148,8 +151,8 @@ public class MachineStructureRecipeCategory implements IRecipeCategory<MachineSt
topY = Math.max(part.getPos().getY(), topY);
bottomY = Math.min(part.getPos().getY(), bottomY);
}
if (GLFW.glfwGetMouseButton(mc.getMainWindow().getHandle(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) != 0){
if (scrollLastPos == 0){
if (GLFW.glfwGetMouseButton(mc.getMainWindow().getHandle(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) != 0) {
if (scrollLastPos == 0) {
scrollLastPos = (int) mouseY;
}
scaleFactor += (mouseY - yLastMousePosition) * 0.05;
@@ -183,24 +186,20 @@ public class MachineStructureRecipeCategory implements IRecipeCategory<MachineSt
defaultState = with(defaultState, part.getProperties());
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(scaleFactor, -scaleFactor, scaleFactor))
.finalize(matrixStack);
.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(scaleFactor, -scaleFactor, scaleFactor))
.finalize(matrixStack);
}
} else if (!part.getTag().equals("")){
} else if (!part.getTag().equals("")) {
ResourceLocation resourceLocation = new ResourceLocation(part.getTag());
ITag<Block> tag = BlockTags.getCollection().getTagByID(resourceLocation);
if (tag != null){
if (tag != null) {
Integer index = tagIndexes.get(i);
Block block = tag.getAllElements().get((int) Math.floor(index / 30.0));
tagIndexCounter.put(i, tagIndexCounter.get(i) + 1);
if (tagIndexCounter.get(i) > 30){
tagIndexCounter.put(i, 0);
index++;
}
if (index >= tag.getAllElements().size()) {
Block block = tag.getAllElements().get((int) Math.floor(index / 50.0));
index++;
if (index >= (tag.getAllElements().size()) * 50) {
index = 0;
}
@@ -261,10 +260,10 @@ public class MachineStructureRecipeCategory implements IRecipeCategory<MachineSt
bottomY = Math.min(part.getPos().getY(), bottomY);
}
if (!slicingActive){
if (!slicingActive) {
slicingActive = true;
sliceY = bottomY;
} else if (sliceY == topY){
} else if (sliceY == topY) {
slicingActive = false;
sliceY = 0;
} else {
@@ -281,12 +280,12 @@ public class MachineStructureRecipeCategory implements IRecipeCategory<MachineSt
for (Map.Entry<String, String> stringStringEntry : props.entrySet()) {
for (Property<?> property : defaultState.getProperties()) {
Optional<?> o = property.parseValue(stringStringEntry.getValue());
if (!o.isPresent()){
if (!o.isPresent()) {
return defaultState;
}
for (Comparable<?> allowedValue : property.getAllowedValues()) {
defaultState = defaultState.cycleValue(property);
if (defaultState.get(property).equals(o.get())){
if (defaultState.get(property).equals(o.get())) {
return defaultState;
}
}

View File

@@ -1,4 +1,4 @@
package com.ticticboooom.mods.mm.client.jei.ingredients;
package com.ticticboooom.mods.mm.client.jei.ingredients.as;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.PressureStack;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.StarlightStack;

View File

@@ -1,4 +1,4 @@
package com.ticticboooom.mods.mm.client.jei.ingredients;
package com.ticticboooom.mods.mm.client.jei.ingredients.as;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.matrix.MatrixStack;

View File

@@ -1,4 +1,4 @@
package com.ticticboooom.mods.mm.client.jei.ingredients;
package com.ticticboooom.mods.mm.client.jei.ingredients.as;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.PressureStack;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.StarlightStack;

View File

@@ -1,4 +1,4 @@
package com.ticticboooom.mods.mm.client.jei.ingredients;
package com.ticticboooom.mods.mm.client.jei.ingredients.energy;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.EnergyStack;
import mezz.jei.api.ingredients.IIngredientHelper;

View File

@@ -1,4 +1,4 @@
package com.ticticboooom.mods.mm.client.jei.ingredients;
package com.ticticboooom.mods.mm.client.jei.ingredients.energy;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;

View File

@@ -1,4 +1,4 @@
package com.ticticboooom.mods.mm.client.jei.ingredients;
package com.ticticboooom.mods.mm.client.jei.ingredients.energy;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.EnergyStack;
import mezz.jei.api.ingredients.IIngredientType;

View File

@@ -1,4 +1,4 @@
package com.ticticboooom.mods.mm.client.jei.ingredients;
package com.ticticboooom.mods.mm.client.jei.ingredients.mana;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.PressureStack;
import com.ticticboooom.mods.mm.inventory.botania.PortManaInventory;

View File

@@ -1,4 +1,4 @@
package com.ticticboooom.mods.mm.client.jei.ingredients;
package com.ticticboooom.mods.mm.client.jei.ingredients.mana;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.matrix.MatrixStack;

View File

@@ -1,4 +1,4 @@
package com.ticticboooom.mods.mm.client.jei.ingredients;
package com.ticticboooom.mods.mm.client.jei.ingredients.mana;
import com.ticticboooom.mods.mm.inventory.botania.PortManaInventory;
import mezz.jei.api.ingredients.IIngredientType;

View File

@@ -0,0 +1,15 @@
package com.ticticboooom.mods.mm.client.jei.ingredients.model;
import lombok.Getter;
import lombok.Setter;
public class RotationStack {
@Getter
@Setter
private float speed;
public RotationStack(float speed){
this.speed = speed;
}
}

View File

@@ -1,4 +1,4 @@
package com.ticticboooom.mods.mm.client.jei.ingredients;
package com.ticticboooom.mods.mm.client.jei.ingredients.pressure;
import com.ticticboooom.mods.mm.MM;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.PressureStack;

View File

@@ -1,4 +1,4 @@
package com.ticticboooom.mods.mm.client.jei.ingredients;
package com.ticticboooom.mods.mm.client.jei.ingredients.pressure;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.matrix.MatrixStack;

View File

@@ -1,4 +1,4 @@
package com.ticticboooom.mods.mm.client.jei.ingredients;
package com.ticticboooom.mods.mm.client.jei.ingredients.pressure;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.PressureStack;
import mezz.jei.api.ingredients.IIngredientType;

View File

@@ -0,0 +1,46 @@
package com.ticticboooom.mods.mm.client.jei.ingredients.rotation;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.RotationStack;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.StarlightStack;
import mezz.jei.api.ingredients.IIngredientHelper;
import javax.annotation.Nullable;
public class RotationIngredientHelper implements IIngredientHelper<RotationStack> {
@Nullable
@Override
public RotationStack getMatch(Iterable<RotationStack> ingredients, RotationStack ingredientToMatch) {
return ingredientToMatch;
}
@Override
public String getDisplayName(RotationStack ingredient) {
return "SU";
}
@Override
public String getUniqueId(RotationStack ingredient) {
return ingredient.getSpeed() + "";
}
@Override
public String getModId(RotationStack ingredient) {
return "create";
}
@Override
public String getResourceId(RotationStack ingredient) {
return "rotation";
}
@Override
public RotationStack copyIngredient(RotationStack ingredient) {
return new RotationStack(ingredient.getSpeed());
}
@Override
public String getErrorInfo(@Nullable RotationStack ingredient) {
return "Error";
}
}

View File

@@ -0,0 +1,48 @@
package com.ticticboooom.mods.mm.client.jei.ingredients.rotation;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllItems;
import com.ticticboooom.mods.mm.MM;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.RotationStack;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.StarlightStack;
import lombok.Setter;
import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.drawable.IDrawableStatic;
import mezz.jei.api.helpers.IJeiHelpers;
import mezz.jei.api.ingredients.IIngredientRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.common.util.Lazy;
import javax.annotation.Nullable;
import java.util.List;
public class RotationIngredientRenderer implements IIngredientRenderer<RotationStack> {
@Setter
private IJeiHelpers helpers;
@Override
public void render(MatrixStack matrixStack, int xPosition, int yPosition, @Nullable RotationStack ingredient) {
if (ingredient != null) {
IDrawableStatic drawable = helpers.getGuiHelper().createDrawable(new ResourceLocation(MM.ID, "textures/gui/slot_parts.png"), 1, 98, 16, 16);
drawable.draw(matrixStack, xPosition, yPosition);
}
}
@Override
public List<ITextComponent> getTooltip(RotationStack ingredient, ITooltipFlag tooltipFlag) {
return Lists.newArrayList(
new StringTextComponent("Create Rotation"),
new StringTextComponent(ingredient.getSpeed() + " Speed")
);
}
}

View File

@@ -0,0 +1,12 @@
package com.ticticboooom.mods.mm.client.jei.ingredients.rotation;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.RotationStack;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.StarlightStack;
import mezz.jei.api.ingredients.IIngredientType;
public class RotationIngredientType implements IIngredientType<RotationStack> {
@Override
public Class<? extends RotationStack> getIngredientClass() {
return RotationStack.class;
}
}

View File

@@ -4,8 +4,9 @@ import com.ticticboooom.mods.mm.MM;
import com.ticticboooom.mods.mm.block.ControllerBlock;
import com.ticticboooom.mods.mm.block.MachinePortBlock;
import com.ticticboooom.mods.mm.helper.RLUtils;
import com.ticticboooom.mods.mm.model.ModelOverrideModel;
import com.ticticboooom.mods.mm.ports.MasterfulPortType;
import com.ticticboooom.mods.mm.registration.MMLoader;
import com.ticticboooom.mods.mm.registration.MMPorts;
import com.ticticboooom.mods.mm.registration.MMSetup;
import net.minecraft.block.Block;
import net.minecraft.block.DirectionalBlock;
@@ -14,8 +15,10 @@ import net.minecraft.client.renderer.RenderType;
import net.minecraft.data.DataGenerator;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ForgeRenderTypes;
import net.minecraftforge.client.model.generators.*;
import net.minecraftforge.client.model.generators.BlockStateProvider;
import net.minecraftforge.client.model.generators.ModelBuilder;
import net.minecraftforge.client.model.generators.ModelFile;
import net.minecraftforge.client.model.generators.VariantBlockStateBuilder;
import net.minecraftforge.client.model.generators.loaders.MultiLayerModelBuilder;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.fml.RegistryObject;
@@ -26,14 +29,13 @@ public class MMBlockStateProvider extends BlockStateProvider {
public MMBlockStateProvider(DataGenerator gen, ExistingFileHelper exFileHelper) {
super(gen, MM.ID, exFileHelper);
}
private static final ResourceLocation BASE_TEXTURE = new ResourceLocation(MM.ID, "block/base_block");
public static final ResourceLocation BASE_TEXTURE = new ResourceLocation(MM.ID, "block/base_block");
private static final ResourceLocation CONTROLLER_TEXTURE = new ResourceLocation(MM.ID, "block/controller_cutout");
@Override
protected void registerStatesAndModels() {
for (RegistryObject<ControllerBlock> controller : MMLoader.BLOCKS) {
if (!controller.isPresent()){
if (!controller.isPresent()) {
return;
}
dynamicBlockNorthOverlay(controller.getId(), controller.get().getTexOverride() != null ? RLUtils.toRL(controller.get().getTexOverride()) : BASE_TEXTURE, CONTROLLER_TEXTURE);
@@ -47,12 +49,12 @@ public class MMBlockStateProvider extends BlockStateProvider {
}
for (RegistryObject<MachinePortBlock> port : MMLoader.IPORT_BLOCKS) {
dynamicBlock(port.getId(), port.get().getTextureOverride() != null ? RLUtils.toRL(port.get().getTextureOverride()) : BASE_TEXTURE, port.get().getOverlay());
simpleBlock(port.get(), new ModelFile.UncheckedModelFile(new ResourceLocation(MM.ID, "block/" + port.getId().getPath())));
MasterfulPortType masterfulPortType = MMPorts.PORTS.get(port.get().getPortTypeId());
masterfulPortType.getParser().generateBlockStates(this, true, port);
}
for (RegistryObject<MachinePortBlock> port : MMLoader.OPORT_BLOCKS) {
dynamicBlock(port.getId(), port.get().getTextureOverride() != null ? RLUtils.toRL(port.get().getTextureOverride()) : BASE_TEXTURE, port.get().getOverlay());
simpleBlock(port.get(), new ModelFile.UncheckedModelFile(new ResourceLocation(MM.ID, "block/" + port.getId().getPath())));
MasterfulPortType masterfulPortType = MMPorts.PORTS.get(port.get().getPortTypeId());
masterfulPortType.getParser().generateBlockStates(this, false, port);
}
directionalState(MMSetup.PROJECTOR_BLOCK.get());

View File

@@ -67,6 +67,6 @@ public class MekInfusePortParser extends PortFactory {
@Override
public ResourceLocation getOutputOverlay() {
return new ResourceLocation(MM.ID, "block/compat_ports/mekanism_infusion_input_cutout");
return new ResourceLocation(MM.ID, "block/compat_ports/mekanism_infusion_output_cutout");
}
}

View File

@@ -1,8 +1,11 @@
package com.ticticboooom.mods.mm.ports.parser;
import com.google.gson.JsonObject;
import com.ticticboooom.mods.mm.MM;
import com.ticticboooom.mods.mm.block.MachinePortBlock;
import com.ticticboooom.mods.mm.block.tile.MachinePortBlockEntity;
import com.ticticboooom.mods.mm.datagen.gen.runtime.MMBlockStateProvider;
import com.ticticboooom.mods.mm.helper.RLUtils;
import com.ticticboooom.mods.mm.model.ModelOverrideModel;
import com.ticticboooom.mods.mm.ports.state.PortState;
import com.ticticboooom.mods.mm.ports.storage.PortStorage;
@@ -14,6 +17,8 @@ import net.minecraft.inventory.container.ContainerType;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.generators.BlockStateProvider;
import net.minecraftforge.client.model.generators.ModelFile;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
@@ -22,16 +27,35 @@ import java.util.function.Supplier;
public abstract class PortFactory {
public abstract PortState createState(JsonObject obj);
public abstract PortState createState(PacketBuffer buf);
public abstract Supplier<PortStorage> createStorage(JsonObject obj);
public abstract void write(PacketBuffer buf, PortState state);
public abstract void setIngredients(IIngredients ingredients, List<?> stacks, boolean input);
public abstract ResourceLocation getInputOverlay();
public abstract ResourceLocation getOutputOverlay();
public RegistryObject<TileEntityType<?>> registerTileEntity(String id, DeferredRegister<TileEntityType<?>> reg, Registerable<RegistryObject<TileEntityType<?>>>tile, Registerable<RegistryObject<MachinePortBlock>> block, Registerable<RegistryObject<ContainerType<?>>> containerType, Supplier<PortStorage> portStorage, boolean isInput){
public RegistryObject<TileEntityType<?>> registerTileEntity(String id, DeferredRegister<TileEntityType<?>> reg, Registerable<RegistryObject<TileEntityType<?>>> tile, Registerable<RegistryObject<MachinePortBlock>> block, Registerable<RegistryObject<ContainerType<?>>> containerType, Supplier<PortStorage> portStorage, boolean isInput) {
return reg.register(id, () -> TileEntityType.Builder.create(() -> new MachinePortBlockEntity(tile.get().get(), containerType.get().get(), portStorage.get(), isInput), block.get().get()).build(null));
}
public RegistryObject<MachinePortBlock> registerBlock(String id, DeferredRegister<Block> reg, Registerable<RegistryObject<TileEntityType<?>>> type, String name, String controllerId, String textureOverride, ResourceLocation overlay){
return reg.register(id, () -> new MachinePortBlock(type.get(), name, controllerId, textureOverride, overlay));
public RegistryObject<MachinePortBlock> registerBlock(String id, DeferredRegister<Block> reg, Registerable<RegistryObject<TileEntityType<?>>> type, String name, String controllerId, String textureOverride, ResourceLocation overlay, ResourceLocation portTypeId) {
return reg.register(id, () -> new MachinePortBlock(type.get(), name, controllerId, textureOverride, overlay, portTypeId));
}
public void generateBlockStates(MMBlockStateProvider provider, boolean input, RegistryObject<MachinePortBlock> port) {
if (input) {
provider.dynamicBlock(port.getId(), port.get().getTextureOverride() != null ? RLUtils.toRL(port.get().getTextureOverride()) : MMBlockStateProvider.BASE_TEXTURE, port.get().getOverlay());
provider.simpleBlock(port.get(), new ModelFile.UncheckedModelFile(new ResourceLocation(MM.ID, "block/" + port.getId().getPath())));
} else {
provider.dynamicBlock(port.getId(), port.get().getTextureOverride() != null ? RLUtils.toRL(port.get().getTextureOverride()) : MMBlockStateProvider.BASE_TEXTURE, port.get().getOverlay());
provider.simpleBlock(port.get(), new ModelFile.UncheckedModelFile(new ResourceLocation(MM.ID, "block/" + port.getId().getPath())));
}
}
}

View File

@@ -80,7 +80,7 @@ public class RotationPortParser extends PortFactory {
}
@Override
public RegistryObject<MachinePortBlock> registerBlock(String id, DeferredRegister<Block> reg, Registerable<RegistryObject<TileEntityType<?>>> type, String name, String controllerId, String textureOverride, ResourceLocation overlay) {
return reg.register(id, () -> new RotationMachinePortBlock(type.get(), name, controllerId, textureOverride, overlay));
public RegistryObject<MachinePortBlock> registerBlock(String id, DeferredRegister<Block> reg, Registerable<RegistryObject<TileEntityType<?>>> type, String name, String controllerId, String textureOverride, ResourceLocation overlay, ResourceLocation portTypeId) {
return reg.register(id, () -> new RotationMachinePortBlock(type.get(), name, controllerId, textureOverride, overlay, portTypeId));
}
}

View File

@@ -5,10 +5,13 @@ import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.ticticboooom.mods.mm.MM;
import com.ticticboooom.mods.mm.client.jei.MMJeiPlugin;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.PressureStack;
import com.ticticboooom.mods.mm.client.jei.ingredients.model.RotationStack;
import com.ticticboooom.mods.mm.ports.storage.PortStorage;
import com.ticticboooom.mods.mm.ports.storage.RotationPortStorage;
import mezz.jei.api.gui.IRecipeLayout;
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 net.minecraft.util.ResourceLocation;
@@ -78,7 +81,9 @@ public class RotationPortState extends PortState {
@Override
public void setupRecipe(IRecipeLayout layout, Integer typeIndex, int x, int y, boolean input) {
IGuiIngredientGroup<RotationStack> group = layout.getIngredientsGroup(MMJeiPlugin.ROT_TYPE);
group.init(typeIndex, input, x+ 1, y +1);
group.set(typeIndex, new RotationStack(speed));
}
@Override

View File

@@ -103,7 +103,7 @@ public class MMLoader {
Registerable<RegistryObject<MachinePortBlock>> block = new Registerable<>();
Registerable<RegistryObject<ContainerType<?>>> cont = new Registerable<>();
cont.set(MMSetup.CONTAINER_REG.register(controllerId + "_" + id + "_port_" + resourceLocation.getPath() + "_input", () -> IForgeContainerType.create((i, o, u) -> new PortBlockContainer(cont.get().get(), i, o, u))));
block.set(value.getParser().registerBlock(controllerId + "_" + id + "_port_" + resourceLocation.getPath() + "_input", MMSetup.BLOCKS_REG, tile, name, controllerId, portTextureOverrideFinal, value.getParser().getInputOverlay()));
block.set(value.getParser().registerBlock(controllerId + "_" + id + "_port_" + resourceLocation.getPath() + "_input", MMSetup.BLOCKS_REG, tile, name, controllerId, portTextureOverrideFinal, value.getParser().getInputOverlay(), resourceLocation));
tile.set(value.getParser().registerTileEntity(controllerId + "_" + id + "_port_" + resourceLocation.getPath() + "_input", MMSetup.TILES_REG, tile, block, cont, data, true));
MMSetup.ITEMS_REG.register(controllerId + "_" + id + "_port_" + resourceLocation.getPath() + "_input", () -> new BlockItem(block.get().get(), new Item.Properties().group(MASTERFUL_ITEM_GROUP)));
PORT_CONTAINERS.add(cont.get());
@@ -115,7 +115,7 @@ public class MMLoader {
Registerable<RegistryObject<MachinePortBlock>> block = new Registerable<>();
Registerable<RegistryObject<ContainerType<?>>> cont = new Registerable<>();
cont.set(MMSetup.CONTAINER_REG.register(controllerId + "_" + id + "_port_" + resourceLocation.getPath() + "_output", () -> IForgeContainerType.create((i, o, u) -> new PortBlockContainer(cont.get().get(), i, o, u))));
block.set(value.getParser().registerBlock(controllerId + "_" + id + "_port_" + resourceLocation.getPath() + "_output", MMSetup.BLOCKS_REG, tile, name, controllerId, portTextureOverrideFinal, value.getParser().getOutputOverlay()));
block.set(value.getParser().registerBlock(controllerId + "_" + id + "_port_" + resourceLocation.getPath() + "_output", MMSetup.BLOCKS_REG, tile, name, controllerId, portTextureOverrideFinal, value.getParser().getOutputOverlay(), resourceLocation));
tile.set(value.getParser().registerTileEntity(controllerId + "_" + id + "_port_" + resourceLocation.getPath() + "_output", MMSetup.TILES_REG, tile, block, cont, data, false));
MMSetup.ITEMS_REG.register(controllerId + "_" + id + "_port_" + resourceLocation.getPath() + "_output", () -> new BlockItem(block.get().get(), new Item.Properties().group(MASTERFUL_ITEM_GROUP)));
PORT_CONTAINERS.add(cont.get());

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -1,2 +1,2 @@
#Sat Jul 17 00:12:57 BST 2021
VERSION_CODE=658
#Mon Jul 19 14:25:31 BST 2021
VERSION_CODE=710