Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,12 @@ public class TweaksConfig {
@Config.DefaultBoolean(true)
public static boolean thirstyTankContainer;

// BiblioCraft

@Config.Comment("Better Printing Press automation")
@Config.DefaultBoolean(true)
public static boolean betterPrintingPressAutomation;

// Biomes O' Plenty

@Config.Comment("Allow 5 Fir Sapling planted together ('+' shape) to grow to a big fir tree")
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -1943,7 +1943,8 @@ public enum Mixins implements IMixins {
.addRequiredMod(TargetedMod.ENDLESSIDS)
.setPhase(Phase.LATE)),

// Various Exploits/Fixes
// BiblioCraft

BIBLIOCRAFT_PACKET_FIX(new MixinBuilder("Packet Fix")
.addCommonMixins("bibliocraft.MixinBibliocraftPatchPacketExploits")
.setApplyIf(() -> FixesConfig.fixBibliocraftPackets)
Expand Down Expand Up @@ -1985,6 +1986,14 @@ public enum Mixins implements IMixins {
.setApplyIf(() -> MemoryConfig.leaks.fixBibliocraftTESRWorldLeak)
.addRequiredMod(TargetedMod.BIBLIOCRAFT)
.setPhase(Phase.LATE)),
BIBLIOCRAFT_BETTER_PRINTING_PRESS_AUTOMATION(new MixinBuilder("Better Printing Press automation")
.addCommonMixins("bibliocraft.MixinBiblioCraftPrintPress")
.setApplyIf(() -> TweaksConfig.betterPrintingPressAutomation)
.addRequiredMod(TargetedMod.BIBLIOCRAFT)
.setPhase(Phase.LATE)),

// Various Exploits/Fixes

ZTONES_PACKET_FIX(new MixinBuilder("Packet Fix")
.addCommonMixins("ztones.MixinZtonesPatchPacketExploits")
.setApplyIf(() -> FixesConfig.fixZTonesPackets)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package com.mitchej123.hodgepodge.mixins.late.bibliocraft;

import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Unique;

import com.mitchej123.hodgepodge.util.BlockRelativeSide;

import jds.bibliocraft.tileentities.TileEntityPrintPress;

@Mixin(TileEntityPrintPress.class)
public abstract class MixinBiblioCraftPrintPress extends TileEntity {

/**
* @author vladislemon
* @reason better automation
*/
@Overwrite
public int[] getAccessibleSlotsFromSide(int side) {
if (side == hodgepodge$getSide(BlockRelativeSide.BACK)) { // plate
int[] sides = new int[1];
sides[0] = 1;
return sides;
} else if (side == hodgepodge$getSide(BlockRelativeSide.RIGHT)) { // printed book
int[] sides = new int[1];
sides[0] = 3;
return sides;
} else {
int[] sides = new int[2];
sides[0] = 0;
sides[1] = 2;
return sides;
}
}

/**
* @author vladislemon
* @reason better automation
*/
@Overwrite
public boolean canExtractItem(int slot, ItemStack itemstack, int side) {
// plate
if (slot == 1 && side == hodgepodge$getSide(BlockRelativeSide.BACK)) {
return true;
}
// printed book
if (slot == 3 && side == hodgepodge$getSide(BlockRelativeSide.RIGHT)) {
return true;
}
return false;
}

@Unique
private int hodgepodge$getSide(BlockRelativeSide blockSide) {
return switch (blockSide) {
case BOTTOM -> 0;
case TOP -> 1;
case LEFT -> switch (getBlockMetadata()) {
case 0 -> 2;
case 1 -> 5;
case 2 -> 3;
case 3 -> 4;
default -> -1;
};
case RIGHT -> switch (getBlockMetadata()) {
case 0 -> 3;
case 1 -> 4;
case 2 -> 2;
case 3 -> 5;
default -> -1;
};
case FRONT -> switch (getBlockMetadata()) {
case 0 -> 4;
case 1 -> 2;
case 2 -> 5;
case 3 -> 3;
default -> -1;
};
case BACK -> switch (getBlockMetadata()) {
case 0 -> 5;
case 1 -> 3;
case 2 -> 4;
case 3 -> 2;
default -> -1;
};
};
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.mitchej123.hodgepodge.util;

public enum BlockRelativeSide {
BOTTOM,
TOP,
LEFT,
RIGHT,
FRONT,
BACK
}