Added the ability to prevent usage of rift signatures in personal pocket dimensions with config.

This commit is contained in:
Waterpicker 2021-05-05 06:40:06 -05:00
parent 87e8e20025
commit c95bbfad9e
3 changed files with 11 additions and 0 deletions

View file

@ -156,6 +156,7 @@ public final class ModConfig implements ConfigData {
@Tooltip @EnumHandler(option = BUTTON) public ExtendedResourcePackActivationType classicPocketsResourcePackActivationType = ExtendedResourcePackActivationType.DEFAULT_ENABLED;
@Tooltip @EnumHandler(option = BUTTON) public ExtendedResourcePackActivationType defaultPocketsResourcePackActivationType = ExtendedResourcePackActivationType.DEFAULT_ENABLED;
@Tooltip public boolean asyncWorldEditPocketLoading = true;
@Tooltip public boolean canUseRiftSignatureInPrivatePockets = true;
}
public static class World {

View file

@ -2,13 +2,16 @@ package org.dimdev.dimdoors.item;
import java.util.List;
import net.fabricmc.api.ModInitializer;
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
import org.dimdev.dimdoors.ModConfig;
import org.dimdev.dimdoors.block.ModBlocks;
import org.dimdev.dimdoors.block.entity.DetachedRiftBlockEntity;
import org.dimdev.dimdoors.rift.targets.RiftReference;
import org.dimdev.dimdoors.sound.ModSoundEvents;
import org.dimdev.dimdoors.api.util.Location;
import org.dimdev.dimdoors.api.util.RotatedLocation;
import org.dimdev.dimdoors.world.ModDimensions;
import org.jetbrains.annotations.NotNull;
import net.minecraft.client.item.TooltipContext;
@ -23,6 +26,7 @@ import net.minecraft.sound.SoundCategory;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
@ -65,6 +69,11 @@ public class RiftSignatureItem extends Item {
return ActionResult.SUCCESS;
}
if(ModDimensions.isPrivatePocketDimension(world) && !DimensionalDoorsInitializer.getConfig().getPocketsConfig().canUseRiftSignatureInPrivatePockets) {
player.sendMessage(new TranslatableText("tools.signature_blocked").formatted(Formatting.BLACK), true);
return ActionResult.FAIL;
}
RotatedLocation target = getSource(stack);
if (target == null) {

View file

@ -154,6 +154,7 @@
"rifts.entrances.cannot_be_placed_on_rift": "This type of door can't be placed on a rift.",
"tools.rift_miss": "You can only use this item on a rift's core",
"tools.signature_blocked": "Usage of the signature was block",
"tools.target_became_block": "Failed, there is now a block at the stored location",
"text.autoconfig.dimdoors.category.general": "General Settings",