Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Big Torch works with spawners, Common Protection API support with Lasso #226

Open
wants to merge 2 commits into
base: 1.20
Choose a base branch
from
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
7 changes: 7 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ repositories {
name = "Shedaniel"
url = uri("https://maven.shedaniel.me/")
}
maven {
name = "Nucleoid"
url = uri("https://maven.nucleoid.xyz/")
}
mavenLocal()
}

Expand All @@ -111,6 +115,9 @@ dependencies {

modImplementation("me.shedaniel:RoughlyEnoughItems-fabric:${project["rei_version"]}")
modImplementation("com.terraformersmc:modmenu:${project["modmenu_version"]}")

modImplementation("eu.pb4:common-protection-api:${project["cpa_version"]}")
include("eu.pb4:common-protection-api:${project["cpa_version"]}")
}

tasks.processResources {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ trinkets_version=3.7.0
dashloader_version=2.0
modmenu_version=7.0.1
rei_version=12.0.613
cpa_version=1.0.0

# Publishing
curseforge_id=388832
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.KibeModKt;
import io.github.lucaargolo.kibe.blocks.bigtorch.BigTorchBlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
Expand All @@ -19,7 +20,7 @@ public class SpawnRestrictionMixin {

@Inject(at = @At("HEAD"), method = "canSpawn")
private static <T extends Entity> void headCanSpawn(EntityType<T> type, ServerWorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random, CallbackInfoReturnable<Boolean> cir) {
if (BigTorchBlockEntity.Companion.isChunkSuppressed(world.toServerWorld().getRegistryKey(), new ChunkPos(pos))) {
if (BigTorchBlockEntity.Companion.isChunkSuppressed(world.toServerWorld().getRegistryKey(), new ChunkPos(pos)) && (spawnReason != SpawnReason.SPAWNER || KibeModKt.getMOD_CONFIG().getMiscellaneousModule().getBigTorchBlocksSpawnerMobs())) {
BigTorchBlockEntity.Companion.setTestingThread(Thread.currentThread());
BigTorchBlockEntity.Companion.setTesting(true);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.lucaargolo.kibe.items.miscellaneous

import eu.pb4.common.protection.api.CommonProtection
import io.github.lucaargolo.kibe.MOD_CONFIG
import io.github.lucaargolo.kibe.effects.CURSED_EFFECT
import net.minecraft.client.item.TooltipContext
Expand Down Expand Up @@ -32,7 +33,7 @@ abstract class Lasso(settings: Settings): Item(settings) {

override fun useOnEntity(stack: ItemStack, user: PlayerEntity, entity: LivingEntity, hand: Hand): ActionResult {
if (stack.nbt == null || !stack.orCreateNbt.contains("Entity")) {
if (entity is MobEntity && canStoreEntity(entity.type) && !MOD_CONFIG.miscellaneousModule.lassoDenyList.contains(Registries.ENTITY_TYPE.getId(entity.type).toString())) {
if (entity is MobEntity && canStoreEntity(entity.type) && !MOD_CONFIG.miscellaneousModule.lassoDenyList.contains(Registries.ENTITY_TYPE.getId(entity.type).toString()) && CommonProtection.canInteractEntity(user.world, entity, user.gameProfile, user)) {
if(!user.world.isClient) {
if (entity.isLeashed) entity.detachLeash(true, true)
entity.fallDistance = 0f
Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/io/github/lucaargolo/kibe/utils/ModConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class ModConfig {
var lassoDenyList: ArrayList<String> = arrayListOf()
//Max rings per player
var maxRingsPerPlayer: Int = 1
// If mega torch blocks the spawn of mobs that are from spawners.
var bigTorchBlocksSpawnerMobs: Boolean = false
}

class ChunkLoaderModule {
Expand Down