use of mods.railcraft.api.core.items.IToolCrowbar in project Railcraft by Railcraft.
the class TrackKitRouting method blockActivated.
@Override
public boolean blockActivated(EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem) {
if (!InvTools.isEmpty(heldItem) && heldItem.getItem() instanceof IToolCrowbar) {
IToolCrowbar crowbar = (IToolCrowbar) heldItem.getItem();
if (crowbar.canWhack(player, hand, heldItem, getPos())) {
GuiHandler.openGui(EnumGui.TRACK_ROUTING, player, theWorldAsserted(), getPos().getX(), getPos().getY(), getPos().getZ());
crowbar.onWhack(player, hand, heldItem, getPos());
return true;
}
}
return false;
}
use of mods.railcraft.api.core.items.IToolCrowbar in project Trains-In-Motion-1.7.10 by EternalBlueFlame.
the class TrackInstanceBase method blockActivated.
@Override
public boolean blockActivated(EntityPlayer player) {
if (this instanceof ITrackReversable) {
ItemStack current = player.getCurrentEquippedItem();
if (current != null && current.getItem() instanceof IToolCrowbar) {
IToolCrowbar crowbar = (IToolCrowbar) current.getItem();
if (crowbar.canWhack(player, current, getX(), getY(), getZ())) {
ITrackReversable track = (ITrackReversable) this;
track.setReversed(!track.isReversed());
markBlockNeedsUpdate();
crowbar.onWhack(player, current, getX(), getY(), getZ());
return true;
}
}
}
return false;
}
use of mods.railcraft.api.core.items.IToolCrowbar in project Railcraft by Railcraft.
the class TrackKitLocking method blockActivated.
@Override
public boolean blockActivated(EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem) {
if (!InvTools.isEmpty(heldItem) && heldItem.getItem() instanceof IToolCrowbar) {
IToolCrowbar crowbar = (IToolCrowbar) heldItem.getItem();
if (crowbar.canWhack(player, hand, heldItem, getPos())) {
LockingProfileType p;
if (player.isSneaking())
p = profile.previous();
else
p = profile.next();
crowbar.onWhack(player, hand, heldItem, getPos());
if (Game.isHost(theWorldAsserted()))
setProfile(p);
else
ChatPlugin.sendLocalizedChat(player, "gui.railcraft.track.mode.change", "ยง5" + LocalizationPlugin.translate("gui.railcraft.track.locking.mode." + p.tag));
return true;
}
}
return false;
}
use of mods.railcraft.api.core.items.IToolCrowbar in project Railcraft by Railcraft.
the class TrackKitEmbarking method onMinecartPass.
@Override
public void onMinecartPass(EntityMinecart cart) {
if (isPowered() && cart.canBeRidden() && !cart.isBeingRidden() && cart.getEntityData().getInteger("MountPrevention") <= 0) {
int a = area;
AxisAlignedBB box = AABBFactory.start().createBoxForTileAt(getPos()).build();
box = box.expand(a, a, a);
List<EntityLivingBase> entities = theWorldAsserted().getEntitiesWithinAABB(EntityLivingBase.class, box);
if (entities.size() > 0) {
EntityLivingBase entity = entities.get(MiscTools.RANDOM.nextInt(entities.size()));
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
if (player.isSneaking()) {
return;
}
ItemStack current = player.getActiveItemStack();
if (!InvTools.isEmpty(current) && current.getItem() instanceof IToolCrowbar) {
return;
}
} else if (excludedEntities.contains(entity.getClass())) {
return;
} else if (entity instanceof EntitySlime) {
EntitySlime slime = (EntitySlime) entity;
if (slime.getSlimeSize() >= 100)
return;
}
if (!entity.isRiding()) {
EffectManager.instance.teleportEffect(entity, cart.getPositionVector());
CartTools.addPassenger(cart, entity);
}
}
}
}
use of mods.railcraft.api.core.items.IToolCrowbar in project Railcraft by Railcraft.
the class TrackKitEmbarking method blockActivated.
@Override
public boolean blockActivated(EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem) {
if (!InvTools.isEmpty(heldItem) && heldItem.getItem() instanceof IToolCrowbar) {
IToolCrowbar crowbar = (IToolCrowbar) heldItem.getItem();
GuiHandler.openGui(EnumGui.TRACK_EMBARKING, player, theWorldAsserted(), getPos().getX(), getPos().getY(), getPos().getZ());
crowbar.onWhack(player, hand, heldItem, getPos());
return true;
}
return false;
}
Aggregations