Set dest
This commit is contained in:
parent
9e072bdf0e
commit
932247a4d8
2 changed files with 32 additions and 1 deletions
|
@ -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<Entran
|
|||
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) {
|
||||
((EntranceRiftBlockEntity) world.getBlockEntity(pos)).setPortalDestination(world);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> 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 <E extends BlockEntity, A extends BlockEntity> BlockEntityTicker<A> checkType(BlockEntityType<A> givenType, BlockEntityType<E> expectedType, BlockEntityTicker<? super E> ticker) {
|
||||
return BlockWithEntity.checkType(givenType, expectedType, ticker);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue