Skip to content

Commit

Permalink
use efr lanterns everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
Pilzinsel64 committed Apr 20, 2024
1 parent 6f67abf commit 73dface
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@
dependencies {
api("com.github.GTNewHorizons:GTNHLib:0.2.3:dev")
implementation("com.github.GTNewHorizons:ForestryMC:4.8.5:dev")
compileOnly(rfg.deobf("curse.maven:et-futurum-requiem-441392:5268121")) { transitive = false }
}
4 changes: 4 additions & 0 deletions src/main/java/de/pilz/sammelsorium/LateMixinPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public List<String> getMixins(Set<String> loadedMods) {
list.add("MixinForestryPostRegistry");
}

if (loadedMods.contains("etfuturum")) {
list.add("MixinBlockLantern");
}

return list;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ public class ModIntegrationConfigs {
@Config.DefaultBoolean(false)
@Config.RequiresMcRestart
public static boolean forestryMailFixOfflineUUDID;

@Config.Comment("Allows to place lanterns of EFR everywhere.")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean etfuturumPlaceBlockLanternAnywhere;
}
24 changes: 24 additions & 0 deletions src/main/java/de/pilz/sammelsorium/mixins/MixinBlockLantern.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package de.pilz.sammelsorium.mixins;

import net.minecraft.world.World;

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.CallbackInfoReturnable;

import de.pilz.sammelsorium.configuration.ModIntegrationConfigs;
import ganymedes01.etfuturum.blocks.BlockLantern;

@Mixin(BlockLantern.class)
public abstract class MixinBlockLantern {

@Inject(method = "canPlaceBlockAt(Lnet/minecraft/world/World;III)Z", at = @At("HEAD"), cancellable = true)
public void pilzmcsammelsorium$canPlaceBlockAt(World world, int x, int y, int z,
CallbackInfoReturnable<Boolean> callback) {
if (ModIntegrationConfigs.etfuturumPlaceBlockLanternAnywhere) {
callback.setReturnValue(true);
callback.cancel();
}
}
}

0 comments on commit 73dface

Please sign in to comment.