From 932247a4d8de7fa989165cbd80af9a21186090bd Mon Sep 17 00:00:00 2001 From: SD Date: Sat, 17 Apr 2021 23:44:46 +0530 Subject: [PATCH] Set dest --- .../block/DimensionalPortalBlock.java | 31 +++++++++++++++++++ .../resources/assets/dimdoors/lang/fr_ca.json | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/dimdev/dimdoors/block/DimensionalPortalBlock.java b/src/main/java/org/dimdev/dimdoors/block/DimensionalPortalBlock.java index fd9315a4..64f609f1 100644 --- a/src/main/java/org/dimdev/dimdoors/block/DimensionalPortalBlock.java +++ b/src/main/java/org/dimdev/dimdoors/block/DimensionalPortalBlock.java @@ -2,13 +2,17 @@ package org.dimdev.dimdoors.block; import org.dimdev.dimdoors.block.entity.DetachedRiftBlockEntity; import org.dimdev.dimdoors.block.entity.EntranceRiftBlockEntity; +import org.dimdev.dimdoors.block.entity.ModBlockEntityTypes; 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.HorizontalFacingBlock; import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityTicker; +import net.minecraft.block.entity.BlockEntityType; import net.minecraft.entity.Entity; import net.minecraft.state.StateManager; import net.minecraft.state.property.DirectionProperty; @@ -85,4 +89,31 @@ public class DimensionalPortalBlock extends Block implements RiftProvider BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { + return Dummy.checkType(type, ModBlockEntityTypes.ENTRANCE_RIFT, DimensionalPortalBlock::portalTick); + } + + private static void portalTick(World world, BlockPos pos, BlockState state, EntranceRiftBlockEntity e) { + e.setPortalDestination(world); + } + + private static final class Dummy extends BlockWithEntity { + protected Dummy(Settings settings) { + super(settings); + } + + @Nullable + protected static BlockEntityTicker checkType(BlockEntityType givenType, BlockEntityType expectedType, BlockEntityTicker ticker) { + return BlockWithEntity.checkType(givenType, expectedType, ticker); + } + + @Nullable + @Override + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return null; + } + } } diff --git a/src/main/resources/assets/dimdoors/lang/fr_ca.json b/src/main/resources/assets/dimdoors/lang/fr_ca.json index 653d6904..f2cbd320 100644 --- a/src/main/resources/assets/dimdoors/lang/fr_ca.json +++ b/src/main/resources/assets/dimdoors/lang/fr_ca.json @@ -106,4 +106,4 @@ "dimdoors.monoliths.tooltip": "Options qui déterminent à quel point les monolithes sont dangereux", "dimdoors.limbo": "Options sur les Limbes", "dimdoors.limbo.tooltip": "Options qui déterminent divers aspects sur la dimension des Limbes" -} \ No newline at end of file +}