Merge pull request #203 from MalekiRe/1.17
Fixed every single non-graphical bug with dimensional doors sans rifts spawning too frequentyly
This commit is contained in:
commit
68586452bd
14 changed files with 214 additions and 34 deletions
|
@ -102,7 +102,7 @@ public final class ModConfig implements ConfigData {
|
|||
@Tooltip public double riftCloseSpeed = 0.01;
|
||||
@Tooltip public double riftGrowthSpeed = 1;
|
||||
@Tooltip public int depthSpreadFactor = 20;
|
||||
@Tooltip public double endermanSpawnChance = 0.001;
|
||||
@Tooltip public double endermanSpawnChance = 0.00005;
|
||||
@Tooltip public double endermanAggressiveChance = 0.5;
|
||||
}
|
||||
|
||||
|
@ -196,6 +196,7 @@ public final class ModConfig implements ConfigData {
|
|||
@Tooltip public boolean universalLimbo = false;
|
||||
@Tooltip public boolean hardcoreLimbo = false;
|
||||
@Tooltip public double decaySpreadChance = 0.5;
|
||||
@Tooltip public float limboBlocksCorruptingOverworldAmount = 5;
|
||||
}
|
||||
|
||||
public static class Graphics {
|
||||
|
|
|
@ -2,18 +2,16 @@ package org.dimdev.dimdoors.block;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import org.dimdev.dimdoors.block.entity.DetachedRiftBlockEntity;
|
||||
import org.dimdev.dimdoors.block.entity.ModBlockEntityTypes;
|
||||
import org.dimdev.dimdoors.particle.client.RiftParticleEffect;
|
||||
import org.dimdev.dimdoors.world.ModDimensions;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BlockWithEntity;
|
||||
import net.minecraft.block.MapColor;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityTicker;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
|
@ -26,13 +24,13 @@ import net.minecraft.world.World;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
public class DetachedRiftBlock extends BlockWithEntity implements RiftProvider<DetachedRiftBlockEntity> {
|
||||
public class DetachedRiftBlock extends WaterLoggableBlockWithEntity implements RiftProvider<DetachedRiftBlockEntity>, Waterloggable {
|
||||
public static final String ID = "rift";
|
||||
|
||||
public DetachedRiftBlock(Block.Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MapColor getDefaultMapColor() {
|
||||
return MapColor.BLACK;
|
||||
|
|
|
@ -69,9 +69,13 @@ public class DimensionalPortalBlock extends Block implements RiftProvider<Entran
|
|||
world.setBlockState(pos, ModBlocks.DETACHED_RIFT.getDefaultState());
|
||||
((DetachedRiftBlockEntity) world.getBlockEntity(pos)).setData(rift.getData());
|
||||
|
||||
/*
|
||||
New plan, we use players spawn points as the exit points from limbo, this code will no longer be used.
|
||||
DimensionalRegistry.getRiftRegistry().setOverworldRift(entity.getUuid(), new Location((ServerWorld) world, pos));
|
||||
LOGGER.log(Level.INFO, "Set overworld rift location");
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
public BlockState rotate(BlockState state, BlockRotation rotation) {
|
||||
|
|
48
src/main/java/org/dimdev/dimdoors/block/UnravelUtil.java
Normal file
48
src/main/java/org/dimdev/dimdoors/block/UnravelUtil.java
Normal file
|
@ -0,0 +1,48 @@
|
|||
package org.dimdev.dimdoors.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import org.dimdev.dimdoors.item.ModItems;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class UnravelUtil {
|
||||
public static final Set<Block> whitelistedBlocksForLimboRemoval = new HashSet<>();
|
||||
public static final Map<Item, Item> unravelItemsMap = new HashMap<>();
|
||||
public static final Map<Block, Block> unravelBlocksMap = new HashMap<>();
|
||||
static {
|
||||
whitelistedBlocksForLimboRemoval.add(Blocks.GRASS_BLOCK);
|
||||
whitelistedBlocksForLimboRemoval.add(Blocks.STONE);
|
||||
whitelistedBlocksForLimboRemoval.add(Blocks.SAND);
|
||||
whitelistedBlocksForLimboRemoval.add(Blocks.SANDSTONE);
|
||||
whitelistedBlocksForLimboRemoval.add(Blocks.ACACIA_LEAVES);
|
||||
whitelistedBlocksForLimboRemoval.add(Blocks.AZALEA_LEAVES);
|
||||
whitelistedBlocksForLimboRemoval.add(Blocks.BIRCH_LEAVES);
|
||||
whitelistedBlocksForLimboRemoval.add(Blocks.DARK_OAK_LEAVES);
|
||||
whitelistedBlocksForLimboRemoval.add(Blocks.JUNGLE_LEAVES);
|
||||
whitelistedBlocksForLimboRemoval.add(Blocks.SPRUCE_LEAVES);
|
||||
whitelistedBlocksForLimboRemoval.add(Blocks.TERRACOTTA);
|
||||
whitelistedBlocksForLimboRemoval.add(Blocks.RED_SAND);
|
||||
|
||||
//Add unravled items when we have them, for now, we do this.
|
||||
unravelItemsMap.put(Items.STONE, Items.COBBLESTONE);
|
||||
unravelItemsMap.put(Items.COBBLESTONE, Items.GRAVEL);
|
||||
unravelItemsMap.put(Items.GRAVEL, Items.SANDSTONE);
|
||||
unravelItemsMap.put(Items.SANDSTONE, Items.SAND);
|
||||
unravelItemsMap.put(Items.SAND, ModItems.UNRAVELLED_FABRIC);
|
||||
|
||||
for(Item item : unravelItemsMap.keySet()) {
|
||||
Item item2 = unravelItemsMap.get(item);
|
||||
if(item instanceof BlockItem && item2 instanceof BlockItem) {
|
||||
unravelBlocksMap.put(((BlockItem)item).getBlock(), ((BlockItem)item2).getBlock());
|
||||
}
|
||||
}
|
||||
unravelBlocksMap.put(Blocks.WATER, ModBlocks.UNFOLDED_BLOCK);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package org.dimdev.dimdoors.block;
|
||||
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.enums.DoubleBlockHalf;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class WaterLoggableBlockWithEntity extends BlockWithEntity implements Waterloggable {
|
||||
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
|
||||
protected WaterLoggableBlockWithEntity(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||||
super.appendProperties(builder);
|
||||
builder.add(WATERLOGGED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
ActionResult result = super.onUse(state, world, pos, player, hand, hit);
|
||||
if (result.isAccepted()) {
|
||||
world.getFluidTickScheduler().schedule(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) {
|
||||
BlockPos up = pos.up();
|
||||
world.setBlockState(up, state.with(WATERLOGGED, world.getFluidState(up).getFluid() == Fluids.WATER), 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) {
|
||||
super.neighborUpdate(state, world, pos, block, fromPos, notify);
|
||||
if (state.get(WATERLOGGED)) {
|
||||
world.getFluidTickScheduler().schedule(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext ctx) {
|
||||
boolean water = ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER;
|
||||
BlockState state = super.getPlacementState(ctx);
|
||||
if (state == null) return null;
|
||||
if (water) return state.with(WATERLOGGED, true);
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
|
||||
if (state.get(WATERLOGGED)) {
|
||||
world.getFluidTickScheduler().schedule(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
|
||||
}
|
||||
|
||||
BlockState newState = super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos);
|
||||
if (newState.isAir() && state.getFluidState().getFluid() == Fluids.WATER) return Blocks.WATER.getDefaultState();
|
||||
return newState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state);
|
||||
}
|
||||
}
|
|
@ -111,7 +111,7 @@ public class DimensionalDoorBlock extends WaterLoggableDoorBlock implements Rift
|
|||
}
|
||||
if (blockEntity instanceof EntranceRiftBlockEntity
|
||||
&& blockState.get(HALF) == DoubleBlockHalf.LOWER) {
|
||||
world.setBlockState(blockPos, ModBlocks.DETACHED_RIFT.getDefaultState());
|
||||
world.setBlockState(blockPos, ModBlocks.DETACHED_RIFT.getDefaultState().with(WATERLOGGED, blockState.get(WATERLOGGED)));
|
||||
((DetachedRiftBlockEntity) world.getBlockEntity(blockPos)).setData(((EntranceRiftBlockEntity) blockEntity).getData());
|
||||
}
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ public class DimensionalDoorBlock extends WaterLoggableDoorBlock implements Rift
|
|||
&& !DimensionalDoorsInitializer.getConfig().getDoorsConfig().placeRiftsInCreativeMode
|
||||
)
|
||||
) {
|
||||
world.setBlockState(blockPos, ModBlocks.DETACHED_RIFT.getDefaultState());
|
||||
world.setBlockState(blockPos, ModBlocks.DETACHED_RIFT.getDefaultState().with(WATERLOGGED, blockState.get(WATERLOGGED)));
|
||||
((DetachedRiftBlockEntity) world.getBlockEntity(blockPos)).setData(((EntranceRiftBlockEntity) blockEntity).getData());
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class DimensionalDoorBlock extends WaterLoggableDoorBlock implements Rift
|
|||
return;
|
||||
}
|
||||
if (blockEntity instanceof EntranceRiftBlockEntity && state.get(HALF) == DoubleBlockHalf.LOWER) {
|
||||
world.setBlockState(pos, ModBlocks.DETACHED_RIFT.getDefaultState());
|
||||
world.setBlockState(pos, ModBlocks.DETACHED_RIFT.getDefaultState().with(WATERLOGGED, state.get(WATERLOGGED)));
|
||||
((DetachedRiftBlockEntity) world.getBlockEntity(pos)).setData(((EntranceRiftBlockEntity) blockEntity).getData());
|
||||
}
|
||||
});
|
||||
|
|
|
@ -48,7 +48,7 @@ public class DetachedRiftBlockEntity extends RiftBlockEntity {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!world.isClient() && random.nextDouble() < DimensionalDoorsInitializer.getConfig().getGeneralConfig().endermanSpawnChance) {
|
||||
if (!world.isClient() && random.nextFloat() < DimensionalDoorsInitializer.getConfig().getGeneralConfig().endermanSpawnChance) {
|
||||
EndermanEntity enderman = EntityType.ENDERMAN.spawn(
|
||||
(ServerWorld) world,
|
||||
null,
|
||||
|
|
|
@ -66,7 +66,7 @@ public class EntranceRiftBlockEntity extends RiftBlockEntity {
|
|||
|
||||
@Override
|
||||
public boolean teleport(Entity entity) {
|
||||
//Sets the location where the player should be teleported back to if they are in limbo and try to escape, to be the netrance of the rift that took them into dungeons.
|
||||
//Sets the location where the player should be teleported back to if they are in limbo and try to escape, to be the entrance of the rift that took them into dungeons.
|
||||
|
||||
if (this.isLocked()) {
|
||||
if (entity instanceof LivingEntity) {
|
||||
|
|
|
@ -104,14 +104,16 @@ public class ExplosionMixin {
|
|||
this.world.getProfiler().push("explosion_blocks");
|
||||
if (block.shouldDropItemsOnExplosion((Explosion) (Object) this) && this.world instanceof ServerWorld) {
|
||||
//TODO: Change this to work with trapdoors as well, when we implement trapdoors.
|
||||
if (block instanceof DimensionalDoorBlock) {
|
||||
LOGGER.log(Level.INFO, "Creating Detached Rift From Explosion of Door");
|
||||
((DimensionalDoorBlock) block).createDetachedRift(this.world, blockPos2);
|
||||
continue;
|
||||
}
|
||||
else if(world.getBlockState(blockPos2).getBlock() == DETACHED_RIFT) {
|
||||
continue;
|
||||
}
|
||||
//This is the only changed code
|
||||
if (block instanceof DimensionalDoorBlock) {
|
||||
LOGGER.log(Level.INFO, "Creating Detached Rift From Explosion of Door");
|
||||
((DimensionalDoorBlock) block).createDetachedRift(this.world, blockPos2);
|
||||
continue;
|
||||
}
|
||||
else if(world.getBlockState(blockPos2).getBlock() == DETACHED_RIFT) {
|
||||
continue;
|
||||
}
|
||||
//Normal code below
|
||||
BlockEntity blockEntity = blockState.hasBlockEntity() ? this.world.getBlockEntity(blockPos) : null;
|
||||
LootContext.Builder builder = (new LootContext.Builder((ServerWorld) this.world)).random(this.world.random).parameter(LootContextParameters.ORIGIN, Vec3d.ofCenter(blockPos)).parameter(LootContextParameters.TOOL, ItemStack.EMPTY).optionalParameter(LootContextParameters.BLOCK_ENTITY, blockEntity).optionalParameter(LootContextParameters.THIS_ENTITY, this.entity);
|
||||
if (this.destructionType == Explosion.DestructionType.DESTROY) {
|
||||
|
|
|
@ -63,7 +63,7 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin {
|
|||
@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
|
||||
public void playerTickMixin(CallbackInfo ci) {
|
||||
if (random.nextFloat() <= RANDOM_ACTION_CHANCE) {
|
||||
if(random.nextFloat() <= RANDOM_INCREMENT_FRAY_CHANCE && PlayerModifiersComponent.getFray((PlayerEntity) (Object)this) < 180) {
|
||||
if(random.nextFloat() <= RANDOM_INCREMENT_FRAY_CHANCE && PlayerModifiersComponent.getFray((PlayerEntity) (Object)this) < 180 && ModDimensions.isLimboDimension((((PlayerEntity)(Object)(this)).getEntityWorld()))) {
|
||||
PlayerModifiersComponent.incrementFray((PlayerEntity) (Object)this, 1);
|
||||
}
|
||||
if (PlayerModifiersComponent.getFray(this) >= 125) {
|
||||
|
|
|
@ -1,13 +1,26 @@
|
|||
package org.dimdev.dimdoors.rift.targets;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import com.sk89q.worldedit.util.formatting.text.BlockNbtComponent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.PlayerManager;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.world.World;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||
import org.dimdev.dimdoors.ModConfig;
|
||||
import org.dimdev.dimdoors.api.rift.target.EntityTarget;
|
||||
import org.dimdev.dimdoors.api.util.Location;
|
||||
import org.dimdev.dimdoors.api.util.TeleportUtil;
|
||||
import org.dimdev.dimdoors.block.ModBlocks;
|
||||
import org.dimdev.dimdoors.block.UnravelUtil;
|
||||
import org.dimdev.dimdoors.block.entity.RiftBlockEntity;
|
||||
import org.dimdev.dimdoors.world.ModDimensions;
|
||||
import org.dimdev.dimdoors.world.level.registry.DimensionalRegistry;
|
||||
|
@ -24,6 +37,8 @@ import net.minecraft.util.math.Vec3d;
|
|||
import static org.dimdev.dimdoors.api.util.EntityUtils.chat;
|
||||
|
||||
public class EscapeTarget extends VirtualTarget implements EntityTarget { // TODO: createRift option
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
public static final Codec<EscapeTarget> CODEC = RecordCodecBuilder.create(instance -> instance.group(
|
||||
Codec.BOOL.fieldOf("canEscapeLimbo").forGetter(target -> target.canEscapeLimbo)
|
||||
).apply(instance, EscapeTarget::new));
|
||||
|
@ -44,15 +59,28 @@ public class EscapeTarget extends VirtualTarget implements EntityTarget { // TOD
|
|||
chat(entity, new TranslatableText("rifts.destinations.escape.cannot_escape_limbo"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(entity.getEntityWorld().isClient)
|
||||
return false;
|
||||
UUID uuid = entity.getUuid();
|
||||
if (uuid != null) {
|
||||
Location destLoc = DimensionalRegistry.getRiftRegistry().getOverworldRift(uuid);
|
||||
//This right here is changed to work with a slightly diff system where we just store where we want to player to go, after they leave limbo.
|
||||
/*
|
||||
//Location destLoc = DimensionalRegistry.getRiftRegistry().getOverworldRift(uuid);
|
||||
if(entity.world.getPlayerByUuid(uuid) == null) {
|
||||
LOGGER.log(Level.ERROR, "Tried to get player for escape target from uuid, but player does not exist, uh oh");
|
||||
return false;
|
||||
}
|
||||
LOGGER.log(Level.INFO, "sending player from limbo to their spawnpoint, good luck!");
|
||||
Location destLoc;
|
||||
if(((ServerPlayerEntity)entity.world.getPlayerByUuid(uuid)).getSpawnPointPosition() != null) {
|
||||
destLoc = new Location(((ServerPlayerEntity) entity.world.getPlayerByUuid(uuid)).getSpawnPointDimension(), ((ServerPlayerEntity) entity.world.getPlayerByUuid(uuid)).getSpawnPointPosition());
|
||||
} else {
|
||||
destLoc = new Location(World.OVERWORLD, new BlockPos(0, 0, 0));
|
||||
destLoc = new Location(destLoc.getWorld(), destLoc.getWorld().getSpawnPos());
|
||||
}
|
||||
|
||||
|
||||
if (destLoc != null && destLoc.getBlockEntity() instanceof RiftBlockEntity || this.canEscapeLimbo) {
|
||||
Location location = VirtualLocation.fromLocation(new Location((ServerWorld) entity.world, entity.getBlockPos())).projectToWorld(false);
|
||||
TeleportUtil.teleport(entity, location.getWorld(), location.getBlockPos(), relativeAngle, relativeVelocity);
|
||||
//Location location = VirtualLocation.fromLocation(new Location((ServerWorld) entity.world, entity.getBlockPos())).projectToWorld(false);
|
||||
TeleportUtil.teleport(entity, destLoc.getWorld(), destLoc.getBlockPos(), relativeAngle, relativeVelocity);
|
||||
} else {
|
||||
if (destLoc == null) {
|
||||
chat(entity, new TranslatableText("rifts.destinations.escape.did_not_use_rift"));
|
||||
|
@ -63,12 +91,21 @@ public class EscapeTarget extends VirtualTarget implements EntityTarget { // TOD
|
|||
TeleportUtil.teleport(entity, ModDimensions.LIMBO_DIMENSION, new BlockPos(this.location.getX(), this.location.getY(), this.location.getZ()), relativeAngle, relativeVelocity);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
if(destLoc != null && this.canEscapeLimbo) {
|
||||
Location location = VirtualLocation.fromLocation(new Location((ServerWorld) entity.world, destLoc.pos)).projectToWorld(false);
|
||||
TeleportUtil.teleport(entity, location.getWorld(), location.getBlockPos(), relativeAngle, relativeVelocity);
|
||||
Random random = new Random();
|
||||
BlockPos.iterateOutwards(location.pos.add(0, -4, 0), 3, 2, 3).forEach((pos1 -> {
|
||||
location.getWorld().setBlockState(pos1, ModBlocks.UNRAVELLED_FABRIC.getDefaultState());
|
||||
if(random.nextFloat() < (1/((float)location.pos.getSquaredDistance(pos1)))* DimensionalDoorsInitializer.getConfig().getLimboConfig().limboBlocksCorruptingOverworldAmount) {
|
||||
Block block = location.getWorld().getBlockState(pos1).getBlock();
|
||||
if(UnravelUtil.unravelBlocksMap.containsKey(block))
|
||||
location.getWorld().setBlockState(pos1, UnravelUtil.unravelBlocksMap.get(block).getDefaultState());
|
||||
else if(UnravelUtil.whitelistedBlocksForLimboRemoval.contains(block)) {
|
||||
location.getWorld().setBlockState(pos1, ModBlocks.UNRAVELLED_FABRIC.getDefaultState());
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
else {
|
||||
|
@ -82,6 +119,8 @@ public class EscapeTarget extends VirtualTarget implements EntityTarget { // TOD
|
|||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
} else {
|
||||
return false; // No escape info for that entity
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.dimdev.dimdoors.api.util.TeleportUtil;
|
|||
import org.dimdev.dimdoors.world.ModDimensions;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
|
||||
|
||||
public class LimboTarget extends VirtualTarget implements EntityTarget {
|
||||
public static final LimboTarget INSTANCE = new LimboTarget();
|
||||
|
@ -19,7 +20,7 @@ public class LimboTarget extends VirtualTarget implements EntityTarget {
|
|||
|
||||
@Override
|
||||
public boolean receiveEntity(Entity entity, Vec3d relativePos, EulerAngle relativeAngle, Vec3d relativeVelocity) {
|
||||
TeleportUtil.teleport(entity, ModDimensions.LIMBO_DIMENSION, entity.getPos(), relativeAngle, relativeVelocity);
|
||||
TeleportUtil.teleport(entity, ModDimensions.LIMBO_DIMENSION, entity.getBlockPos().add(0, 255-entity.getBlockY(), 0), relativeAngle, relativeVelocity);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent;
|
|||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.dimdev.dimdoors.DimensionalDoorsComponents;
|
||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||
|
||||
|
@ -19,6 +20,8 @@ import org.dimdev.dimdoors.enchantment.ModEnchants;
|
|||
import java.util.Random;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static org.dimdev.dimdoors.util.schematic.SchematicPlacer.LOGGER;
|
||||
|
||||
public class PlayerModifiersComponent implements ComponentV3, AutoSyncedComponent {
|
||||
private int fray = 0;
|
||||
|
||||
|
@ -84,7 +87,9 @@ public class PlayerModifiersComponent implements ComponentV3, AutoSyncedComponen
|
|||
if(getFray(player) == DimensionalDoorsInitializer.getConfig().getPlayerConfig().fray.maxFray) {
|
||||
killPlayer(player);
|
||||
}
|
||||
System.out.println("fray amount is : " + getFray(player));
|
||||
if(false) {
|
||||
LOGGER.log(Level.INFO, "fray amount is : " + getFray(player));
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public class VirtualLocation {
|
|||
BlockPos pos = getTopPos(world, new BlockPos(newX, 255, newZ));
|
||||
return new Location(world, pos);
|
||||
}
|
||||
private static BlockPos getTopPos(World world, BlockPos pos) {
|
||||
public static BlockPos getTopPos(World world, BlockPos pos) {
|
||||
while(world.getBlockState(pos).isAir()) {
|
||||
pos = pos.down();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue