Force relays now give visual feedback when binding them

This commit is contained in:
Vincent Lee committed 2018-09-14 21:31:33 -05:00
1 parent 80aea6f7be
commit f7e9b4cb99
2 files changed
+17 -2

No files matched your search

@@ -54,6 +54,8 @@ import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.network.PacketBotaniaEffect;
import vazkii.botania.common.network.PacketHandler;
import javax.annotation.Nonnull;
import java.awt.Color;
@@ -169,7 +171,7 @@ public class ItemTwigWand extends Item16Colors implements ICoordBoundItem {
return wanded ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
}
if(((BlockPistonRelay) ModBlocks.pistonRelay).playerPositions.containsKey(player.getUniqueID()) && !world.isRemote) {
if(!world.isRemote && ((BlockPistonRelay) ModBlocks.pistonRelay).playerPositions.containsKey(player.getUniqueID())) {
BlockPistonRelay.DimWithPos bindPos = ((BlockPistonRelay) ModBlocks.pistonRelay).playerPositions.get(player.getUniqueID());
BlockPistonRelay.DimWithPos currentPos = new BlockPistonRelay.DimWithPos(world.provider.getDimension(), pos);
@@ -177,6 +179,10 @@ public class ItemTwigWand extends Item16Colors implements ICoordBoundItem {
((BlockPistonRelay) ModBlocks.pistonRelay).mappedPositions.put(bindPos, currentPos);
BlockPistonRelay.WorldData.get(world).markDirty();
PacketHandler.sendToNearby(world, pos,
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.PARTICLE_BEAM,
bindPos.blockPos.getX() + 0.5, bindPos.blockPos.getY() + 0.5, bindPos.blockPos.getZ() + 0.5,
pos.getX(), pos.getY(), pos.getZ()));
world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.ding, SoundCategory.PLAYERS, 1F, 1F);
return EnumActionResult.SUCCESS;
}
@@ -18,6 +18,7 @@ import vazkii.botania.common.block.tile.TileTerraPlate;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.entity.EntityDoppleganger;
import vazkii.botania.common.item.ItemTwigWand;
import java.awt.Color;
@@ -247,6 +248,12 @@ public class PacketBotaniaEffect implements IMessage {
}
break;
}
case PARTICLE_BEAM: {
ItemTwigWand.doParticleBeam(Minecraft.getMinecraft().world,
new Vector3(message.x, message.y, message.z),
new Vector3(message.args[0] + 0.5, message.args[1] + 0.5, message.args[2] + 0.5));
break;
}
}
}
});
@@ -264,7 +271,9 @@ public class PacketBotaniaEffect implements IMessage {
ENCHANTER_DESTROY(0),
BLACK_LOTUS_DISSOLVE(0),
TERRA_PLATE(0),
FLUGEL_EFFECT(1); // Arg: Entity ID
FLUGEL_EFFECT(1), // Arg: Entity ID
PARTICLE_BEAM(3), // Args: dest xyz
;
private final int argCount;