本文整理汇总了Java中net.minecraft.init.Items.HOPPER_MINECART属性的典型用法代码示例。如果您正苦于以下问题:Java Items.HOPPER_MINECART属性的具体用法?Java Items.HOPPER_MINECART怎么用?Java Items.HOPPER_MINECART使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.init.Items
的用法示例。
在下文中一共展示了Items.HOPPER_MINECART属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCartItem
/**
* 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);
}
示例2: updateDestination
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);
}