Skip to content

Commit

Permalink
Preparing for the modfest release
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmaTheMartian committed Nov 4, 2024
1 parent 21ee549 commit 1f93d51
Show file tree
Hide file tree
Showing 93 changed files with 1,202 additions and 293 deletions.
13 changes: 9 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

(aka: Mine! or M!)

> A revival of MineFactory Reloaded for modern versions of Minecraft.
MineFactorial is a revival of MineFactory Reloaded for modern versions of Minecraft.

Before anyone says it: Yes this mod is similar to Industrial Foregoing. Both it and M!
are based on MFR, so there will be a lot of similarities and overlap. I'm trying my best
to stay unique and diverge from what is seen in IF though.
---

## Notes

- Yes this mod is similar to Industrial Foregoing. Both it and M!
are based on MFR, so there will be a lot of similarities and overlap. I'm trying my best
to stay unique and diverge from what is seen in IF though.
- M! is currently **in-development** and not 100% complete!
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "minefactorial:block/creative_capacitor"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "minefactorial:block/creative_tank"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"variants": {
"facing=down": {
"model": "minefactorial:block/fluid_extractor",
"x": 180
},
"facing=east": {
"model": "minefactorial:block/fluid_extractor",
"x": 90,
"y": 90
},
"facing=north": {
"model": "minefactorial:block/fluid_extractor",
"x": 90
},
"facing=south": {
"model": "minefactorial:block/fluid_extractor",
"x": 90,
"y": 180
},
"facing=up": {
"model": "minefactorial:block/fluid_extractor"
},
"facing=west": {
"model": "minefactorial:block/fluid_extractor",
"x": 90,
"y": 270
}
}
}
27 changes: 27 additions & 0 deletions src/generated/resources/assets/minefactorial/blockstates/pump.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"variants": {
"facing=down": {
"model": "minefactorial:block/pump_down",
"y": 90
},
"facing=east": {
"model": "minefactorial:block/pump",
"y": 90
},
"facing=north": {
"model": "minefactorial:block/pump"
},
"facing=south": {
"model": "minefactorial:block/pump",
"y": 180
},
"facing=up": {
"model": "minefactorial:block/pump_up",
"y": 90
},
"facing=west": {
"model": "minefactorial:block/pump",
"y": 270
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minefactorial:block/template_machine_creative",
"textures": {
"side": "minefactorial:block/machine/creative_capacitor_side"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minefactorial:block/template_machine_creative",
"textures": {
"side": "minefactorial:block/machine/creative_tank_side"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "minefactorial:block/template_machine",
"textures": {
"north": "minefactorial:block/fluid_input_side",
"south": "minefactorial:block/fluid_output_side"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "minefactorial:block/template_machine",
"textures": {
"down": "minefactorial:block/fluid_input_bottom",
"up": "minefactorial:block/fluid_output_top"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "minefactorial:block/template_machine",
"textures": {
"down": "minefactorial:block/fluid_output_bottom",
"up": "minefactorial:block/fluid_input_top"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "minefactorial:block/creative_capacitor"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "minefactorial:block/creative_tank"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "minefactorial:block/fluid_extractor"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "minefactorial:block/pump"
}
9 changes: 6 additions & 3 deletions src/main/java/martian/minefactorial/Minefactorial.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.tags.FluidTags;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.common.EffectCures;
Expand All @@ -20,14 +21,16 @@ public class Minefactorial {
public static final String MODID = "minefactorial";
public static final Logger LOGGER = LogUtils.getLogger();

public Minefactorial(IEventBus modBus) {
public Minefactorial(IEventBus modBus, Dist dist) {
// Add event listeners
modBus.addListener(MFTabs::addItems);
modBus.addListener(MFDataGen::onGatherData);
modBus.register(MinefactorialListeners.ModBusEvents.class);
modBus.register(MinefactorialClient.ModBusEvents.class);
// NeoForge.EVENT_BUS.register(MinefactorialListeners.GameBusEvents.class); // There are no events on this *yet*
NeoForge.EVENT_BUS.register(MinefactorialClient.GameBusEvents.class);
if (dist.isClient()) {
modBus.register(MinefactorialClient.ModBusEvents.class);
NeoForge.EVENT_BUS.register(MinefactorialClient.GameBusEvents.class);
}

// Registration :D
MFFluids.REGISTRY.register(modBus);
Expand Down
19 changes: 17 additions & 2 deletions src/main/java/martian/minefactorial/MinefactorialListeners.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package martian.minefactorial;

import martian.minefactorial.content.block.BlockCapacitorBE;
import martian.minefactorial.content.block.BlockSteamBoilerBE;
import martian.minefactorial.content.block.storage.BlockCapacitorBE;
import martian.minefactorial.content.block.power.BlockSteamBoilerBE;
import martian.minefactorial.content.block.storage.BlockCreativeCapacitorBE;
import martian.minefactorial.content.registry.MFBlockEntityTypes;
import martian.minefactorial.foundation.block.*;
import net.minecraft.core.Direction;
Expand Down Expand Up @@ -41,12 +42,19 @@ static void onRegisterCapabilities(final RegisterCapabilitiesEvent event) {
registerEnergyCapability(MFBlockEntityTypes.CAPACITOR.get(), BlockCapacitorBE::getEnergyStorage);
registerItemCapability(MFBlockEntityTypes.CAPACITOR.get());

// Creative Capacitor
registerEnergyCapability(MFBlockEntityTypes.CREATIVE_CAPACITOR.get());
registerItemCapability(MFBlockEntityTypes.CREATIVE_CAPACITOR.get());

// Breaker
registerEnergyCapability(MFBlockEntityTypes.BREAKER.get());

// Plastic Tank
registerSingleFluidCapability(MFBlockEntityTypes.PLASTIC_TANK.get());

// Creative Tank
registerSingleFluidCapability(MFBlockEntityTypes.CREATIVE_TANK.get());

// Mob Grinder
registerEnergyCapability(MFBlockEntityTypes.MOB_GRINDER.get());
registerSingleFluidCapability(MFBlockEntityTypes.MOB_GRINDER.get());
Expand All @@ -59,6 +67,13 @@ static void onRegisterCapabilities(final RegisterCapabilitiesEvent event) {
registerEnergyCapability(MFBlockEntityTypes.FOUNTAIN.get());
registerSingleFluidCapability(MFBlockEntityTypes.FOUNTAIN.get());

// Pump
registerEnergyCapability(MFBlockEntityTypes.PUMP.get());
registerSingleFluidCapability(MFBlockEntityTypes.PUMP.get());

// Fluid Extractor
registerSingleFluidCapability(MFBlockEntityTypes.FLUID_EXTRACTOR.get());

// Pipes
registerEnergyCapability(MFBlockEntityTypes.ENERGY_PIPE.get());
registerSingleFluidCapability(MFBlockEntityTypes.FLUID_PIPE.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.BlockHitResult;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent;
import net.neoforged.neoforge.client.event.RenderLevelStageEvent;
import net.neoforged.neoforge.client.extensions.common.RegisterClientExtensionsEvent;
import org.jetbrains.annotations.ApiStatus;

@OnlyIn(Dist.CLIENT)
public final class MinefactorialClient {
private MinefactorialClient() { }

Expand All @@ -34,9 +36,11 @@ static void registerMenus(final RegisterMenuScreensEvent event) {
event.register(MFMenuTypes.STEAM_BOILER.get(), ScreenSteamBoiler::new);
event.register(MFMenuTypes.STEAM_TURBINE.get(), ScreenSteamTurbine::new);
event.register(MFMenuTypes.CAPACITOR.get(), ScreenCapacitor::new);
event.register(MFMenuTypes.CREATIVE_CAPACITOR.get(), ScreenCreativeCapacitor::new);
event.register(MFMenuTypes.BREAKER.get(), ScreenBreaker::new);
event.register(MFMenuTypes.MOB_GRINDER.get(), ScreenMobGrinder::new);
event.register(MFMenuTypes.FOUNTAIN.get(), ScreenFountain::new);
event.register(MFMenuTypes.PUMP.get(), ScreenPump::new);
}

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package martian.minefactorial.client.screen;

import martian.minefactorial.content.block.BlockBreakerBE;
import martian.minefactorial.content.block.machinery.BlockBreakerBE;
import martian.minefactorial.content.menu.ContainerBreaker;
import martian.minefactorial.foundation.client.screen.AbstractMachineScreen;
import net.minecraft.network.chat.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package martian.minefactorial.client.screen;

import martian.minefactorial.content.block.BlockCapacitorBE;
import martian.minefactorial.content.block.storage.BlockCapacitorBE;
import martian.minefactorial.content.menu.ContainerCapacitor;
import martian.minefactorial.foundation.client.screen.AbstractEnergyScreen;
import net.minecraft.network.chat.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package martian.minefactorial.client.screen;

import martian.minefactorial.content.block.storage.BlockCapacitorBE;
import martian.minefactorial.content.block.storage.BlockCreativeCapacitorBE;
import martian.minefactorial.content.menu.ContainerCapacitor;
import martian.minefactorial.content.menu.ContainerCreativeCapacitor;
import martian.minefactorial.foundation.client.screen.AbstractEnergyScreen;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;

import static martian.minefactorial.Minefactorial.id;

public class ScreenCreativeCapacitor extends AbstractEnergyScreen<BlockCreativeCapacitorBE, ContainerCreativeCapacitor> {
public static final ResourceLocation UI = id("textures/gui/capacitor.png");

public ScreenCreativeCapacitor(ContainerCreativeCapacitor menu, Inventory playerInventory, Component title) {
super(menu, playerInventory, title);
}

@Override
protected ResourceLocation getUI() {
return UI;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package martian.minefactorial.client.screen;

import martian.minefactorial.content.block.BlockFountainBE;
import martian.minefactorial.content.block.machinery.BlockFountainBE;
import martian.minefactorial.content.menu.ContainerFountain;
import martian.minefactorial.foundation.Mathematics;
import martian.minefactorial.foundation.client.FluidRenderer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package martian.minefactorial.client.screen;

import martian.minefactorial.content.block.BlockMobGrinderBE;
import martian.minefactorial.content.block.machinery.BlockMobGrinderBE;
import martian.minefactorial.content.menu.ContainerMobGrinder;
import martian.minefactorial.content.registry.MFFluids;
import martian.minefactorial.foundation.Mathematics;
Expand Down
62 changes: 62 additions & 0 deletions src/main/java/martian/minefactorial/client/screen/ScreenPump.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package martian.minefactorial.client.screen;

import martian.minefactorial.content.block.machinery.BlockPumpBE;
import martian.minefactorial.content.menu.ContainerPump;
import martian.minefactorial.foundation.Mathematics;
import martian.minefactorial.foundation.client.FluidRenderer;
import martian.minefactorial.foundation.client.screen.AbstractMachineScreen;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
import net.neoforged.neoforge.fluids.FluidStack;
import org.jetbrains.annotations.NotNull;

import static martian.minefactorial.Minefactorial.id;

public class ScreenPump extends AbstractMachineScreen<BlockPumpBE, ContainerPump> {
public static final ResourceLocation UI = id("textures/gui/fountain.png");

public static final int
TANK_WIDTH = 16, TANK_HEIGHT = 41,
TANK_X = 80, TANK_Y = 36;

public ScreenPump(ContainerPump menu, Inventory playerInventory, Component title) {
super(menu, playerInventory, title);
}

@Override
protected ResourceLocation getUI() {
return UI;
}

@Override
public void renderBg(@NotNull GuiGraphics graphics, float partialTick, int mouseX, int mouseY) {
super.renderBg(graphics, partialTick, mouseX, mouseY);

if (this.menu.fluidAmount > 0) {
float filled_percent = ((float) this.menu.fluidAmount / this.menu.capacity);
int height = (int) (TANK_HEIGHT * filled_percent);

FluidRenderer.renderFluidGui(
new FluidStack(BuiltInRegistries.FLUID.byId(this.menu.fluidStackId), this.menu.fluidAmount),
graphics,
leftPos + TANK_X,
topPos + TANK_Y + (TANK_HEIGHT - height), // we do this to render from the bottom to the top
TANK_WIDTH,
height
);
}
}

@Override
public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
super.render(graphics, mouseX, mouseY, partialTick);

if (this.menu.fluidAmount > 0 && Mathematics.pointWithinRectangle(mouseX, mouseY, leftPos + TANK_X, topPos + TANK_Y, TANK_WIDTH, TANK_HEIGHT)) {
FluidStack fluidStack = new FluidStack(BuiltInRegistries.FLUID.byId(this.menu.fluidStackId), this.menu.fluidAmount);
graphics.renderTooltip(this.font, fluidStack.getHoverName().copy().append(": " + this.menu.fluidAmount + "mB"), mouseX, mouseY);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package martian.minefactorial.client.screen;

import martian.minefactorial.content.block.BlockSteamTurbineBE;
import martian.minefactorial.content.block.power.BlockSteamTurbineBE;
import martian.minefactorial.content.menu.ContainerSteamTurbine;
import martian.minefactorial.content.registry.MFFluids;
import martian.minefactorial.foundation.Mathematics;
Expand Down
Loading

0 comments on commit 1f93d51

Please sign in to comment.