Java Code Examples for net.minecraft.init.Items.FURNACE_MINECART
The following are Jave code examples for showing how to use
FURNACE_MINECART of the
net.minecraft.init.Items
class.
You can vote up the examples you like. Your votes will be used in our system to get
more good examples.
+ Save this method
Example 1
Project: CustomWorldGen File: EntityMinecart.java View Source Code | 6 votes |
/** * This function returns an ItemStack that represents this cart. * This should be an ItemStack that can be used by the player to place the cart, * but is not necessary the item the cart drops when destroyed. * @return An ItemStack that can be used to place the cart. */ public ItemStack getCartItem() { if (this instanceof EntityMinecartFurnace) { return new ItemStack(Items.FURNACE_MINECART); } else if (this instanceof EntityMinecartChest) { return new ItemStack(Items.CHEST_MINECART); } else if (this instanceof EntityMinecartTNT) { return new ItemStack(Items.TNT_MINECART); } else if (this instanceof EntityMinecartHopper) { return new ItemStack(Items.HOPPER_MINECART); } else if (this instanceof EntityMinecartCommandBlock) { return new ItemStack(Items.COMMAND_BLOCK_MINECART); } return new ItemStack(Items.MINECART); }
Example 2
Project: pnc-repressurized File: TileEntityAirCannon.java View Source Code | 4 votes |
private void updateDestination() { doneTurning = false; // take dispenser upgrade in account double payloadFrictionY = 0.98D; // this value will differ when a dispenser upgrade is inserted. double payloadFrictionX = 0.98D; double payloadGravity = 0.04D; if (getUpgrades(EnumUpgrade.ENTITY_TRACKER) > 0) { payloadFrictionY = 0.98D; payloadFrictionX = 0.91D; payloadGravity = 0.08D; } else if (getUpgrades(EnumUpgrade.DISPENSER) > 0 && !inventory.getStackInSlot(CANNON_SLOT).isEmpty()) { Item item = inventory.getStackInSlot(CANNON_SLOT).getItem(); if (item == Items.POTIONITEM || item == Items.EXPERIENCE_BOTTLE || item == Items.EGG || item == Items.SNOWBALL) {// EntityThrowable payloadFrictionY = 0.99D; payloadGravity = 0.03D; } else if (item == Items.ARROW) { payloadFrictionY = 0.99D; payloadGravity = 0.05D; } else if (item == Items.MINECART || item == Items.CHEST_MINECART || item == Items.HOPPER_MINECART || item == Items.TNT_MINECART || item == Items.FURNACE_MINECART) { payloadFrictionY = 0.95D; } // else if(itemID == Item.fireballCharge.itemID){ // payloadGravity = 0.0D; // } // family items (throwable) which only differ in gravity. if (item == Items.POTIONITEM) { payloadGravity = 0.05D; } else if (item == Items.EXPERIENCE_BOTTLE) { payloadGravity = 0.07D; } payloadFrictionX = payloadFrictionY; // items which have different frictions for each axis. if (item == Items.BOAT) { payloadFrictionX = 0.99D; payloadFrictionY = 0.95D; } if (item == Items.SPAWN_EGG) { payloadFrictionY = 0.98D; payloadFrictionX = 0.91D; payloadGravity = 0.08D; } } // calculate the heading. double deltaX = gpsX - getPos().getX(); double deltaZ = gpsZ - getPos().getZ(); float calculatedRotationAngle; if (deltaX >= 0 && deltaZ < 0) { calculatedRotationAngle = (float) (Math.atan(Math.abs(deltaX / deltaZ)) / Math.PI * 180D); } else if (deltaX >= 0 && deltaZ >= 0) { calculatedRotationAngle = (float) (Math.atan(Math.abs(deltaZ / deltaX)) / Math.PI * 180D) + 90; } else if (deltaX < 0 && deltaZ >= 0) { calculatedRotationAngle = (float) (Math.atan(Math.abs(deltaX / deltaZ)) / Math.PI * 180D) + 180; } else { calculatedRotationAngle = (float) (Math.atan(Math.abs(deltaZ / deltaX)) / Math.PI * 180D) + 270; } // calculate the height angle. double distance = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ); double deltaY = gpsY - getPos().getY(); float calculatedHeightAngle = calculateBestHeightAngle(distance, deltaY, getForce(), payloadGravity, payloadFrictionX, payloadFrictionY); setTargetAngles(calculatedRotationAngle, calculatedHeightAngle); }