Skip to content

Commit

Permalink
fix compat with SecurityCraft
Browse files Browse the repository at this point in the history
  • Loading branch information
FalsePattern committed Dec 27, 2024
1 parent 3a545c1 commit 8aa8832
Show file tree
Hide file tree
Showing 7 changed files with 204 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,6 @@ dependencies {
compileOnly(deobfCurse("techguns-244201:2429662"))
// Malisis Core 0.14.3
compileOnly(deobfCurse("malisiscore-223896:2283267"))
// SecurityCraft 1.8.13
compileOnly(deobfCurse("securitycraft-64760:2818228"))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* This file is part of FalseTweaks.
*
* Copyright (C) 2022-2024 FalsePattern
* All Rights Reserved
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* FalseTweaks is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FalseTweaks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FalseTweaks. If not, see <https://www.gnu.org/licenses/>.
*/

package com.falsepattern.falsetweaks.mixin.mixins.common.compat.sc;

import net.geforcemods.securitycraft.blocks.reinforced.BlockReinforcedFenceGate;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.BlockStainedGlassPane;
import cpw.mods.fml.common.ObfuscationReflectionHelper;

@Mixin(BlockReinforcedFenceGate.class)
public abstract class BlockReinforcedFenceGateMixin extends BlockFenceGate {
@Redirect(method = "<init>",
at = @At(value = "INVOKE",
target = "Lcpw/mods/fml/common/ObfuscationReflectionHelper;setPrivateValue(Ljava/lang/Class;Ljava/lang/Object;Ljava/lang/Object;I)V"),
require = 0,
expect = 0)
private <T, E> void fixPriv(Class<T> classToAccess, T instance, E value, int index) {
ObfuscationReflectionHelper.setPrivateValue(classToAccess, instance, value, "field_149764_J", "blockMaterial");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* This file is part of FalseTweaks.
*
* Copyright (C) 2022-2024 FalsePattern
* All Rights Reserved
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* FalseTweaks is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FalseTweaks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FalseTweaks. If not, see <https://www.gnu.org/licenses/>.
*/

package com.falsepattern.falsetweaks.mixin.mixins.common.compat.sc;

import net.geforcemods.securitycraft.blocks.reinforced.BlockReinforcedFenceGate;
import net.geforcemods.securitycraft.blocks.reinforced.BlockReinforcedGlassPane;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.BlockPane;
import net.minecraft.block.material.Material;
import cpw.mods.fml.common.ObfuscationReflectionHelper;

@Mixin(BlockReinforcedGlassPane.class)
public abstract class BlockReinforcedGlassPaneMixin extends BlockPane {
protected BlockReinforcedGlassPaneMixin(String p_i45432_1_, String p_i45432_2_, Material p_i45432_3_, boolean p_i45432_4_) {
super(p_i45432_1_, p_i45432_2_, p_i45432_3_, p_i45432_4_);
}

@Redirect(method = "<init>",
at = @At(value = "INVOKE",
target = "Lcpw/mods/fml/relauncher/ReflectionHelper;setPrivateValue(Ljava/lang/Class;Ljava/lang/Object;Ljava/lang/Object;I)V"),
require = 0,
expect = 0)
private <T, E> void fixPriv(Class<T> classToAccess, T instance, E value, int index) {
isBlockContainer = true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* This file is part of FalseTweaks.
*
* Copyright (C) 2022-2024 FalsePattern
* All Rights Reserved
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* FalseTweaks is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FalseTweaks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FalseTweaks. If not, see <https://www.gnu.org/licenses/>.
*/

package com.falsepattern.falsetweaks.mixin.mixins.common.compat.sc;

import net.geforcemods.securitycraft.blocks.reinforced.BlockReinforcedFenceGate;
import net.geforcemods.securitycraft.blocks.reinforced.BlockReinforcedIronBars;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import net.minecraft.block.BlockPane;
import net.minecraft.block.material.Material;

@Mixin(BlockReinforcedIronBars.class)
public abstract class BlockReinforcedIronBarsMixin extends BlockPane {
protected BlockReinforcedIronBarsMixin(String p_i45432_1_, String p_i45432_2_, Material p_i45432_3_, boolean p_i45432_4_) {
super(p_i45432_1_, p_i45432_2_, p_i45432_3_, p_i45432_4_);
}

@Redirect(method = "<init>",
at = @At(value = "INVOKE",
target = "Lcpw/mods/fml/common/ObfuscationReflectionHelper;setPrivateValue(Ljava/lang/Class;Ljava/lang/Object;Ljava/lang/Object;I)V"),
require = 0,
expect = 0)
private <T, E> void fixPriv(Class<T> classToAccess, T instance, E value, int index) {
this.stepSound = soundTypeMetal;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* This file is part of FalseTweaks.
*
* Copyright (C) 2022-2024 FalsePattern
* All Rights Reserved
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* FalseTweaks is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FalseTweaks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FalseTweaks. If not, see <https://www.gnu.org/licenses/>.
*/

package com.falsepattern.falsetweaks.mixin.mixins.common.compat.sc;

import net.geforcemods.securitycraft.blocks.reinforced.BlockReinforcedStainedGlassPanes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import net.minecraft.block.BlockStainedGlassPane;
import cpw.mods.fml.common.ObfuscationReflectionHelper;

@Mixin(BlockReinforcedStainedGlassPanes.class)
public abstract class BlockReinforcedStainedGlassPanesMixin extends BlockStainedGlassPane {
@Redirect(method = "<init>",
at = @At(value = "INVOKE",
target = "Lcpw/mods/fml/common/ObfuscationReflectionHelper;setPrivateValue(Ljava/lang/Class;Ljava/lang/Object;Ljava/lang/Object;I)V"),
require = 0,
expect = 0)
private <T, E> void fixPriv(Class<T> classToAccess, T instance, E value, int index) {
String field = "";
switch (index) {
case 0: field = "field_150100_a"; break;
case 2: field = "field_150101_M"; break;
}
ObfuscationReflectionHelper.setPrivateValue(classToAccess, instance, value, field);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,13 @@ public enum Mixin implements IMixin {
OptiSpam_ShaderExpressionResolverMixin(Side.CLIENT, condition(() -> ModuleConfig.OPTIFINE_LOGSPAM_FIX).and(REQUIRE_OPTIFINE_WITH_SHADERS), "optispam.ShaderExpressionResolverMixin"),
OptiSpam_ShaderPackParserMixin(Side.CLIENT, condition(() -> ModuleConfig.OPTIFINE_LOGSPAM_FIX).and(REQUIRE_OPTIFINE_WITH_SHADERS), "optispam.ShaderPackParserMixin"),
//endregion OptiFine Spam Fix

//region Misc compat fixes
Compat_SC_BlockReinforcedFenceGateMixin(Side.COMMON, require(TargetedMod.SECURITYCRAFT), "compat.sc.BlockReinforcedFenceGateMixin"),
Compat_SC_BlockReinforcedGlassPaneMixin(Side.COMMON, require(TargetedMod.SECURITYCRAFT), "compat.sc.BlockReinforcedGlassPaneMixin"),
Compat_SC_BlockReinforcedIronBarsMixin(Side.COMMON, require(TargetedMod.SECURITYCRAFT), "compat.sc.BlockReinforcedIronBarsMixin"),
Compat_SC_BlockReinforcedStainedGlassPanesMixin(Side.COMMON, require(TargetedMod.SECURITYCRAFT), "compat.sc.BlockReinforcedStainedGlassPanesMixin"),
//endregion
;
// @formatter:on

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public enum TargetedMod implements ITargetedMod {
MALISIS("Malisis Mods", false, contains("malisis")),
MALISIS_NH("Malisis Mods NH", false, contains("malisis").and(contains("gtnh"))),
NOTFINE("NotFine", false, contains("notfine-")),
SECURITYCRAFT("SecurityCraft", false, contains("securitycraft")),
;

public static Predicate<List<ITargetedMod>> REQUIRE_OPTIFINE_WITHOUT_SHADERS = require(OPTIFINE_WITHOUT_SHADERS).or(require(OPTIFINE_WITH_DYNAMIC_LIGHTS));
Expand Down

0 comments on commit 8aa8832

Please sign in to comment.