use of com.bluepowermod.part.BPPart in project BluePower by Qmunity.
the class ItemPart method addInformation.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List list, boolean unused) {
BPPart part = PartManager.getExample(item);
if (part == null)
return;
List<String> l = new ArrayList<String>();
part.addTooltip(item, l);
list.addAll(l);
}
use of com.bluepowermod.part.BPPart in project BluePower by Qmunity.
the class ItemPart method canGoInCopySlot.
@Override
public boolean canGoInCopySlot(ItemStack stack) {
BPPart part = info.create();
BPApi.getInstance().loadSilkySettings(part, stack);
return part.canGoInCopySlot(stack);
}
use of com.bluepowermod.part.BPPart in project BluePower by Qmunity.
the class PneumaticTube method onActivated.
/**
* Event called when the part is activated (right clicked)
*
* @param player
* Player that right clicked the part
* @param item
* Item that was used to click it
* @return Whether or not an action occurred
*/
@Override
public boolean onActivated(EntityPlayer player, QMovingObjectPosition mop, ItemStack item) {
if (getWorld() == null)
return false;
if (item != null) {
TubeColor newColor = null;
if (item.getItem() == BPItems.paint_brush && ((ItemDamageableColorableOverlay) BPItems.paint_brush).tryUseItem(item)) {
newColor = TubeColor.values()[item.getItemDamage()];
} else if (item.getItem() == Items.water_bucket || (item.getItem() == BPItems.paint_brush && item.getItemDamage() == 16)) {
newColor = TubeColor.NONE;
}
if (newColor != null) {
if (!getWorld().isRemote) {
List<Vec3dCube> boxes = getTubeBoxes();
Vec3dCube box = mop.getCube();
int face = -1;
if (box.equals(boxes.get(0))) {
face = mop.sideHit;
} else {
face = getSideFromAABBIndex(boxes.indexOf(box));
}
color[face] = newColor;
updateConnections();
getLogic().clearNodeCaches();
notifyUpdate();
}
return true;
}
if (item.getItem() instanceof ItemPart) {
BPPart part = PartManager.getExample(item);
if (redwireType == null && part instanceof PartRedwireFaceUninsulated) {
if (!getWorld().isRemote) {
redwireType = ((IRedwire) part).getRedwireType(ForgeDirection.UNKNOWN);
if (!player.capabilities.isCreativeMode)
item.stackSize--;
// Redstone update
getRedstoneConnectionCache().recalculateConnections();
RedstoneApi.getInstance().getRedstonePropagator(this, ForgeDirection.DOWN).propagate();
updateConnections();
getLogic().clearNodeCaches();
notifyUpdate();
sendUpdatePacket();
}
return true;
}
}
// Removing redwire
if (redwireType != null && item.getItem() instanceof IScrewdriver && player.isSneaking()) {
if (!getWorld().isRemote) {
IOHelper.spawnItemInWorld(getWorld(), PartManager.getPartInfo("wire." + redwireType.getName()).getStack(), getX() + 0.5, getY() + 0.5, getZ() + 0.5);
redwireType = null;
// Redstone update
getRedstoneConnectionCache().recalculateConnections();
RedstoneApi.getInstance().getRedstonePropagator(this, ForgeDirection.DOWN).propagate();
((IScrewdriver) item.getItem()).damage(item, 1, player, false);
updateConnections();
getLogic().clearNodeCaches();
notifyUpdate();
sendUpdatePacket();
}
return true;
}
}
return false;
}
use of com.bluepowermod.part.BPPart in project BluePower by Qmunity.
the class RenderPartItem method render.
private void render(float x, float y, float z, float scale, ItemRenderType type, ItemStack item, Object... data) {
boolean blend = GL11.glGetBoolean(GL11.GL_BLEND);
boolean alpha = GL11.glGetBoolean(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glPushMatrix();
GL11.glScalef(scale, scale, scale);
GL11.glTranslatef(x, y, z);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
try {
BPPart part = PartManager.getExample(item);
part.renderItem(type, item, data);
} catch (Exception ex) {
}
GL11.glPopMatrix();
if (!blend)
GL11.glDisable(GL11.GL_BLEND);
if (!alpha)
GL11.glDisable(GL11.GL_ALPHA_TEST);
}
use of com.bluepowermod.part.BPPart in project BluePower by Qmunity.
the class ItemPart method getItemsOnStack.
@Override
public List<ItemStack> getItemsOnStack(ItemStack stack) {
BPPart part = info.create();
BPApi.getInstance().loadSilkySettings(part, stack);
return part.getItemsOnStack(stack);
}
Aggregations