WIP: start Eternal ritual
This commit is contained in:
parent
8e5cbe19f3
commit
2a18714c4c
3 changed files with 47 additions and 4 deletions
|
@ -1,14 +1,16 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
|
||||
import ru.betterend.blocks.basis.BlockBase;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -30,8 +32,7 @@ public class RunedFlavolite extends BlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||
super.onBreak(world, pos, state, player);
|
||||
public void onBroken(WorldAccess world, BlockPos pos, BlockState state) {
|
||||
BlockPos bottom = PortalFrameHelper.findBottomCorner((World) world, pos, this);
|
||||
BlockPos top = PortalFrameHelper.findTopCorner((World) world, pos, this);
|
||||
if (bottom == null || top == null) return;
|
||||
|
|
|
@ -8,6 +8,7 @@ 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.EndBlocks;
|
||||
import ru.betterend.registry.EndItems;
|
||||
import ru.betterend.util.PortalFrameHelper;
|
||||
|
||||
|
@ -22,8 +23,9 @@ public class EternalCrystal extends Item {
|
|||
if (world.isClient) return ActionResult.CONSUME;
|
||||
BlockPos usedPos = context.getBlockPos();
|
||||
BlockState usedBlock = world.getBlockState(usedPos);
|
||||
if (usedBlock.getBlock() instanceof RunedFlavolite && !usedBlock.get(RunedFlavolite.ACTIVATED)) {
|
||||
if (usedBlock.isOf(EndBlocks.FLAVOLITE_RUNED) && !usedBlock.get(RunedFlavolite.ACTIVATED)) {
|
||||
if (PortalFrameHelper.checkPortalFrame((ServerWorld) world, usedPos, usedBlock.getBlock())) {
|
||||
context.getStack().decrement(1);
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
40
src/main/java/ru/betterend/util/EternalPortalHelper.java
Normal file
40
src/main/java/ru/betterend/util/EternalPortalHelper.java
Normal file
|
@ -0,0 +1,40 @@
|
|||
package ru.betterend.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import ru.betterend.blocks.EternalPedestal;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
public class EternalPortalHelper {
|
||||
private final static Map<Integer, Integer> structureMap = new HashMap<Integer, Integer>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
{
|
||||
put(0, 7);
|
||||
put(1, 1);
|
||||
put(1, 11);
|
||||
put(11, 1);
|
||||
put(11, 11);
|
||||
put(12, 7);
|
||||
}
|
||||
};
|
||||
private final static Block PEDESTAL = EndBlocks.ETERNAL_PEDESTAL;
|
||||
private final static BooleanProperty ACTIVE = EternalPedestal.ACTIVATED;
|
||||
|
||||
private static int centerX = 6;
|
||||
private static int centerZ = 6;
|
||||
|
||||
public static boolean checkPortalStructure(World world, BlockPos pos) {
|
||||
if (!world.getBlockState(pos).isOf(PEDESTAL)) return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static BlockPos finedCorner(World world, BlockPos pos) {
|
||||
|
||||
return pos;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue