DungeonPocket -> V2

This commit is contained in:
CreepyCre 2021-02-09 14:32:38 +01:00
parent 7b1d154ea2
commit 0ace3ffa76
5 changed files with 10 additions and 11 deletions

View file

@ -2,15 +2,12 @@ package org.dimdev.dimdoors.item;
import java.util.List;
import net.fabricmc.fabric.api.event.player.AttackBlockCallback;
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
import net.minecraft.util.hit.BlockHitResult;
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
import org.dimdev.dimdoors.block.entity.RiftBlockEntity;
import net.minecraft.block.BlockState;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -20,7 +17,6 @@ import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.fabricmc.api.Environment;
@ -53,7 +49,7 @@ public class RiftConfigurationToolItem extends Item {
Counter counter = Counter.get(stack);
if (RaycastHelper.hitsRift(hit, world)) {
RiftBlockEntity rift = (RiftBlockEntity) world.getBlockEntity(new BlockPos(hit.getPos()));
RiftBlockEntity rift = (RiftBlockEntity) world.getBlockEntity(((BlockHitResult) hit).getBlockPos());
if (rift.getDestination() instanceof IdMarker) {
EntityUtils.chat(player, Text.of("Id: " + ((IdMarker) rift.getDestination()).getId()));

View file

@ -69,6 +69,10 @@ public final class PocketGenerator {
return pocketGeneratorReference.prepareAndPlacePocket(parameters);
}
public static Pocket generateDungeonPocketV2(VirtualLocation virtualLocation, VirtualTarget linkTo, LinkProperties linkProperties) {
return generateFromPocketGroupV2(DimensionalDoorsInitializer.getWorld(ModDimensions.DUNGEON), "dungeon", virtualLocation, linkTo, linkProperties);
}
/**
* Create a dungeon pockets at a certain depth.
*

View file

@ -171,7 +171,7 @@ public class RandomTarget extends VirtualTarget { // TODO: Split into DungeonTar
// Make a new dungeon pocket
RiftBlockEntity thisRift = (RiftBlockEntity) this.location.getBlockEntity();
LinkProperties newLink = thisRift.getProperties() != null ? thisRift.getProperties().toBuilder().linksRemaining(0).build() : null;
Pocket pocket = PocketGenerator.generateDungeonPocket(virtualLocation, new GlobalReference(!this.noLinkBack ? this.location : null), newLink); // TODO make the generated dungeon of the same type, but in the overworld
Pocket pocket = PocketGenerator.generateDungeonPocketV2(virtualLocation, new GlobalReference(!this.noLinkBack ? this.location : null), newLink); // TODO make the generated dungeon of the same type, but in the overworld
// Link the rift if necessary and teleport the entity
if (!this.noLink) linkRifts(this.location, DimensionalRegistry.getRiftRegistry().getPocketEntrance(pocket));

View file

@ -1,12 +1,10 @@
package org.dimdev.dimdoors.world.level;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import dev.onyxstudios.cca.api.v3.component.ComponentV3;
import dev.onyxstudios.cca.api.v3.item.ItemComponent;
public class Counter extends ItemComponent implements ComponentV3 {
public class Counter extends ItemComponent {
public Counter(ItemStack stack) {
super(stack, DimensionalDoorsComponents.COUNTER_COMPONENT_KEY);

View file

@ -60,6 +60,7 @@
"item.dimdoors.stabilized_rift_signature.stored": "Location stored",
"item.dimdoors.stabilized_rift_signature.created": "Rift created",
"item.dimdoors.rift_configuration_tool": "Rift Configuration Tool",
"item.dimdoors.rift_configuration_tool.info": "TODO",
"item.dimdoors.rift_remover": "Rift Remover",
"item.dimdoors.rift_remover.closing": "The rift will close soon",
"item.dimdoors.rift_remover.already_closing": "This rift is already closing",
@ -191,4 +192,4 @@
"argument.dimdoors.schematic.invalidNamespace": "Invalid schematic namespace. Expected one of %s, found %s.",
"command.dimdoors.schematicv2.unknownSchematic": "Unknown schematic \"%s\" in namespace \"%s\" ",
"dimdoors.config.screen.reload": "Reload Config"
}
}