WIP: portals
This commit is contained in:
parent
0c36cb3b9e
commit
df8e285757
4 changed files with 55 additions and 3 deletions
30
src/main/java/ru/betterend/item/EternalCrystal.java
Normal file
30
src/main/java/ru/betterend/item/EternalCrystal.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
package ru.betterend.item;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemUsageContext;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import ru.betterend.blocks.RunedFlavolite;
|
||||
import ru.betterend.registry.ItemRegistry;
|
||||
import ru.betterend.util.PortalFrameHelper;
|
||||
|
||||
public class EternalCrystal extends Item {
|
||||
|
||||
public EternalCrystal() {
|
||||
super(ItemRegistry.makeSettings());
|
||||
}
|
||||
|
||||
public ActionResult useOnBlock(ItemUsageContext context) {
|
||||
World world = context.getWorld();
|
||||
BlockPos usedPos = context.getBlockPos();
|
||||
BlockState usedBlock = world.getBlockState(usedPos);
|
||||
if (world instanceof ServerWorld && (usedBlock.getBlock() instanceof RunedFlavolite) && !usedBlock.get(RunedFlavolite.ACTIVATED)) {
|
||||
PortalFrameHelper.checkPortalFrame((ServerWorld) world, usedPos, usedBlock.getBlock());
|
||||
}
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue