Dispenser Wand Functionality for Sneak-Right Clicking. (#3165)

* Update TilePool.java

* Break Force Relay with dispenser.

Why not?

* Hopperhock cycle filter type with dispenser.

This could lead to new functionality and could certainly not break anything.

* Reverse or change turntable speed with wand.

Reverse if in function mode, or cycle speed if in bind mode.

* Look who missed a parenthesis.

* Fix crash.

* Lexicon Additions

Since these actions normally require sneaking, it may be ambiguous whether a dispenser can perform it.

* Fix typo in Spreader Turntable entry.

* Side distinction rather than mode distinction for turntable.
This commit is contained in:
Eutro authored and GitHub committed 2020-02-25 12:42:32 -06:00
1 parent d365273ead
commit 6f02a65c60
7 files changed
+23 -23

No files matched your search

@@ -117,10 +117,13 @@ public class BlockPistonRelay extends BlockMod implements IWandable {
@Override
public boolean onUsedByWand(PlayerEntity player, ItemStack stack, World world, BlockPos pos, Direction side) {
if(player == null || world.isRemote)
if(world.isRemote)
return false;
if(!player.isSneaking()) {
if(player == null || player.isSneaking()) {
spawnAsEntity(world, pos, new ItemStack(this));
world.destroyBlock(pos, false);
} else {
GlobalPos clicked = GlobalPos.of(world.getDimension().getType(), pos.toImmutable());
if(ItemTwigWand.getBindMode(stack)) {
activeBindingAttempts.put(player.getUniqueID(), clicked);
@@ -134,9 +137,6 @@ public class BlockPistonRelay extends BlockMod implements IWandable {
dest.getPos().getX(), dest.getPos().getY(), dest.getPos().getZ()));
}
}
} else {
spawnAsEntity(world, pos, new ItemStack(this));
world.destroyBlock(pos, false);
}
return true;
@@ -53,7 +53,7 @@ public class BlockTurntable extends BlockMod implements IWandable, IWandHUD {
@Override
public boolean onUsedByWand(PlayerEntity player, ItemStack stack, World world, BlockPos pos, Direction side) {
((TileTurntable) world.getTileEntity(pos)).onWanded(player, stack);
((TileTurntable) world.getTileEntity(pos)).onWanded(player, stack, side);
return true;
}
@@ -198,10 +198,7 @@ public class SubTileHopperhock extends TileEntityFunctionalFlower {
@Override
public boolean onWanded(PlayerEntity player, ItemStack wand) {
if(player == null)
return false;
if(player.isSneaking()) {
if(player == null || player.isSneaking()) {
filterType = filterType == 2 ? 0 : filterType + 1;
sync();
@@ -372,10 +372,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
}
public void onWanded(PlayerEntity player, ItemStack wand) {
if(player == null)
return;
if(player.isSneaking()) {
if(player == null || player.isSneaking()) {
outputting = !outputting;
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);
}
@@ -388,7 +385,11 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
((ServerPlayerEntity) player).connection.sendPacket(new SUpdateTileEntityPacket(pos, -999, nbttagcompound));
}
world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.ding, SoundCategory.PLAYERS, 0.11F, 1F);
if(player == null) {
world.playSound(null, getPos(), ModSounds.ding, SoundCategory.PLAYERS, 0.11F, 1F);
} else {
world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.ding, SoundCategory.PLAYERS, 0.11F, 1F);
}
}
@OnlyIn(Dist.CLIENT)
@@ -77,11 +77,8 @@ public class TileTurntable extends TileMod implements ITickableTileEntity {
backwards = cmp.getBoolean(TAG_BACKWARDS);
}
public void onWanded(PlayerEntity player, ItemStack wand) {
if(player == null)
return;
if(player.isSneaking())
public void onWanded(PlayerEntity player, ItemStack wand, Direction side) {
if((player != null && player.isSneaking()) || (player == null && side == Direction.DOWN))
backwards = !backwards;
else speed = speed == 6 ? 1 : speed + 1;
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);