This commit is contained in:
parent
dfe547c34b
commit
014ed2cded
@ -1,5 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
**Beta 0.1.0**
|
||||
* Fix Interaction Bug With Phase Shifter Block
|
||||
|
||||
**Beta 0.0.9**
|
||||
* Fix Interaction Bug With Phase Shifter Block
|
||||
|
||||
|
@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
|
||||
fabric_loader_version = 0.9.0+build.204
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 0.0.9
|
||||
mod_version = 0.1.0
|
||||
maven_group = com.thebrokenrail
|
||||
|
||||
# Dependencies
|
||||
|
@ -69,7 +69,10 @@ public class EnergyTicker {
|
||||
|
||||
allLoaded = Collections.unmodifiableList(started);
|
||||
|
||||
world.getProfiler().visit("shuffle");
|
||||
Collections.shuffle(started, world.random);
|
||||
world.getProfiler().pop();
|
||||
|
||||
for (EnergyTickable tickable : started) {
|
||||
world.getProfiler().push(() -> tickable.getID() + " logicTick");
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.thebrokenrail.energonrelics.block;
|
||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||
import com.thebrokenrail.energonrelics.api.block.energy.EnergyBlock;
|
||||
import com.thebrokenrail.energonrelics.block.entity.shifter.PhaseShifterBlockEntity;
|
||||
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
@ -25,6 +26,7 @@ import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.DyeColor;
|
||||
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.world.World;
|
||||
@ -86,33 +88,40 @@ public class PhaseShifterBlock extends EnergyBlock {
|
||||
if (result != ActionResult.PASS) {
|
||||
return result;
|
||||
} else {
|
||||
ItemStack stack = player.getStackInHand(hand);
|
||||
BlockEntity entity = world.getBlockEntity(pos);
|
||||
|
||||
if (stack.getItem() instanceof DyeItem && player.shouldCancelInteraction()) {
|
||||
DyeColor newColor = ((DyeItem) stack.getItem()).getColor();
|
||||
if (state.get(COLOR) != newColor) {
|
||||
world.setBlockState(pos, state.with(COLOR, newColor));
|
||||
if (!player.isCreative()) {
|
||||
stack.decrement(1);
|
||||
}
|
||||
return ActionResult.SUCCESS;
|
||||
} else {
|
||||
return ActionResult.PASS;
|
||||
if (entity instanceof Inventory) {
|
||||
if (!world.isClient()) {
|
||||
player.openHandledScreen(new SimpleNamedScreenHandlerFactory((i, inv, player2) -> new HopperScreenHandler(i, inv, (Inventory) entity), new TranslatableText("block." + EnergonRelics.NAMESPACE + ".phase_shifter")));
|
||||
}
|
||||
return ActionResult.SUCCESS;
|
||||
} else {
|
||||
if (entity instanceof Inventory) {
|
||||
if (!world.isClient()) {
|
||||
player.openHandledScreen(new SimpleNamedScreenHandlerFactory((i, inv, player2) -> new HopperScreenHandler(i, inv, (Inventory) entity), new TranslatableText("block." + EnergonRelics.NAMESPACE + ".phase_shifter")));
|
||||
}
|
||||
return ActionResult.SUCCESS;
|
||||
} else {
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(Identifier id) {
|
||||
super.register(id);
|
||||
UseBlockCallback.EVENT.register((player, world, hand, hit) -> {
|
||||
if (!player.isSpectator() && player.shouldCancelInteraction()) {
|
||||
BlockState state = world.getBlockState(hit.getBlockPos());
|
||||
ItemStack stack = player.getStackInHand(hand);
|
||||
if (stack.getItem() instanceof DyeItem) {
|
||||
DyeColor newColor = ((DyeItem) stack.getItem()).getColor();
|
||||
if (state.get(PhaseShifterBlock.COLOR) != newColor) {
|
||||
world.setBlockState(hit.getBlockPos(), state.with(PhaseShifterBlock.COLOR, newColor));
|
||||
if (!player.isCreative()) {
|
||||
stack.decrement(1);
|
||||
}
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ActionResult.PASS;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasInventory() {
|
||||
return true;
|
||||
|
@ -53,8 +53,7 @@
|
||||
"east": {"uv": [4, 3, 16, 5], "texture": "#1"},
|
||||
"south": {"uv": [2, 2, 14, 4], "rotation": 180, "texture": "#1"},
|
||||
"west": {"uv": [4, 3, 16, 5], "texture": "#1"},
|
||||
"up": {"uv": [2, 2, 14, 14], "texture": "#1"},
|
||||
"down": {"uv": [0, 0, 12, 12], "texture": "#missing"}
|
||||
"up": {"uv": [2, 2, 14, 14], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -37,9 +37,7 @@
|
||||
"to": [9, 12, 11],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [15, 19, 20]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 2, 1], "texture": "#missing"},
|
||||
"east": {"uv": [1, 7, 2, 13], "rotation": 270, "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 2, 1], "texture": "#missing"},
|
||||
"west": {"uv": [1, 7, 2, 13], "rotation": 270, "texture": "#0"},
|
||||
"up": {"uv": [1, 2, 3, 8], "texture": "#0"},
|
||||
"down": {"uv": [1, 8, 3, 14], "texture": "#0"}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.1 KiB |
Reference in New Issue
Block a user