mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 11:29:23 +01:00
Fixed relay things.
Fixed compass clicking.
This commit is contained in:
parent
cf0349b102
commit
99e166337b
4 changed files with 17 additions and 14 deletions
|
@ -104,7 +104,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
|
|||
BlockEntity tile = world.getBlockEntity(pos);
|
||||
if (tile instanceof TileEntityLaserRelay relay) {
|
||||
|
||||
if (StackUtil.isValid(stack)) {
|
||||
if (!stack.isEmpty()) {
|
||||
if (stack.getItem() instanceof ItemLaserWrench) {
|
||||
return InteractionResult.FAIL;
|
||||
} else if (stack.getItem() == CommonConfig.Other.relayConfigureItem) {
|
||||
|
@ -120,10 +120,10 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
|
|||
relay.sendUpdate();
|
||||
}
|
||||
|
||||
return InteractionResult.PASS;
|
||||
return InteractionResult.SUCCESS;
|
||||
} else if (stack.getItem() instanceof ItemLaserRelayUpgrade) {
|
||||
ItemStack inRelay = relay.inv.getStackInSlot(0);
|
||||
if (!StackUtil.isValid(inRelay)) {
|
||||
if (inRelay.isEmpty()) {
|
||||
if (!world.isClientSide) {
|
||||
if (!player.isCreative()) {
|
||||
player.setItemInHand(hand, StackUtil.shrink(stack, 1));
|
||||
|
@ -141,7 +141,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
|
|||
|
||||
if (player.isShiftKeyDown()) {
|
||||
ItemStack inRelay = relay.inv.getStackInSlot(0).copy();
|
||||
if (StackUtil.isValid(inRelay)) {
|
||||
if (!inRelay.isEmpty()) {
|
||||
if (!world.isClientSide) {
|
||||
relay.inv.setStackInSlot(0, ItemStack.EMPTY);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.event;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.attachments.ActuallyAttachments;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockLaserRelay;
|
||||
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
||||
|
@ -35,6 +36,7 @@ import net.minecraft.world.entity.monster.Spider;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.neoforged.bus.api.Event;
|
||||
|
@ -43,20 +45,21 @@ import net.neoforged.neoforge.event.AnvilUpdateEvent;
|
|||
import net.neoforged.neoforge.event.entity.living.LivingDropsEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.neoforged.neoforge.event.level.BlockEvent;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class CommonEvents {
|
||||
|
||||
//TODO spawner shards are yeeted right?
|
||||
@SubscribeEvent
|
||||
public void onBlockBreakEvent(BlockEvent.BreakEvent event) {
|
||||
BlockState state = event.getState();
|
||||
if (state != null && state.getBlock() == Blocks.SPAWNER) {
|
||||
// TODO: [port] add back once we've unflattened
|
||||
// event.getDrops().add(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.SPAWNER_SHARD.ordinal()));
|
||||
public void onBlockRightClick(PlayerInteractEvent.RightClickBlock event) { //Workaround, cant sneak right click a block with an item normally.
|
||||
if (event.getLevel().isClientSide)
|
||||
return;
|
||||
if( (event.getLevel().getBlockState(event.getHitVec().getBlockPos()).getBlock() instanceof BlockLaserRelay) && (event.getItemStack().is(CommonConfig.Other.relayConfigureItem))) {
|
||||
event.setUseItem(Event.Result.DENY);
|
||||
event.setUseBlock(Event.Result.ALLOW);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
@ -83,8 +83,8 @@ public final class PacketHandler {
|
|||
// Particle fx = new ParticleLaserItem(mc.level, outX, outY, outZ, stack, 0.025, inX, inY, inZ);
|
||||
//mc.effectRenderer.addEffect(fx); //TODO
|
||||
|
||||
mc.level.addParticle(ParticleLaserItem.Factory.createData(stack, outX, outY, outZ),
|
||||
inX, inY, inZ, 0, 0.025, 0);
|
||||
mc.level.addParticle(ParticleLaserItem.Factory.createData(stack, inX, inY, inZ),
|
||||
outX, outY, outZ, 0, 0.025, 0);
|
||||
}
|
||||
};
|
||||
public static final IDataHandler GUI_BUTTON_TO_TILE_HANDLER = (compound, context) -> {
|
||||
|
|
|
@ -170,7 +170,7 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay {
|
|||
|
||||
@Override
|
||||
public void onCompassAction(Player player) {
|
||||
if (player.isShiftKeyDown()) {
|
||||
if (player.isCrouching()) {
|
||||
this.priority--;
|
||||
} else {
|
||||
this.priority++;
|
||||
|
|
Loading…
Reference in a new issue