Working dimensional portals
This commit is contained in:
parent
303bd1e27b
commit
8970bc4c0d
6 changed files with 34 additions and 9 deletions
|
@ -80,4 +80,9 @@ public class DimensionalPortalBlock extends Block implements RiftProvider<Entran
|
|||
public boolean isTall(BlockState cachedState) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) {
|
||||
((EntranceRiftBlockEntity) world.getBlockEntity(pos)).setPortalDestination(world);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.dimdev.dimdoors.rift.targets.PrivatePocketTarget;
|
|||
import org.dimdev.dimdoors.rift.targets.PublicPocketTarget;
|
||||
import org.dimdev.dimdoors.rift.targets.RandomTarget;
|
||||
import org.dimdev.dimdoors.rift.targets.UnstableTarget;
|
||||
import org.dimdev.dimdoors.rift.targets.VirtualTarget;
|
||||
import org.dimdev.dimdoors.util.OptionalBool;
|
||||
import org.dimdev.dimdoors.world.ModDimensions;
|
||||
|
||||
|
@ -37,9 +38,11 @@ import net.minecraft.util.Rarity;
|
|||
import net.minecraft.util.Util;
|
||||
|
||||
public class DoorDataReader {
|
||||
public static final VirtualTarget GOLD_DIMDOOR_TARGET = RandomTarget.builder().acceptedGroups(Collections.singleton(0)).coordFactor(1).negativeDepthFactor(10000).positiveDepthFactor(80).weightMaximum(100).noLink(false).noLinkBack(false).newRiftWeight(1).build();
|
||||
public static final LinkProperties GOLD_DIMDOOR_PROPERTIES = LinkProperties.builder().groups(new HashSet<>(Arrays.asList(0, 1))).linksRemaining(1).build();
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().setLenient().create();
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final DoorData DEFAULT_IRON_DIMENSIONAL_DOOR = new DoorData(
|
||||
public static final DoorData DEFAULT_IRON_DIMENSIONAL_DOOR = new DoorData(
|
||||
"dimdoors:iron_dimensional_door",
|
||||
new DoorData.UnbakedItemSettings(
|
||||
Optional.empty(),
|
||||
|
@ -53,7 +56,7 @@ public class DoorDataReader {
|
|||
OptionalInt.of(10)
|
||||
), new RiftDataList(Util.make(new LinkedList<>(), list -> list.add(new Pair<>(new RiftDataList.OptRiftData(Optional.of(new PublicPocketTarget()), Optional.empty()), AlwaysTrueCondition.INSTANCE)))
|
||||
));
|
||||
private static final DoorData DEFAULT_GOLD_DIMENSIONAL_DOOR = new DoorData(
|
||||
public static final DoorData DEFAULT_GOLD_DIMENSIONAL_DOOR = new DoorData(
|
||||
"dimdoors:gold_dimensional_door",
|
||||
new DoorData.UnbakedItemSettings(
|
||||
Optional.empty(),
|
||||
|
@ -65,9 +68,9 @@ public class DoorDataReader {
|
|||
new DoorData.UnbakedBlockSettings(
|
||||
"dimdoors:gold_door",
|
||||
OptionalInt.of(10)
|
||||
), new RiftDataList(Util.make(new LinkedList<>(), list -> list.add(new Pair<>(new RiftDataList.OptRiftData(Optional.of(RandomTarget.builder().acceptedGroups(Collections.singleton(0)).coordFactor(1).negativeDepthFactor(10000).positiveDepthFactor(80).weightMaximum(100).noLink(false).noLinkBack(false).newRiftWeight(1).build()), Optional.of(LinkProperties.builder().groups(new HashSet<>(Arrays.asList(0, 1))).linksRemaining(1).build())), AlwaysTrueCondition.INSTANCE)))
|
||||
), new RiftDataList(Util.make(new LinkedList<>(), list -> list.add(new Pair<>(new RiftDataList.OptRiftData(Optional.of(GOLD_DIMDOOR_TARGET), Optional.of(GOLD_DIMDOOR_PROPERTIES)), AlwaysTrueCondition.INSTANCE)))
|
||||
));
|
||||
private static final DoorData DEFAULT_OAK_DIMENSIONAL_DOOR = new DoorData(
|
||||
public static final DoorData DEFAULT_OAK_DIMENSIONAL_DOOR = new DoorData(
|
||||
"dimdoors:oak_dimensional_door",
|
||||
new DoorData.UnbakedItemSettings(
|
||||
Optional.empty(),
|
||||
|
@ -81,7 +84,7 @@ public class DoorDataReader {
|
|||
OptionalInt.of(10)
|
||||
), new RiftDataList(Util.make(new LinkedList<>(), list -> list.add(new Pair<>(new RiftDataList.OptRiftData(Optional.of(RandomTarget.builder().acceptedGroups(Collections.singleton(0)).coordFactor(1).negativeDepthFactor(80).positiveDepthFactor(Double.MAX_VALUE).weightMaximum(100).noLink(false).newRiftWeight(0).build()), Optional.empty()), AlwaysTrueCondition.INSTANCE)))
|
||||
));
|
||||
private static final DoorData DEFAULT_QUARTZ_DIMENSIONAL_DOOR = new DoorData(
|
||||
public static final DoorData DEFAULT_QUARTZ_DIMENSIONAL_DOOR = new DoorData(
|
||||
"dimdoors:quartz_dimensional_door",
|
||||
new DoorData.UnbakedItemSettings(
|
||||
Optional.empty(),
|
||||
|
@ -99,7 +102,7 @@ public class DoorDataReader {
|
|||
list.add(new Pair<>(new RiftDataList.OptRiftData(Optional.of(new PrivatePocketTarget()), Optional.empty()), new InverseCondition(condition)));
|
||||
})
|
||||
));
|
||||
private static final DoorData DEFAULT_UNSTABLE_DIMENSIONAL_DOOR = new DoorData(
|
||||
public static final DoorData DEFAULT_UNSTABLE_DIMENSIONAL_DOOR = new DoorData(
|
||||
"dimdoors:unstable_dimensional_door",
|
||||
new DoorData.UnbakedItemSettings(
|
||||
Optional.empty(),
|
||||
|
|
|
@ -4,14 +4,18 @@ import java.util.Optional;
|
|||
|
||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||
import org.dimdev.dimdoors.block.CoordinateTransformerBlock;
|
||||
import org.dimdev.dimdoors.block.ModBlocks;
|
||||
import org.dimdev.dimdoors.block.RiftProvider;
|
||||
import org.dimdev.dimdoors.block.door.data.DoorDataReader;
|
||||
import org.dimdev.dimdoors.client.DefaultTransformation;
|
||||
import org.dimdev.dimdoors.client.Transformer;
|
||||
import org.dimdev.dimdoors.item.RiftKeyItem;
|
||||
import org.dimdev.dimdoors.rift.registry.Rift;
|
||||
import org.dimdev.dimdoors.rift.targets.EscapeTarget;
|
||||
import org.dimdev.dimdoors.util.EntityUtils;
|
||||
import org.dimdev.dimdoors.util.TeleportUtil;
|
||||
import org.dimdev.dimdoors.util.math.TransformationMatrix3d;
|
||||
import org.dimdev.dimdoors.world.ModDimensions;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -28,11 +32,13 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.EulerAngle;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
public class EntranceRiftBlockEntity extends RiftBlockEntity {
|
||||
private static final EscapeTarget ESCAPE_TARGET = new EscapeTarget(true);
|
||||
private boolean locked;
|
||||
|
||||
public EntranceRiftBlockEntity(BlockPos pos, BlockState state) {
|
||||
|
@ -153,4 +159,13 @@ public class EntranceRiftBlockEntity extends RiftBlockEntity {
|
|||
public void setLocked(boolean locked) {
|
||||
this.locked = locked;
|
||||
}
|
||||
|
||||
public void setPortalDestination(World world) {
|
||||
if (ModDimensions.isLimboDimension(world)) {
|
||||
this.setDestination(ESCAPE_TARGET);
|
||||
} else {
|
||||
this.setDestination(DoorDataReader.GOLD_DIMDOOR_TARGET);
|
||||
this.setProperties(DoorDataReader.GOLD_DIMDOOR_PROPERTIES);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.nbt.Tag;
|
|||
|
||||
@Mixin(ListTag.class)
|
||||
public interface ListTagAccessor {
|
||||
@Invoker
|
||||
@Invoker("<init>")
|
||||
static ListTag createListTag(List<Tag> list, byte type) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package org.dimdev.dimdoors.rift.targets;
|
|||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.sound.sampled.Port;
|
||||
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import org.dimdev.dimdoors.util.Location;
|
||||
import org.dimdev.dimdoors.util.RGBA;
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
"client.ExtendedClientPlayNetworkHandlerMixin",
|
||||
"client.GameRendererMixin",
|
||||
"client.InGameHudMixin",
|
||||
"client.accessor.RenderLayerAccessor",
|
||||
"client.WorldRendererMixin"
|
||||
"client.WorldRendererMixin",
|
||||
"client.accessor.RenderLayerAccessor"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
Loading…
Reference in a new issue