Skip to content

Commit

Permalink
fix bds&m
Browse files Browse the repository at this point in the history
  • Loading branch information
MCTian-mi committed Aug 2, 2024
1 parent abc7b53 commit ac3ed1f
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 5 deletions.
7 changes: 4 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ dependencies {
implementation rfg.deobf("curse.maven:modularui-624243:5153413")

compileOnly rfg.deobf("curse.maven:ynet-an-xnet-fork-999559:5243319") // XNet-1.8.3-ynet
compileOnly rfg.deobf("curse.maven:rftools-224641:2861573") // RFTools 7.73
compileOnly rfg.deobf("curse.maven:mcjtylib-233105:2745846")
implementation rfg.deobf("curse.maven:rftools-224641:2861573") // RFTools 7.73
implementation rfg.deobf("curse.maven:mcjtylib-233105:2745846")
compileOnly rfg.deobf("curse.maven:redstone-flux-270789:2920436")
compileOnly rfg.deobf("curse.maven:rftools-224641:2861573")
compileOnly rfg.deobf("curse.maven:tesla-244651:2487959")
compileOnly rfg.deobf("curse.maven:hwyla-253449:2568751")

implementation rfg.deobf("curse.maven:barrels-drums-storage-more-319404:2708193")
}
5 changes: 3 additions & 2 deletions src/main/java/supersymmetry/Supersymmetry.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package supersymmetry;

import gregtech.GTInternalTags;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLConstructionEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import org.jetbrains.annotations.NotNull;
import supersymmetry.api.event.MobHordeEvent;
import supersymmetry.api.sound.SusySounds;
import supersymmetry.common.CommonProxy;
import supersymmetry.common.SusyMetaEntities;
Expand All @@ -22,6 +20,7 @@
import supersymmetry.common.covers.SuSyCoverBehaviors;
import supersymmetry.common.item.SuSyMetaItems;
import supersymmetry.common.metatileentities.SuSyMetaTileEntities;
import supersymmetry.integration.bdsandm.BDSAndMModule;
import supersymmetry.loaders.SuSyIRLoader;

@Mod(name = Supersymmetry.NAME, modid = Supersymmetry.MODID, version = Tags.VERSION, dependencies = GTInternalTags.DEP_VERSION_STRING + ";required-after:gcym;after:immersiverailroading")
Expand Down Expand Up @@ -63,6 +62,8 @@ public void onPreInit(@NotNull FMLPreInitializationEvent event) {
public void onInit(@NotNull FMLInitializationEvent event) {
proxy.load();
SuSyCoverBehaviors.init();

BDSAndMModule.init();
}

@Mod.EventHandler
Expand Down
37 changes: 37 additions & 0 deletions src/main/java/supersymmetry/integration/bdsandm/BDSAndMModule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package supersymmetry.integration.bdsandm;

import funwayguy.bdsandm.blocks.tiles.TileEntityBarrel;
import funwayguy.bdsandm.core.BDSM;
import gregtech.api.cover.CoverRayTracer;
import gregtech.common.items.tool.rotation.CustomBlockRotations;
import gregtech.common.items.tool.rotation.ICustomRotationBehavior;
import net.minecraft.block.BlockDirectional;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;

import java.util.Objects;

public class BDSAndMModule {

public static final ICustomRotationBehavior BDSAndM_BARREL_BEHAVIOR = (state, world, pos, hitResult) -> {
EnumFacing gridSide = CoverRayTracer.determineGridSideHit(hitResult);
if (gridSide == null) return false;
gridSide = gridSide.getOpposite(); // idk what's happening here, blame the original author
if (gridSide != state.getValue(BlockDirectional.FACING)) {
TileEntityBarrel barrel = ((TileEntityBarrel) world.getTileEntity(pos));
if (barrel != null) {
state = state.withProperty(BlockDirectional.FACING, gridSide);
NBTTagCompound tagCompound = barrel.writeToNBT(new NBTTagCompound());
world.setBlockState(pos, state);
Objects.requireNonNull(world.getTileEntity(pos)).readFromNBT(tagCompound);
return true;
}
}
return false;
};

public static void init() {
CustomBlockRotations.registerCustomRotation(BDSM.blockMetalBarrel, BDSAndM_BARREL_BEHAVIOR);
CustomBlockRotations.registerCustomRotation(BDSM.blockWoodBarrel, BDSAndM_BARREL_BEHAVIOR);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package supersymmetry.mixins.bdsandm;

import funwayguy.bdsandm.blocks.BlockBarrelBase;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(BlockBarrelBase.class)
public class BlockBarrelBaseMixin {

@Redirect(method = "withdrawItem",
remap = false,
at = @At(value = "INVOKE",
target = "Ljava/lang/Math;min(II)I",
ordinal = 0))
private int redirectMin(int a, int b) {
return b;
}

}
1 change: 1 addition & 0 deletions src/main/resources/mixins.susy.late.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"minVersion" : "0.8",
"compatibilityLevel" : "JAVA_8",
"mixins" : [
"bdsandm.BlockBarrelBaseMixin",
"gregtech.BlockMachineMixin",
"rftools.InventoryInfoMixin",
"rftools.PacketGetInventoryInfoMixin",
Expand Down

0 comments on commit ac3ed1f

Please sign in to comment.