diff --git a/src/main/java/ru/betterend/blocks/InfusionPedestal.java b/src/main/java/ru/betterend/blocks/InfusionPedestal.java index b10bbf5c..d8562937 100644 --- a/src/main/java/ru/betterend/blocks/InfusionPedestal.java +++ b/src/main/java/ru/betterend/blocks/InfusionPedestal.java @@ -43,7 +43,10 @@ public class InfusionPedestal extends PedestalBlock { } } } - ActionResult result = super.onUse(state, world, pos, player, hand, hit); + ActionResult result = ActionResult.FAIL; + if (hand != null) { + result = super.onUse(state, world, pos, player, hand, hit); + } if (result == ActionResult.SUCCESS) { if (pedestal != null) { if (pedestal.hasRitual()) { diff --git a/src/main/java/ru/betterend/blocks/basis/PedestalBlock.java b/src/main/java/ru/betterend/blocks/basis/PedestalBlock.java index c1011797..787313ab 100644 --- a/src/main/java/ru/betterend/blocks/basis/PedestalBlock.java +++ b/src/main/java/ru/betterend/blocks/basis/PedestalBlock.java @@ -1,5 +1,6 @@ package ru.betterend.blocks.basis; +import java.awt.Point; import java.io.Reader; import java.util.HashMap; import java.util.List; @@ -29,6 +30,7 @@ import net.minecraft.util.Hand; import net.minecraft.util.Identifier; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockPos.Mutable; import net.minecraft.util.math.Direction; import net.minecraft.util.registry.Registry; import net.minecraft.util.shape.VoxelShape; @@ -38,9 +40,11 @@ import net.minecraft.world.World; import net.minecraft.world.WorldAccess; import ru.betterend.blocks.BlockProperties; import ru.betterend.blocks.BlockProperties.PedestalState; +import ru.betterend.blocks.InfusionPedestal; import ru.betterend.blocks.entities.PedestalBlockEntity; import ru.betterend.patterns.Patterns; import ru.betterend.registry.EndBlocks; +import ru.betterend.rituals.InfusionRitual; import ru.betterend.util.BlocksHelper; public class PedestalBlock extends BlockBaseNotFull implements BlockEntityProvider { @@ -110,6 +114,7 @@ public class PedestalBlock extends BlockBaseNotFull implements BlockEntityProvid ItemStack itemStack = player.getStackInHand(hand); if (itemStack.isEmpty()) return ActionResult.CONSUME; pedestal.setStack(0, itemStack.split(1)); + activate(world, pos, player, hand, hit); return ActionResult.SUCCESS; } else { ItemStack itemStack = pedestal.getStack(0); @@ -123,6 +128,21 @@ public class PedestalBlock extends BlockBaseNotFull implements BlockEntityProvid return ActionResult.PASS; } + private void activate(World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + Mutable mut = new Mutable(); + Point[] points = InfusionRitual.getMap(); + for (Point p: points) { + mut.set(pos).move(p.x, 0, p.y); + BlockState state = world.getBlockState(mut); + if (state.getBlock() instanceof InfusionPedestal) { + ActionResult result = state.getBlock().onUse(state, world, mut, player, null, hit); + if (result == ActionResult.SUCCESS) { + break; + } + } + } + } + @Override @Nullable public BlockState getPlacementState(ItemPlacementContext context) { diff --git a/src/main/java/ru/betterend/rituals/InfusionRitual.java b/src/main/java/ru/betterend/rituals/InfusionRitual.java index 85bb4384..dbe24bd5 100644 --- a/src/main/java/ru/betterend/rituals/InfusionRitual.java +++ b/src/main/java/ru/betterend/rituals/InfusionRitual.java @@ -18,7 +18,7 @@ import ru.betterend.particle.InfusionParticleType; import ru.betterend.recipe.builders.InfusionRecipe; public class InfusionRitual implements Inventory { - private static Point[] pedestalsMap = new Point[] { + private static final Point[] PEDESTALS_MAP = new Point[] { new Point(0, 3), new Point(2, 2), new Point(3, 0), new Point(2, -2), new Point(0, -3), new Point(-2, -2), new Point(-3, 0), new Point(-2, 2) }; @@ -40,6 +40,10 @@ public class InfusionRitual implements Inventory { this.configure(); } + public static Point[] getMap() { + return PEDESTALS_MAP; + } + public void configure() { if (world == null || world.isClient || worldPos == null) return; BlockEntity inputEntity = world.getBlockEntity(worldPos); @@ -47,7 +51,7 @@ public class InfusionRitual implements Inventory { this.input = (InfusionPedestalEntity) inputEntity; } int i = 0; - for(Point point : pedestalsMap) { + for(Point point : PEDESTALS_MAP) { BlockPos.Mutable checkPos = worldPos.mutableCopy().move(Direction.EAST, point.x).move(Direction.NORTH, point.y); BlockEntity catalystEntity = world.getBlockEntity(checkPos); if (catalystEntity instanceof PedestalBlockEntity) { diff --git a/src/main/resources/assets/betterend/materials/glow_green.json b/src/main/resources/assets/betterend/materials/glow_green.json index 382bc183..952f0717 100644 --- a/src/main/resources/assets/betterend/materials/glow_green.json +++ b/src/main/resources/assets/betterend/materials/glow_green.json @@ -2,7 +2,9 @@ "layers": [ { "vertexSource": "canvas:shaders/material/default.vert", - "fragmentSource": "betterend:shaders/material/glow_green.frag" + "fragmentSource": "betterend:shaders/material/glow_green.frag", + "disableAo": true, + "disableDiffuse": true } ] } diff --git a/src/main/resources/assets/betterend/models/block/thallasium_chandelier.json b/src/main/resources/assets/betterend/models/block/thallasium_chandelier.json index cf862ca5..b9e009da 100644 --- a/src/main/resources/assets/betterend/models/block/thallasium_chandelier.json +++ b/src/main/resources/assets/betterend/models/block/thallasium_chandelier.json @@ -9,6 +9,7 @@ "__comment": "Box1", "from": [ 6, 0, 6 ], "to": [ 10, 1, 10 ], + "shade": false, "faces": { "down": { "uv": [ 0, 0, 4, 4 ], "texture": "#texture" }, "up": { "uv": [ 0, 0, 4, 4 ], "texture": "#texture" }, diff --git a/src/main/resources/assets/betterend/models/block/thallasium_chandelier_ceil.json b/src/main/resources/assets/betterend/models/block/thallasium_chandelier_ceil.json index fdd8c61b..91576939 100644 --- a/src/main/resources/assets/betterend/models/block/thallasium_chandelier_ceil.json +++ b/src/main/resources/assets/betterend/models/block/thallasium_chandelier_ceil.json @@ -10,6 +10,7 @@ "__comment": "Box1", "from": [ 6, 15, 6 ], "to": [ 10, 16, 10 ], + "shade": false, "faces": { "down": { "uv": [ 0, 0, 4, 4 ], "texture": "#rod" }, "up": { "uv": [ 0, 0, 4, 4 ], "texture": "#rod" }, diff --git a/src/main/resources/assets/betterend/models/block/thallasium_chandelier_wall.json b/src/main/resources/assets/betterend/models/block/thallasium_chandelier_wall.json index b3a77432..9fb3d09b 100644 --- a/src/main/resources/assets/betterend/models/block/thallasium_chandelier_wall.json +++ b/src/main/resources/assets/betterend/models/block/thallasium_chandelier_wall.json @@ -19,6 +19,7 @@ "__comment": "Box3", "from": [ 7, 3, 0 ], "to": [ 9, 5, 3 ], + "shade": false, "faces": { "down": { "uv": [ 0, 8, 2, 11 ], "texture": "#texture" }, "up": { "uv": [ 0, 11, 2, 8 ], "texture": "#texture" }, @@ -32,6 +33,7 @@ "__comment": "Box4", "from": [ 3, 6, 1 ], "to": [ 5, 9, 3 ], + "shade": false, "faces": { "down": { "uv": [ 0, 12, 2, 14 ], "texture": "#texture" }, "up": { "uv": [ 0, 12, 2, 14 ], "texture": "#texture" }, @@ -45,6 +47,7 @@ "__comment": "Box4", "from": [ 11, 6, 1 ], "to": [ 13, 9, 3 ], + "shade": false, "faces": { "down": { "uv": [ 0, 12, 2, 14 ], "texture": "#texture" }, "up": { "uv": [ 0, 12, 2, 14 ], "texture": "#texture" },