diff --git a/build.gradle b/build.gradle index 7e2cbb6..dd0cd93 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true - + classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' } } @@ -19,9 +19,10 @@ apply plugin: 'net.minecraftforge.gradle' // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. apply plugin: 'eclipse' apply plugin: 'maven-publish' +apply plugin: 'org.spongepowered.mixin' -version = '1.16.5-0.1.43-B' + getVersionNumber() -group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html +version = '1.16.5-0.1.47-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. @@ -45,7 +46,7 @@ minecraft { // Simply re-run your setup task after changing the mappings to update your workspace. mappings channel: 'snapshot', version: '20210309-1.16.5' // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. - + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Default run configurations. @@ -53,6 +54,7 @@ minecraft { runs { client { workingDirectory project.file('run') + arg '-mixin.config=masterfulmachinery.mixins.json' // Recommended logging data for a userdev environment // The markers can be changed as needed. @@ -76,7 +78,7 @@ minecraft { server { workingDirectory project.file('run') - + arg '-mixin.config=masterfulmachinery.mixins.json' // Recommended logging data for a userdev environment // The markers can be changed as needed. // "SCAN": For mods scan. @@ -174,6 +176,9 @@ dependencies { annotationProcessor 'org.projectlombok:lombok:1.18.18' minecraft 'net.minecraftforge:forge:1.16.5-36.1.23' + compileOnly 'com.google.code.gson:gson:2.8.7' + implementation 'org.spongepowered:mixin:0.8-SNAPSHOT' + annotationProcessor 'org.spongepowered:mixin:0.8.2:processor' shade 'com.github.marschall:memoryfilesystem:2.1.0' implementation fg.deobf("mekanism:Mekanism:${mekanism_version}")// core @@ -225,13 +230,14 @@ dependencies { jar { manifest { attributes([ - "Specification-Title": "examplemod", - "Specification-Vendor": "examplemodsareus", - "Specification-Version": "1", // We are version 1 of ourselves - "Implementation-Title": project.name, - "Implementation-Version": "${version}", - "Implementation-Vendor" :"examplemodsareus", - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + "MixinConfigs" : "masterfulmachinery.mixins.json", + "Specification-Title" : "masterfulmachinery", + "Specification-Vendor" : "ticticboooom", + "Specification-Version" : "1", // We are version 1 of ourselves + "Implementation-Title" : project.name, + "Implementation-Version" : "${version}", + "Implementation-Vendor" : "TicTicBoooom", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } } @@ -265,7 +271,7 @@ reobf { def getVersionNumber() { def vFile = file('version.properties') def Integer buildNumber = 0 - if (vFile.canRead()){ + if (vFile.canRead()) { def Properties versionProps = new Properties(); versionProps.load(new FileInputStream(vFile)) @@ -277,4 +283,20 @@ def getVersionNumber() { versionProps.store(vFile.newWriter(), null) } return buildNumber.toString() +} + +mixin { + add sourceSets.main, "masterfulmachinery.refmap.json" +} + +artifacts { + archives shadowJar + shadow shadowJar +} + +reobf { + shadowJar { + dependsOn createMcpToSrg + mappings = createMcpToSrg.outputs.files.singleFile + } } \ No newline at end of file diff --git a/src/main/java/com/ticticboooom/mods/mm/MM.java b/src/main/java/com/ticticboooom/mods/mm/MM.java index affd8c3..7bb8e46 100644 --- a/src/main/java/com/ticticboooom/mods/mm/MM.java +++ b/src/main/java/com/ticticboooom/mods/mm/MM.java @@ -18,6 +18,7 @@ import com.ticticboooom.mods.mm.datagen.PackType; import com.ticticboooom.mods.mm.datagen.gen.MMBlockStateProvider; import com.ticticboooom.mods.mm.datagen.gen.MMItemModelProvider; import com.ticticboooom.mods.mm.datagen.gen.MMLangProvider; +import com.ticticboooom.mods.mm.datagen.gen.MMLootTableProvider; import com.ticticboooom.mods.mm.network.PacketHandler; import com.ticticboooom.mods.mm.registration.MMLoader; import com.ticticboooom.mods.mm.registration.MMPorts; @@ -30,10 +31,12 @@ import net.minecraft.client.renderer.RenderTypeLookup; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.data.DataGenerator; import net.minecraft.inventory.container.ContainerType; +import net.minecraft.resources.ResourcePackList; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.Mod; @@ -80,6 +83,7 @@ public class MM { private void registerDataGen() { generator = MemoryDataGeneratorFactory.createMemoryDataGenerator(); ExistingFileHelper existingFileHelper = new ExistingFileHelper(ImmutableList.of(), ImmutableSet.of(), false); + generator.addProvider(new MMLootTableProvider(generator)); if (FMLEnvironment.dist != Dist.DEDICATED_SERVER){ generator.addProvider(new MMBlockStateProvider(generator, existingFileHelper)); @@ -130,4 +134,11 @@ public class MM { ScreenManager.registerFactory(MMSetup.STRUCTURE_CONTAINER.get(), StructureGenBlockContainerScreen::new); ClientRegistry.bindTileEntityRenderer(MMSetup.STRUCTURE_TILE.get(), StructureGenTileEntityRenderer::new); } + + public static void injectDatapackFinder (ResourcePackList resourcePacks) { + if (DistExecutor.unsafeRunForDist( () -> () -> resourcePacks != Minecraft.getInstance().getResourcePackList(), () -> () -> true)) { + resourcePacks.addPackFinder(new MMPackFinder(PackType.RESOURCE)); + MM.LOG.info("Injecting data pack finder."); + } + } } diff --git a/src/main/java/com/ticticboooom/mods/mm/block/ControllerBlock.java b/src/main/java/com/ticticboooom/mods/mm/block/ControllerBlock.java index cd1d2a4..ac163a8 100644 --- a/src/main/java/com/ticticboooom/mods/mm/block/ControllerBlock.java +++ b/src/main/java/com/ticticboooom/mods/mm/block/ControllerBlock.java @@ -41,8 +41,7 @@ public class ControllerBlock extends DirectionalBlock { private String texOverride; public ControllerBlock(RegistryObject> type, String name, String id, String texOverride) { - super(AbstractBlock.Properties.create(Material.IRON) - .harvestLevel(1) + super(AbstractBlock.Properties.create(Material.IRON).setRequiresTool().hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL).harvestLevel(0) .harvestTool(ToolType.PICKAXE)); this.type = type; this.controllerName = name; diff --git a/src/main/java/com/ticticboooom/mods/mm/block/MachinePortBlock.java b/src/main/java/com/ticticboooom/mods/mm/block/MachinePortBlock.java index 132337f..69b0bad 100644 --- a/src/main/java/com/ticticboooom/mods/mm/block/MachinePortBlock.java +++ b/src/main/java/com/ticticboooom/mods/mm/block/MachinePortBlock.java @@ -7,6 +7,7 @@ import lombok.Getter; import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; @@ -20,6 +21,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; +import net.minecraftforge.common.ToolType; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.network.NetworkHooks; @@ -39,7 +41,8 @@ public class MachinePortBlock extends Block { private ResourceLocation overlay; public MachinePortBlock(RegistryObject> type, String name, String controllerId, String textureOverride, ResourceLocation overlay) { - super(AbstractBlock.Properties.create(Material.IRON)); + super(AbstractBlock.Properties.create(Material.IRON).setRequiresTool().hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL).harvestLevel(0) + .harvestTool(ToolType.PICKAXE)); this.type = type; this.langName = name; this.controllerId = controllerId; diff --git a/src/main/java/com/ticticboooom/mods/mm/block/ProjectorBlock.java b/src/main/java/com/ticticboooom/mods/mm/block/ProjectorBlock.java index f061af8..e6140fa 100644 --- a/src/main/java/com/ticticboooom/mods/mm/block/ProjectorBlock.java +++ b/src/main/java/com/ticticboooom/mods/mm/block/ProjectorBlock.java @@ -1,9 +1,7 @@ package com.ticticboooom.mods.mm.block; import com.ticticboooom.mods.mm.registration.MMSetup; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.HorizontalBlock; +import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.item.BlockItemUseContext; import net.minecraft.state.DirectionProperty; @@ -16,13 +14,15 @@ import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; +import net.minecraftforge.common.ToolType; import javax.annotation.Nullable; import java.util.stream.Stream; public class ProjectorBlock extends Block { public ProjectorBlock() { - super(Properties.create(Material.IRON)); + super(AbstractBlock.Properties.create(Material.IRON).setRequiresTool().hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL).harvestLevel(0) + .harvestTool(ToolType.PICKAXE)); this.setDefaultState(this.getDefaultState().with(FACING, Direction.NORTH)); } diff --git a/src/main/java/com/ticticboooom/mods/mm/block/StructureGenBlock.java b/src/main/java/com/ticticboooom/mods/mm/block/StructureGenBlock.java index c79ae2c..2b1388d 100644 --- a/src/main/java/com/ticticboooom/mods/mm/block/StructureGenBlock.java +++ b/src/main/java/com/ticticboooom/mods/mm/block/StructureGenBlock.java @@ -3,9 +3,7 @@ package com.ticticboooom.mods.mm.block; import com.ticticboooom.mods.mm.block.tile.ControllerBlockEntity; import com.ticticboooom.mods.mm.block.tile.StructureGenBlockEntity; import com.ticticboooom.mods.mm.registration.MMSetup; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.HorizontalBlock; +import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; @@ -24,6 +22,7 @@ import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; +import net.minecraftforge.common.ToolType; import net.minecraftforge.fml.network.NetworkHooks; import javax.annotation.Nullable; @@ -31,7 +30,8 @@ import java.util.stream.Stream; public class StructureGenBlock extends Block { public StructureGenBlock() { - super(Properties.create(Material.IRON)); + super(AbstractBlock.Properties.create(Material.IRON).setRequiresTool().hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL).harvestLevel(0) + .harvestTool(ToolType.PICKAXE)); this.setDefaultState(this.getDefaultState().with(FACING, Direction.NORTH)); } diff --git a/src/main/java/com/ticticboooom/mods/mm/block/tile/ControllerBlockEntity.java b/src/main/java/com/ticticboooom/mods/mm/block/tile/ControllerBlockEntity.java index 3758c10..ca1662b 100644 --- a/src/main/java/com/ticticboooom/mods/mm/block/tile/ControllerBlockEntity.java +++ b/src/main/java/com/ticticboooom/mods/mm/block/tile/ControllerBlockEntity.java @@ -33,7 +33,7 @@ public class ControllerBlockEntity extends UpdatableTile implements ITickableTil private RegistryObject> container; private String controllerId; @Getter - private ProcessUpdate update = new ProcessUpdate(0, "", "", ""); + private ProcessUpdate update = new ProcessUpdate(0, "", "", "", new ArrayList<>()); public ControllerBlockEntity(RegistryObject> type, RegistryObject> container, String controllerId) { super(type.get()); @@ -87,7 +87,7 @@ public class ControllerBlockEntity extends UpdatableTile implements ITickableTil List processRecipes = world.getRecipeManager().getRecipesForType(RecipeTypes.MACHINE_PROCESS); boolean processed = false; for (MachineProcessRecipe recipe : processRecipes) { - if (recipe.matches(inputPorts, structure.getStructureId())) { + if (recipe.matches(inputPorts, structure.getStructureId(), update)) { if (!update.getId().equals(recipe.getId().toString())){ update.setTicksTaken(0); } diff --git a/src/main/java/com/ticticboooom/mods/mm/client/jei/category/MMJeiPlugin.java b/src/main/java/com/ticticboooom/mods/mm/client/jei/category/MMJeiPlugin.java index 70f0893..1393de6 100644 --- a/src/main/java/com/ticticboooom/mods/mm/client/jei/category/MMJeiPlugin.java +++ b/src/main/java/com/ticticboooom/mods/mm/client/jei/category/MMJeiPlugin.java @@ -36,6 +36,10 @@ public class MMJeiPlugin implements IModPlugin { public static final ManaIngredientRenderer MANA_TYPE_RENDERER = new ManaIngredientRenderer(); public static final ManaIngredientHelper MANA_TYPE_HELPER = new ManaIngredientHelper(); + public static final StarlightIngredientType STAR_TYPE = new StarlightIngredientType(); + public static final StarlightIngredientRenderer STAR_TYPE_RENDERER = new StarlightIngredientRenderer(); + public static final StarlightIngredientHelper STAR_TYPE_HELPER = new StarlightIngredientHelper(); + @Override public ResourceLocation getPluginUid() { return new ResourceLocation(MM.ID, "jei_main"); @@ -46,11 +50,15 @@ public class MMJeiPlugin implements IModPlugin { registration.register(MMJeiPlugin.ENERGY_TYPE, ImmutableList.of(), ENERGY_TYPE_HELPER, ENERGY_TYPE_RENDERER); 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); } @Override public void registerRecipes(IRecipeRegistration registration) { ENERGY_TYPE_RENDERER.setHelpers(registration.getJeiHelpers()); + PRESSURE_TYPE_RENDERER.setHelpers(registration.getJeiHelpers()); + MANA_TYPE_RENDERER.setHelpers(registration.getJeiHelpers()); + STAR_TYPE_RENDERER.setHelpers(registration.getJeiHelpers()); List structureRecipes = Minecraft.getInstance().world.getRecipeManager().getRecipesForType(RecipeTypes.MACHINE_STRUCTURE); for (RegistryObject 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())); diff --git a/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/ManaIngredientRenderer.java b/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/ManaIngredientRenderer.java index 6ec17e2..c992341 100644 --- a/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/ManaIngredientRenderer.java +++ b/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/ManaIngredientRenderer.java @@ -2,10 +2,15 @@ package com.ticticboooom.mods.mm.client.jei.ingredients; import com.google.common.collect.Lists; import com.mojang.blaze3d.matrix.MatrixStack; +import com.ticticboooom.mods.mm.MM; import com.ticticboooom.mods.mm.client.jei.ingredients.model.PressureStack; import com.ticticboooom.mods.mm.inventory.botania.PortManaInventory; +import lombok.Setter; +import mezz.jei.api.gui.drawable.IDrawableStatic; +import mezz.jei.api.helpers.IJeiHelpers; import mezz.jei.api.ingredients.IIngredientRenderer; import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; @@ -13,9 +18,15 @@ import javax.annotation.Nullable; import java.util.List; public class ManaIngredientRenderer implements IIngredientRenderer { + @Setter + private IJeiHelpers helpers; + @Override public void render(MatrixStack matrixStack, int xPosition, int yPosition, @Nullable PortManaInventory ingredient) { - + if (ingredient != null) { + IDrawableStatic drawable = helpers.getGuiHelper().createDrawable(new ResourceLocation(MM.ID, "textures/gui/slot_parts.png"), 19, 80, 16, 16); + drawable.draw(matrixStack, xPosition, yPosition); + } } @Override diff --git a/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/PNCPressureIngredientRenderer.java b/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/PNCPressureIngredientRenderer.java index 47b0cfb..ac66e49 100644 --- a/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/PNCPressureIngredientRenderer.java +++ b/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/PNCPressureIngredientRenderer.java @@ -2,10 +2,15 @@ package com.ticticboooom.mods.mm.client.jei.ingredients; import com.google.common.collect.Lists; import com.mojang.blaze3d.matrix.MatrixStack; +import com.ticticboooom.mods.mm.MM; import com.ticticboooom.mods.mm.client.jei.ingredients.model.PressureStack; +import lombok.Setter; +import mezz.jei.api.gui.drawable.IDrawableStatic; +import mezz.jei.api.helpers.IJeiHelpers; import mezz.jei.api.ingredients.IIngredientRenderer; import mezz.jei.api.ingredients.IIngredientType; import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; @@ -13,16 +18,22 @@ import javax.annotation.Nullable; import java.util.List; public class PNCPressureIngredientRenderer implements IIngredientRenderer { + @Setter + private IJeiHelpers helpers; + @Override public void render(MatrixStack matrixStack, int xPosition, int yPosition, @Nullable PressureStack ingredient) { - + if (ingredient != null) { + IDrawableStatic drawable = helpers.getGuiHelper().createDrawable(new ResourceLocation(MM.ID, "textures/gui/slot_parts.png"), 1, 62, 16, 16); + drawable.draw(matrixStack, xPosition, yPosition); + } } @Override public List getTooltip(PressureStack ingredient, ITooltipFlag tooltipFlag) { return Lists.newArrayList( new StringTextComponent("PNC Pressure"), - new StringTextComponent(ingredient.getAmount() + "Units") + new StringTextComponent(ingredient.getAmount() + " Units") ); } } diff --git a/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/StarlightIngredientHelper.java b/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/StarlightIngredientHelper.java new file mode 100644 index 0000000..b629138 --- /dev/null +++ b/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/StarlightIngredientHelper.java @@ -0,0 +1,46 @@ +package com.ticticboooom.mods.mm.client.jei.ingredients; + +import com.ticticboooom.mods.mm.client.jei.ingredients.model.PressureStack; +import com.ticticboooom.mods.mm.client.jei.ingredients.model.StarlightStack; +import mezz.jei.api.ingredients.IIngredientHelper; + +import javax.annotation.Nullable; + +public class StarlightIngredientHelper implements IIngredientHelper { + + @Nullable + @Override + public StarlightStack getMatch(Iterable ingredients, StarlightStack ingredientToMatch) { + return ingredientToMatch; + } + + @Override + public String getDisplayName(StarlightStack ingredient) { + return "Starlight"; + } + + @Override + public String getUniqueId(StarlightStack ingredient) { + return ingredient.getAmount() + ""; + } + + @Override + public String getModId(StarlightStack ingredient) { + return "astralsorcery"; + } + + @Override + public String getResourceId(StarlightStack ingredient) { + return "starlight"; + } + + @Override + public StarlightStack copyIngredient(StarlightStack ingredient) { + return new StarlightStack(ingredient.getAmount()); + } + + @Override + public String getErrorInfo(@Nullable StarlightStack ingredient) { + return "Error"; + } +} diff --git a/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/StarlightIngredientRenderer.java b/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/StarlightIngredientRenderer.java new file mode 100644 index 0000000..eb3458f --- /dev/null +++ b/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/StarlightIngredientRenderer.java @@ -0,0 +1,39 @@ +package com.ticticboooom.mods.mm.client.jei.ingredients; + +import com.google.common.collect.Lists; +import com.mojang.blaze3d.matrix.MatrixStack; +import com.ticticboooom.mods.mm.MM; +import com.ticticboooom.mods.mm.client.jei.ingredients.model.PressureStack; +import com.ticticboooom.mods.mm.client.jei.ingredients.model.StarlightStack; +import lombok.Setter; +import mezz.jei.api.gui.drawable.IDrawableStatic; +import mezz.jei.api.helpers.IJeiHelpers; +import mezz.jei.api.ingredients.IIngredientRenderer; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; + +import javax.annotation.Nullable; +import java.util.List; + +public class StarlightIngredientRenderer implements IIngredientRenderer { + @Setter + private IJeiHelpers helpers; + + @Override + public void render(MatrixStack matrixStack, int xPosition, int yPosition, @Nullable StarlightStack ingredient) { + if (ingredient != null) { + IDrawableStatic drawable = helpers.getGuiHelper().createDrawable(new ResourceLocation(MM.ID, "textures/gui/slot_parts.png"), 37, 80, 16, 16); + drawable.draw(matrixStack, xPosition, yPosition); + } + } + + @Override + public List getTooltip(StarlightStack ingredient, ITooltipFlag tooltipFlag) { + return Lists.newArrayList( + new StringTextComponent("Astral Starlight"), + new StringTextComponent(ingredient.getAmount() + " S") + ); + } +} diff --git a/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/StarlightIngredientType.java b/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/StarlightIngredientType.java new file mode 100644 index 0000000..6383c6a --- /dev/null +++ b/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/StarlightIngredientType.java @@ -0,0 +1,12 @@ +package com.ticticboooom.mods.mm.client.jei.ingredients; + +import com.ticticboooom.mods.mm.client.jei.ingredients.model.PressureStack; +import com.ticticboooom.mods.mm.client.jei.ingredients.model.StarlightStack; +import mezz.jei.api.ingredients.IIngredientType; + +public class StarlightIngredientType implements IIngredientType { + @Override + public Class getIngredientClass() { + return StarlightStack.class; + } +} diff --git a/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/model/StarlightStack.java b/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/model/StarlightStack.java new file mode 100644 index 0000000..0832a15 --- /dev/null +++ b/src/main/java/com/ticticboooom/mods/mm/client/jei/ingredients/model/StarlightStack.java @@ -0,0 +1,15 @@ +package com.ticticboooom.mods.mm.client.jei.ingredients.model; + +import lombok.Getter; +import lombok.Setter; + +public class StarlightStack { + @Getter + @Setter + private int amount; + + public StarlightStack(int amount){ + + this.amount = amount; + } +} diff --git a/src/main/java/com/ticticboooom/mods/mm/core/mixin/ResourceLoaderMixin.java b/src/main/java/com/ticticboooom/mods/mm/core/mixin/ResourceLoaderMixin.java new file mode 100644 index 0000000..eac41fb --- /dev/null +++ b/src/main/java/com/ticticboooom/mods/mm/core/mixin/ResourceLoaderMixin.java @@ -0,0 +1,50 @@ +/* + * MIT License + * + * Copyright (c) 2020 Ridanisaurus + * + * 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 com.ticticboooom.mods.mm.core.mixin; + +import com.ticticboooom.mods.mm.MM; +import net.minecraft.resources.ResourcePackInfo; +import net.minecraft.resources.ResourcePackList; +import net.minecraftforge.fml.loading.moddiscovery.ModFile; +import net.minecraftforge.fml.packs.ModFileResourcePack; +import net.minecraftforge.fml.packs.ResourcePackLoader; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.Map; +import java.util.function.BiConsumer; +import java.util.function.BiFunction; + +@Mixin(ResourcePackLoader.class) +public class ResourceLoaderMixin { + @Inject(method = "loadResourcePacks(Lnet/minecraft/resources/ResourcePackList;Ljava/util/function/BiFunction;)V", at = @At("RETURN"), remap = false) + private static void injectPacks(ResourcePackList resourcePacks, BiFunction, + BiConsumer, ResourcePackLoader.IPackInfoFinder> packFinder, CallbackInfo callback) { + + MM.injectDatapackFinder(resourcePacks); + } +} diff --git a/src/main/java/com/ticticboooom/mods/mm/data/MachineProcessRecipe.java b/src/main/java/com/ticticboooom/mods/mm/data/MachineProcessRecipe.java index 734fa14..b42064c 100644 --- a/src/main/java/com/ticticboooom/mods/mm/data/MachineProcessRecipe.java +++ b/src/main/java/com/ticticboooom/mods/mm/data/MachineProcessRecipe.java @@ -53,17 +53,23 @@ public class MachineProcessRecipe implements IRecipe { this.rl = rl; } - public boolean matches(List inputPorts, String structureId) { - return structureId.equals(this.structureId) && canTake(inputPorts); + public boolean matches(List inputPorts, String structureId, ProcessUpdate update) { + return structureId.equals(this.structureId) && canTake(inputPorts, update.getTakenIndices()); } - private boolean canTake(List inputPorts) { + private boolean canTake(List inputPorts, List takenIndices) { + int i = -1; for (PortState input : inputs) { + i++; + if (takenIndices.contains(i)) { + continue; + } if (!input.isConsumePerTick()) { if (!input.validateRequirement(inputPorts)) { return false; } } + } return true; } @@ -98,7 +104,7 @@ public class MachineProcessRecipe implements IRecipe { public ProcessUpdate process(List inputPorts, List outputPorts, ProcessUpdate update) { resetChances(); - boolean canTake = canTake(inputPorts); + boolean canTake = canTake(inputPorts, update.getTakenIndices()); boolean canPut = canPut(outputPorts); if (!canTake || !canPut) { @@ -106,9 +112,24 @@ public class MachineProcessRecipe implements IRecipe { return update; } + int takenIndex = 0; + if (update.getTicksTaken() <= 0) { + for (PortState input : inputs) { + if (input.isInstantConsume() && input.validateRequirement(inputPorts)) { + update.getTakenIndices().add(takenIndex); + input.processRequirement(inputPorts); + } + takenIndex++; + } + } + int index = 0; if (update.getTicksTaken() >= ticks) { + update.getTakenIndices().clear(); for (PortState input : inputs) { + if (input.isConsumePerTick() || input.isInstantConsume()) { + continue; + } if (inputRolls.get(index) < input.getChance()) { input.processRequirement(inputPorts); index++; @@ -116,17 +137,24 @@ public class MachineProcessRecipe implements IRecipe { } index = 0; for (PortState output : outputs) { + if (output.isConsumePerTick()) { + continue; + } if (outputRolls.get(index) < output.getChance()) { output.processResult(outputPorts); } } update.setMsg(""); update.setTicksTaken(0); + update.setTakenIndices(new ArrayList<>()); return update; } boolean canTick = true; + + + index = 0; for (PortState input : inputs) { if (input.isConsumePerTick()) { @@ -247,10 +275,16 @@ public class MachineProcessRecipe implements IRecipe { chance = out.get("chance").getAsDouble(); } + boolean consumeInstantly = false; + if (out.has("consumeInstantly")) { + consumeInstantly = out.get("consumeInstantly").getAsBoolean(); + } + MasterfulPortType value = MMPorts.PORTS.get(typeRl); PortState data = value.getParser().createState(out.get("data").getAsJsonObject()); data.setConsumePerTick(perTick); data.setChance(chance); + data.setInstantConsume(consumeInstantly); ioStates.add(data); } return ioStates; diff --git a/src/main/java/com/ticticboooom/mods/mm/datagen/gen/BaseLootTableProvider.java b/src/main/java/com/ticticboooom/mods/mm/datagen/gen/BaseLootTableProvider.java new file mode 100644 index 0000000..7bb2029 --- /dev/null +++ b/src/main/java/com/ticticboooom/mods/mm/datagen/gen/BaseLootTableProvider.java @@ -0,0 +1,141 @@ +/* + * MIT License + * + * Copyright (c) 2020 Ridanisaurus + * + * 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 com.ticticboooom.mods.mm.datagen.gen; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.ticticboooom.mods.mm.MM; +import net.minecraft.advancements.criterion.EnchantmentPredicate; +import net.minecraft.advancements.criterion.ItemPredicate; +import net.minecraft.advancements.criterion.MinMaxBounds; +import net.minecraft.block.Block; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.DirectoryCache; +import net.minecraft.data.IDataProvider; +import net.minecraft.data.LootTableProvider; +import net.minecraft.enchantment.Enchantments; +import net.minecraft.item.Item; +import net.minecraft.loot.*; +import net.minecraft.loot.conditions.MatchTool; +import net.minecraft.loot.conditions.SurvivesExplosion; +import net.minecraft.loot.functions.ApplyBonus; +import net.minecraft.loot.functions.ExplosionDecay; +import net.minecraft.loot.functions.SetCount; +import net.minecraft.util.IItemProvider; +import net.minecraft.util.ResourceLocation; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.HashMap; +import java.util.Map; + +public abstract class BaseLootTableProvider extends LootTableProvider { + + private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create(); + + // Filled by subclasses + protected final Map blockLootTable = new HashMap<>(); + protected final Map itemLootTable = new HashMap<>(); + + private final DataGenerator generator; + + public BaseLootTableProvider(DataGenerator dataGeneratorIn) { + super(dataGeneratorIn); + this.generator = dataGeneratorIn; + } + + @Override + // Entry point + public void act(DirectoryCache cache) { + this.addTables(); + Map tables = new HashMap<>(); + for (Map.Entry entry : this.blockLootTable.entrySet()) { + tables.put(entry.getKey().getLootTable(), + entry.getValue().setParameterSet(LootParameterSets.BLOCK).build()); + } + + this.writeTables(cache, tables); + } + + @Override + public String getName() { + return "MM LootTables"; + } + + // Subclasses can override this to fill the 'lootTables' map. + protected abstract void addTables(); + + protected LootTable.Builder createBlockLootTable(Block block) { + LootPool.Builder builder = LootPool.builder() + .rolls(ConstantRange.of(1)) + .addEntry(ItemLootEntry.builder(block)) + .acceptCondition(SurvivesExplosion.builder()); + return LootTable.builder().addLootPool(builder); + } + + protected LootTable.Builder createItemLootTable(Item item) { + LootPool.Builder builder = LootPool.builder() + .rolls(ConstantRange.of(1)) + .addEntry(ItemLootEntry.builder(item)) + .acceptCondition(SurvivesExplosion.builder()); + return LootTable.builder().addLootPool(builder); + } + + protected LootTable.Builder createSpecialTable(Item item, IItemProvider itemProvider) { + LootPool.Builder builder = LootPool.builder() + .rolls(ConstantRange.of(1)) + .addEntry(ItemLootEntry.builder(item) + .acceptCondition(MatchTool.builder(ItemPredicate.Builder.create().enchantment(new EnchantmentPredicate(Enchantments.SILK_TOUCH, MinMaxBounds.IntBound.atLeast(1))))) + .alternatively(ItemLootEntry.builder(itemProvider) + .acceptFunction(ApplyBonus.oreDrops(Enchantments.FORTUNE)) + .acceptFunction(ExplosionDecay.builder()))); + return LootTable.builder().addLootPool(builder); + } + + protected LootTable.Builder createCountTable(Item item, IItemProvider itemProvider, float minCount, float maxCount) { + LootPool.Builder builder = LootPool.builder() + .rolls(ConstantRange.of(1)) + .addEntry(ItemLootEntry.builder(item) + .acceptCondition(MatchTool.builder(ItemPredicate.Builder.create().enchantment(new EnchantmentPredicate(Enchantments.SILK_TOUCH, MinMaxBounds.IntBound.atLeast(1))))) + .alternatively(ItemLootEntry.builder(itemProvider) + .acceptFunction(SetCount.builder(RandomValueRange.of(minCount, maxCount))) + .acceptFunction(ApplyBonus.oreDrops(Enchantments.FORTUNE)) + .acceptFunction(ExplosionDecay.builder()))); + return LootTable.builder().addLootPool(builder); + } + + // Actually write out the tables in the output folder + private void writeTables(DirectoryCache cache, Map tables) { + Path outputFolder = this.generator.getOutputFolder(); + tables.forEach((key, lootTable) -> { + Path path = outputFolder.resolve("data/" + key.getNamespace() + "/loot_tables/" + key.getPath() + ".json"); + try { + IDataProvider.save(GSON, cache, LootTableManager.toJson(lootTable), path); + } catch (IOException e) { + MM.LOG.error("Couldn't write loot table {}", path, e); + } + }); + } +} \ No newline at end of file diff --git a/src/main/java/com/ticticboooom/mods/mm/datagen/gen/MMBlockStateProvider.java b/src/main/java/com/ticticboooom/mods/mm/datagen/gen/MMBlockStateProvider.java index 19ea744..925a892 100644 --- a/src/main/java/com/ticticboooom/mods/mm/datagen/gen/MMBlockStateProvider.java +++ b/src/main/java/com/ticticboooom/mods/mm/datagen/gen/MMBlockStateProvider.java @@ -33,6 +33,9 @@ public class MMBlockStateProvider extends BlockStateProvider { @Override protected void registerStatesAndModels() { for (RegistryObject controller : MMLoader.BLOCKS) { + if (!controller.isPresent()){ + return; + } dynamicBlockNorthOverlay(controller.getId(), controller.get().getTexOverride() != null ? RLUtils.toRL(controller.get().getTexOverride()) : BASE_TEXTURE, CONTROLLER_TEXTURE); VariantBlockStateBuilder variantBuilder = getVariantBuilder(controller.get()); variantBuilder.partialState().with(DirectionalBlock.FACING, Direction.NORTH).modelForState().modelFile(new ModelFile.UncheckedModelFile(new ResourceLocation(MM.ID, "block/" + controller.getId().getPath()))).rotationY(0).addModel(); diff --git a/src/main/java/com/ticticboooom/mods/mm/datagen/gen/MMItemModelProvider.java b/src/main/java/com/ticticboooom/mods/mm/datagen/gen/MMItemModelProvider.java index 302cd90..76b0048 100644 --- a/src/main/java/com/ticticboooom/mods/mm/datagen/gen/MMItemModelProvider.java +++ b/src/main/java/com/ticticboooom/mods/mm/datagen/gen/MMItemModelProvider.java @@ -23,6 +23,9 @@ public class MMItemModelProvider extends ItemModelProvider { @Override protected void registerModels() { for (RegistryObject controller : MMLoader.BLOCKS) { + if (!controller.isPresent()){ + return; + } this.getBuilder(controller.getId().toString()).parent(new ModelFile.UncheckedModelFile(new ResourceLocation(controller.getId().getNamespace(), "block/" + controller.getId().getPath()))); } for (RegistryObject port : MMLoader.OPORT_BLOCKS) { diff --git a/src/main/java/com/ticticboooom/mods/mm/datagen/gen/MMLangProvider.java b/src/main/java/com/ticticboooom/mods/mm/datagen/gen/MMLangProvider.java index 9786e28..131d80a 100644 --- a/src/main/java/com/ticticboooom/mods/mm/datagen/gen/MMLangProvider.java +++ b/src/main/java/com/ticticboooom/mods/mm/datagen/gen/MMLangProvider.java @@ -17,6 +17,9 @@ public class MMLangProvider extends LanguageProvider { @Override protected void addTranslations() { for (RegistryObject block : MMLoader.BLOCKS) { + if (!block.isPresent()){ + return; + } this.add(block.get(), block.get().getControllerName() + " Controller"); this.add("container.masterfulmachinery." + block.get().getControllerId() + "_controller.name", block.get().getControllerName() + " Controller"); for (RegistryObject port : MMLoader.IPORT_BLOCKS) { diff --git a/src/main/java/com/ticticboooom/mods/mm/datagen/gen/MMLootTableProvider.java b/src/main/java/com/ticticboooom/mods/mm/datagen/gen/MMLootTableProvider.java new file mode 100644 index 0000000..7107bcd --- /dev/null +++ b/src/main/java/com/ticticboooom/mods/mm/datagen/gen/MMLootTableProvider.java @@ -0,0 +1,36 @@ +package com.ticticboooom.mods.mm.datagen.gen; + +import com.ticticboooom.mods.mm.block.ControllerBlock; +import com.ticticboooom.mods.mm.block.MachinePortBlock; +import com.ticticboooom.mods.mm.registration.MMLoader; +import com.ticticboooom.mods.mm.registration.MMSetup; +import net.minecraft.data.DataGenerator; +import net.minecraftforge.fml.RegistryObject; +import net.minecraftforge.registries.ForgeRegistries; + +public class MMLootTableProvider extends BaseLootTableProvider { + public MMLootTableProvider(DataGenerator dataGeneratorIn) { + super(dataGeneratorIn); + } + + @Override + protected void addTables() { + for (RegistryObject controller : MMLoader.BLOCKS) { + if (!controller.isPresent()){ + return; + } + blockLootTable.put(controller.get(), createItemLootTable(ForgeRegistries.ITEMS.getValue(controller.getId()))); + } + + for (RegistryObject port : MMLoader.IPORT_BLOCKS) { + blockLootTable.put(port.get(), createItemLootTable(ForgeRegistries.ITEMS.getValue(port.getId()))); + } + for (RegistryObject port : MMLoader.OPORT_BLOCKS) { + blockLootTable.put(port.get(), createItemLootTable(ForgeRegistries.ITEMS.getValue(port.getId()))); + } + + blockLootTable.put(MMSetup.PROJECTOR_BLOCK.get(), createCountTable(MMSetup.PROJECTOR_ITEM.get(), MMSetup.PROJECTOR_ITEM.get(), 1, 1)); + blockLootTable.put(MMSetup.STRUCTURE_BLOCK.get(), createBlockLootTable(MMSetup.STRUCTURE_BLOCK.get())); + + } +} diff --git a/src/main/java/com/ticticboooom/mods/mm/inventory/as/MMIndependentStarlightSource.java b/src/main/java/com/ticticboooom/mods/mm/inventory/as/MMIndependentStarlightSource.java index 35e2419..e2b14a1 100644 --- a/src/main/java/com/ticticboooom/mods/mm/inventory/as/MMIndependentStarlightSource.java +++ b/src/main/java/com/ticticboooom/mods/mm/inventory/as/MMIndependentStarlightSource.java @@ -31,6 +31,9 @@ public class MMIndependentStarlightSource implements IIndependentStarlightSource @Override public float produceStarlightTick(ServerWorld serverWorld, BlockPos blockPos) { + if (storage == null){ + return 0; + } return storage.getInv().extractStarlight(Integer.MAX_VALUE, false); } diff --git a/src/main/java/com/ticticboooom/mods/mm/model/ProcessUpdate.java b/src/main/java/com/ticticboooom/mods/mm/model/ProcessUpdate.java index 0e2c354..65a77b2 100644 --- a/src/main/java/com/ticticboooom/mods/mm/model/ProcessUpdate.java +++ b/src/main/java/com/ticticboooom/mods/mm/model/ProcessUpdate.java @@ -5,6 +5,8 @@ import lombok.Getter; import lombok.Setter; import net.minecraft.util.ResourceLocation; +import java.util.List; + @Getter @Setter @AllArgsConstructor @@ -13,4 +15,5 @@ public class ProcessUpdate { private String msg; private String id; private String sid; + private List takenIndices; } diff --git a/src/main/java/com/ticticboooom/mods/mm/nbt/NBTActionParser.java b/src/main/java/com/ticticboooom/mods/mm/nbt/NBTActionParser.java index 8af64de..508e4b9 100644 --- a/src/main/java/com/ticticboooom/mods/mm/nbt/NBTActionParser.java +++ b/src/main/java/com/ticticboooom/mods/mm/nbt/NBTActionParser.java @@ -46,6 +46,10 @@ public class NBTActionParser { } public static void write(PacketBuffer buf, NBTModel model) { + if (model == null) { + buf.writeInt(0); + return; + } buf.writeInt(model.getActions().size()); for (NBTActionModel action : model.getActions()) { buf.writeString(action.getAction()); diff --git a/src/main/java/com/ticticboooom/mods/mm/ports/parser/ManaPortParser.java b/src/main/java/com/ticticboooom/mods/mm/ports/parser/ManaPortParser.java index 43f7b6f..2424641 100644 --- a/src/main/java/com/ticticboooom/mods/mm/ports/parser/ManaPortParser.java +++ b/src/main/java/com/ticticboooom/mods/mm/ports/parser/ManaPortParser.java @@ -48,12 +48,12 @@ public class ManaPortParser extends PortFactory { @Override public ResourceLocation getInputOverlay() { - return new ResourceLocation(MM.ID, "block/compat_ports/botania_mana_cutout"); + return new ResourceLocation(MM.ID, "block/compat_ports/botania_mana_input_cutout"); } @Override public ResourceLocation getOutputOverlay() { - return new ResourceLocation(MM.ID, "block/compat_ports/botania_mana_cutout"); + return new ResourceLocation(MM.ID, "block/compat_ports/botania_mana_output_cutout"); } @Override diff --git a/src/main/java/com/ticticboooom/mods/mm/ports/parser/MekGasPortParser.java b/src/main/java/com/ticticboooom/mods/mm/ports/parser/MekGasPortParser.java index 1c208d1..e881c04 100644 --- a/src/main/java/com/ticticboooom/mods/mm/ports/parser/MekGasPortParser.java +++ b/src/main/java/com/ticticboooom/mods/mm/ports/parser/MekGasPortParser.java @@ -59,11 +59,11 @@ public class MekGasPortParser extends PortFactory { @Override public ResourceLocation getInputOverlay() { - return new ResourceLocation(MM.ID, "block/compat_ports/mekanism_gas_cutout"); + return new ResourceLocation(MM.ID, "block/compat_ports/mekanism_gas_input_cutout"); } @Override public ResourceLocation getOutputOverlay() { - return new ResourceLocation(MM.ID, "block/compat_ports/mekanism_gas_cutout"); + return new ResourceLocation(MM.ID, "block/compat_ports/mekanism_gas_output_cutout"); } } diff --git a/src/main/java/com/ticticboooom/mods/mm/ports/parser/MekInfusePortParser.java b/src/main/java/com/ticticboooom/mods/mm/ports/parser/MekInfusePortParser.java index e3cd0f0..cecba80 100644 --- a/src/main/java/com/ticticboooom/mods/mm/ports/parser/MekInfusePortParser.java +++ b/src/main/java/com/ticticboooom/mods/mm/ports/parser/MekInfusePortParser.java @@ -61,11 +61,11 @@ public class MekInfusePortParser extends PortFactory { @Override public ResourceLocation getInputOverlay() { - return new ResourceLocation(MM.ID, "block/compat_ports/mekanism_slurry_cutout"); + return new ResourceLocation(MM.ID, "block/compat_ports/mekanism_infusion_input_cutout"); } @Override public ResourceLocation getOutputOverlay() { - return new ResourceLocation(MM.ID, "block/compat_ports/mekanism_slurry_cutout"); + return new ResourceLocation(MM.ID, "block/compat_ports/mekanism_infusion_input_cutout"); } } diff --git a/src/main/java/com/ticticboooom/mods/mm/ports/parser/MekSlurryPortParser.java b/src/main/java/com/ticticboooom/mods/mm/ports/parser/MekSlurryPortParser.java index 8d284f4..4ebe50a 100644 --- a/src/main/java/com/ticticboooom/mods/mm/ports/parser/MekSlurryPortParser.java +++ b/src/main/java/com/ticticboooom/mods/mm/ports/parser/MekSlurryPortParser.java @@ -59,11 +59,11 @@ public class MekSlurryPortParser extends PortFactory { @Override public ResourceLocation getInputOverlay() { - return new ResourceLocation(MM.ID, "block/compat_ports/mekanism_slurry_cutout"); + return new ResourceLocation(MM.ID, "block/compat_ports/mekanism_slurry_input_cutout"); } @Override public ResourceLocation getOutputOverlay() { - return new ResourceLocation(MM.ID, "block/compat_ports/mekanism_slurry_cutout"); + return new ResourceLocation(MM.ID, "block/compat_ports/mekanism_slurry_output_cutout"); } } diff --git a/src/main/java/com/ticticboooom/mods/mm/ports/parser/PneumaticPortParser.java b/src/main/java/com/ticticboooom/mods/mm/ports/parser/PneumaticPortParser.java index 34da33c..3ef952e 100644 --- a/src/main/java/com/ticticboooom/mods/mm/ports/parser/PneumaticPortParser.java +++ b/src/main/java/com/ticticboooom/mods/mm/ports/parser/PneumaticPortParser.java @@ -46,12 +46,12 @@ public class PneumaticPortParser extends PortFactory { @Override public ResourceLocation getInputOverlay() { - return new ResourceLocation(MM.ID, "block/compat_ports/pncr_pressure_cutout"); + return new ResourceLocation(MM.ID, "block/compat_ports/pncr_pressure_input_cutout"); } @Override public ResourceLocation getOutputOverlay() { - return new ResourceLocation(MM.ID, "block/compat_ports/pncr_pressure_cutout"); + return new ResourceLocation(MM.ID, "block/compat_ports/pncr_pressure_output_cutout"); } @Override diff --git a/src/main/java/com/ticticboooom/mods/mm/ports/parser/RotationPortParser.java b/src/main/java/com/ticticboooom/mods/mm/ports/parser/RotationPortParser.java index 8878edf..34d65e0 100644 --- a/src/main/java/com/ticticboooom/mods/mm/ports/parser/RotationPortParser.java +++ b/src/main/java/com/ticticboooom/mods/mm/ports/parser/RotationPortParser.java @@ -51,12 +51,12 @@ public class RotationPortParser extends PortFactory { @Override public ResourceLocation getInputOverlay() { - return new ResourceLocation(MM.ID, "block/compat_ports/create_rotation_cutout"); + return new ResourceLocation(MM.ID, "block/compat_ports/create_rotation_input_cutout"); } @Override public ResourceLocation getOutputOverlay() { - return new ResourceLocation(MM.ID, "block/compat_ports/create_rotation_cutout"); + return new ResourceLocation(MM.ID, "block/compat_ports/create_rotation_output_cutout"); } @Override diff --git a/src/main/java/com/ticticboooom/mods/mm/ports/parser/StarlightPortParser.java b/src/main/java/com/ticticboooom/mods/mm/ports/parser/StarlightPortParser.java index ba86c08..394fcad 100644 --- a/src/main/java/com/ticticboooom/mods/mm/ports/parser/StarlightPortParser.java +++ b/src/main/java/com/ticticboooom/mods/mm/ports/parser/StarlightPortParser.java @@ -49,12 +49,12 @@ public class StarlightPortParser extends PortFactory { @Override public ResourceLocation getInputOverlay() { - return new ResourceLocation(MM.ID, "block/compat_ports/starlight_cutout"); + return new ResourceLocation(MM.ID, "block/compat_ports/astral_starlight_input_cutout"); } @Override public ResourceLocation getOutputOverlay() { - return new ResourceLocation(MM.ID, "block/compat_ports/starlight_cutout"); + return new ResourceLocation(MM.ID, "block/compat_ports/astral_starlight_output_cutout"); } @Override diff --git a/src/main/java/com/ticticboooom/mods/mm/ports/state/PneumaticPortState.java b/src/main/java/com/ticticboooom/mods/mm/ports/state/PneumaticPortState.java index f0bdc50..8b2deba 100644 --- a/src/main/java/com/ticticboooom/mods/mm/ports/state/PneumaticPortState.java +++ b/src/main/java/com/ticticboooom/mods/mm/ports/state/PneumaticPortState.java @@ -91,7 +91,7 @@ public class PneumaticPortState extends PortState { @Override public void setupRecipe(IRecipeLayout layout, Integer typeIndex, int x, int y, boolean input) { IGuiIngredientGroup group = layout.getIngredientsGroup(MMJeiPlugin.PRESSURE_TYPE); - group.init(typeIndex, input, x, y); + group.init(typeIndex, input, x+ 1, y +1); group.set(typeIndex, new PressureStack(pressure)); } diff --git a/src/main/java/com/ticticboooom/mods/mm/ports/state/PortState.java b/src/main/java/com/ticticboooom/mods/mm/ports/state/PortState.java index 9fe5f13..285ce61 100644 --- a/src/main/java/com/ticticboooom/mods/mm/ports/state/PortState.java +++ b/src/main/java/com/ticticboooom/mods/mm/ports/state/PortState.java @@ -21,6 +21,10 @@ public abstract class PortState { @Getter @Setter private double chance = 0; + + @Getter + @Setter + private boolean instantConsume = false; public abstract void processRequirement(List storage); public abstract boolean validateRequirement(List storage); public abstract void processResult(List storage); diff --git a/src/main/java/com/ticticboooom/mods/mm/ports/state/StarlightPortState.java b/src/main/java/com/ticticboooom/mods/mm/ports/state/StarlightPortState.java index 653e883..341e952 100644 --- a/src/main/java/com/ticticboooom/mods/mm/ports/state/StarlightPortState.java +++ b/src/main/java/com/ticticboooom/mods/mm/ports/state/StarlightPortState.java @@ -5,6 +5,8 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; 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.client.jei.ingredients.model.StarlightStack; import com.ticticboooom.mods.mm.ports.storage.StarlightPortStorage; import com.ticticboooom.mods.mm.ports.storage.PortStorage; import com.ticticboooom.mods.mm.ports.storage.StarlightPortStorage; @@ -12,6 +14,7 @@ import hellfirepvp.astralsorcery.common.block.base.BlockStarlightRecipient; import hellfirepvp.astralsorcery.common.constellation.IWeakConstellation; 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; @@ -99,7 +102,6 @@ public class StarlightPortState extends PortState { @Override public IIngredientType getJeiIngredientType() { - // Am guessing is placeholder? return MMJeiPlugin.PRESSURE_TYPE; } @@ -110,7 +112,9 @@ public class StarlightPortState extends PortState { @Override public void setupRecipe(IRecipeLayout layout, Integer typeIndex, int x, int y, boolean input) { - + IGuiIngredientGroup group = layout.getIngredientsGroup(MMJeiPlugin.STAR_TYPE); + group.init(typeIndex, input, x + 1, y+1); + group.set(typeIndex, new StarlightStack(amount)); } @Override diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/astral_starlight_input_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/astral_starlight_input_cutout.png new file mode 100644 index 0000000..d2a9774 Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/astral_starlight_input_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/astral_starlight_output_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/astral_starlight_output_cutout.png new file mode 100644 index 0000000..97ed10d Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/astral_starlight_output_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/botania_mana_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/botania_mana_cutout.png deleted file mode 100644 index ec19cd2..0000000 Binary files a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/botania_mana_cutout.png and /dev/null differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/botania_mana_input_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/botania_mana_input_cutout.png new file mode 100644 index 0000000..080a189 Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/botania_mana_input_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/botania_mana_output_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/botania_mana_output_cutout.png new file mode 100644 index 0000000..1273857 Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/botania_mana_output_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/create_rotation_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/create_rotation_cutout.png deleted file mode 100644 index a02cb2e..0000000 Binary files a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/create_rotation_cutout.png and /dev/null differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/create_rotation_input_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/create_rotation_input_cutout.png new file mode 100644 index 0000000..201bea9 Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/create_rotation_input_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/create_rotation_output_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/create_rotation_output_cutout.png new file mode 100644 index 0000000..353be91 Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/create_rotation_output_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_gas_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_gas_cutout.png deleted file mode 100644 index 027aabd..0000000 Binary files a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_gas_cutout.png and /dev/null differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_gas_input_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_gas_input_cutout.png new file mode 100644 index 0000000..1bd6ffb Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_gas_input_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_gas_output_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_gas_output_cutout.png new file mode 100644 index 0000000..0ea62da Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_gas_output_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_heat_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_heat_cutout.png deleted file mode 100644 index 22350ef..0000000 Binary files a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_heat_cutout.png and /dev/null differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_heat_input_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_heat_input_cutout.png new file mode 100644 index 0000000..559eef6 Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_heat_input_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_heat_output_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_heat_output_cutout.png new file mode 100644 index 0000000..7514ecf Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_heat_output_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_infusion_input_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_infusion_input_cutout.png new file mode 100644 index 0000000..b25cdcf Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_infusion_input_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_infusion_output_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_infusion_output_cutout.png new file mode 100644 index 0000000..6c8ba50 Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_infusion_output_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_laser_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_laser_cutout.png deleted file mode 100644 index 5c42790..0000000 Binary files a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_laser_cutout.png and /dev/null differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_laser_input_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_laser_input_cutout.png new file mode 100644 index 0000000..da30c90 Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_laser_input_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_laser_output_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_laser_output_cutout.png new file mode 100644 index 0000000..ce0cf05 Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_laser_output_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_pigment_input_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_pigment_input_cutout.png new file mode 100644 index 0000000..aabe499 Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_pigment_input_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_pigment_output_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_pigment_output_cutout.png new file mode 100644 index 0000000..8a01fb5 Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_pigment_output_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_slurry_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_slurry_cutout.png deleted file mode 100644 index 638d59e..0000000 Binary files a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_slurry_cutout.png and /dev/null differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_slurry_input_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_slurry_input_cutout.png new file mode 100644 index 0000000..8497b50 Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_slurry_input_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_slurry_output_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_slurry_output_cutout.png new file mode 100644 index 0000000..2170e3d Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/mekanism_slurry_output_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/pncr_pressure_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/pncr_pressure_cutout.png deleted file mode 100644 index b594bec..0000000 Binary files a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/pncr_pressure_cutout.png and /dev/null differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/pncr_pressure_input_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/pncr_pressure_input_cutout.png new file mode 100644 index 0000000..5479ae8 Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/pncr_pressure_input_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/pncr_pressure_output_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/pncr_pressure_output_cutout.png new file mode 100644 index 0000000..e1c7112 Binary files /dev/null and b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/pncr_pressure_output_cutout.png differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/starlight_cutout.png b/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/starlight_cutout.png deleted file mode 100644 index ec19cd2..0000000 Binary files a/src/main/resources/assets/masterfulmachinery/textures/block/compat_ports/starlight_cutout.png and /dev/null differ diff --git a/src/main/resources/assets/masterfulmachinery/textures/gui/slot_parts.png b/src/main/resources/assets/masterfulmachinery/textures/gui/slot_parts.png index 015c8c1..a82a4bf 100644 Binary files a/src/main/resources/assets/masterfulmachinery/textures/gui/slot_parts.png and b/src/main/resources/assets/masterfulmachinery/textures/gui/slot_parts.png differ diff --git a/src/main/resources/masterfulmachinery.mixins.json b/src/main/resources/masterfulmachinery.mixins.json new file mode 100644 index 0000000..5d96948 --- /dev/null +++ b/src/main/resources/masterfulmachinery.mixins.json @@ -0,0 +1,14 @@ +{ + "required": true, + "package": "com.ticticboooom.mods.mm.core.mixin", + "compatibilityLevel": "JAVA_8", + "refmap": "masterfulmachinery.refmap.json", + "mixins": [ + "ResourceLoaderMixin" + ], + "injectors": { + "maxShiftBy": 3, + "defaultRequire": 1 + }, + "minVersion": "0.8" +} \ No newline at end of file diff --git a/version.properties b/version.properties index 981a72c..cd44229 100644 --- a/version.properties +++ b/version.properties @@ -1,2 +1,2 @@ -#Wed May 26 12:18:11 BST 2021 -VERSION_CODE=189 +#Sat May 29 16:05:26 BST 2021 +VERSION_CODE=333