Java 类net.minecraft.entity.item.EntityMinecartEmpty 实例源码

项目:PeripheralsPlusPlus    文件:TileRailReader.java   
@Override
public Map<Object, Object> getMinecartData(EntityMinecart cart) {
    Map<Object, Object> ret = new HashMap<Object, Object>();

    if (cart.getClass() == EntityMinecartEmpty.class) {
        ret.put("__CART_TYPE__", "basic");
        ret.put("occupied", cart.riddenByEntity != null);
        if (cart.riddenByEntity != null) ret.put("username", cart.riddenByEntity.getEntityName());
    } else if (cart.getClass() == EntityMinecartChest.class) {
        ret.put("__CART_TYPE__", "storage");
    } else if (cart.getClass() == EntityMinecartFurnace.class) {
        ret.put("__CART_TYPE__", "furnace");
        NBTTagCompound workaround = new NBTTagCompound();
        cart.writeToNBT(workaround);
        ret.put("fuel", workaround.getInteger("Fuel"));
    } else if (cart.getClass() == EntityMinecartHopper.class) {
        ret.put("__CART_TYPE__", "hopper");
    } else if (cart.getClass() == EntityMinecartTNT.class) {
        ret.put("__CART_TYPE__", "tnt");
    } else if (cart.getClass() == EntityMinecartMobSpawner.class) {
        ret.put("__CART_TYPE__", "spawner");
    }

    return ret.containsKey("__CART_TYPE__") ? ret : null;
}
项目:RuneCraftery    文件:EntityMinecart.java   
public static EntityMinecart func_94090_a(World p_94090_0_, double p_94090_1_, double p_94090_3_, double p_94090_5_, int p_94090_7_) {
   switch(p_94090_7_) {
   case 1:
      return new EntityMinecartChest(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_);
   case 2:
      return new EntityMinecartFurnace(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_);
   case 3:
      return new EntityMinecartTNT(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_);
   case 4:
      return new EntityMinecartMobSpawner(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_);
   case 5:
      return new EntityMinecartHopper(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_);
   default:
      return new EntityMinecartEmpty(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_);
   }
}
项目:CrystalMod    文件:ItemMinecartRender.java   
@Override
public void render(ItemStack stack) {
    String id = "empty";
    Class<? extends EntityMinecart> clazz = EntityMinecartEmpty.class;

    if(stack.getItem() == Items.CHEST_MINECART){
        id = "chest";
        clazz = EntityMinecartChest.class;
    }

    if(stack.getItem() == Items.FURNACE_MINECART){
        id = "furnace";
        clazz = EntityMinecartFurnace.class;
    }

    if(stack.getItem() == Items.TNT_MINECART){
        id = "tnt";
        clazz = EntityMinecartTNT.class;
    }

    if(stack.getItem() == Items.HOPPER_MINECART){
        id = "hopper";
        clazz = EntityMinecartHopper.class;
    }

    if(stack.getItem() == Items.COMMAND_BLOCK_MINECART){
        id = "commandblock";
        clazz = EntityMinecartCommandBlock.class;
    }

    EntityMinecart minecart = getMinecart(id, clazz);
    if(minecart == null){
        return;
    }
    renderMinecart(minecart, lastTransform, true);
}
项目:CustomWorldGen    文件:DataFixesManager.java   
public static DataFixer createFixer()
{
    DataFixer datafixer = new DataFixer(512);
    WorldInfo.registerFixes(datafixer);
    EntityPlayer.registerFixesPlayer(datafixer);
    AnvilChunkLoader.registerFixes(datafixer);
    ItemStack.registerFixes(datafixer);
    EntityArmorStand.registerFixesArmorStand(datafixer);
    EntityArrow.registerFixesArrow(datafixer);
    EntityBat.registerFixesBat(datafixer);
    EntityBlaze.registerFixesBlaze(datafixer);
    EntityCaveSpider.registerFixesCaveSpider(datafixer);
    EntityChicken.registerFixesChicken(datafixer);
    EntityCow.registerFixesCow(datafixer);
    EntityCreeper.registerFixesCreeper(datafixer);
    EntityDragonFireball.registerFixesDragonFireball(datafixer);
    EntityDragon.registerFixesDragon(datafixer);
    EntityEnderman.registerFixesEnderman(datafixer);
    EntityEndermite.registerFixesEndermite(datafixer);
    EntityFallingBlock.registerFixesFallingBlock(datafixer);
    EntityLargeFireball.registerFixesLargeFireball(datafixer);
    EntityFireworkRocket.registerFixesFireworkRocket(datafixer);
    EntityGhast.registerFixesGhast(datafixer);
    EntityGiantZombie.registerFixesGiantZombie(datafixer);
    EntityGuardian.registerFixesGuardian(datafixer);
    EntityHorse.registerFixesHorse(datafixer);
    EntityItem.registerFixesItem(datafixer);
    EntityItemFrame.registerFixesItemFrame(datafixer);
    EntityMagmaCube.registerFixesMagmaCube(datafixer);
    EntityMinecartChest.registerFixesMinecartChest(datafixer);
    EntityMinecartCommandBlock.registerFixesMinecartCommand(datafixer);
    EntityMinecartFurnace.registerFixesMinecartFurnace(datafixer);
    EntityMinecartHopper.registerFixesMinecartHopper(datafixer);
    EntityMinecartEmpty.registerFixesMinecartEmpty(datafixer);
    EntityMinecartMobSpawner.registerFixesMinecartMobSpawner(datafixer);
    EntityMinecartTNT.registerFixesMinecartTNT(datafixer);
    EntityLiving.registerFixesMob(datafixer);
    EntityMob.registerFixesMonster(datafixer);
    EntityMooshroom.registerFixesMooshroom(datafixer);
    EntityOcelot.registerFixesOcelot(datafixer);
    EntityPig.registerFixesPig(datafixer);
    EntityPigZombie.registerFixesPigZombie(datafixer);
    EntityRabbit.registerFixesRabbit(datafixer);
    EntitySheep.registerFixesSheep(datafixer);
    EntityShulker.registerFixesShulker(datafixer);
    EntitySilverfish.registerFixesSilverfish(datafixer);
    EntitySkeleton.registerFixesSkeleton(datafixer);
    EntitySlime.registerFixesSlime(datafixer);
    EntitySmallFireball.registerFixesSmallFireball(datafixer);
    EntitySnowman.registerFixesSnowman(datafixer);
    EntitySnowball.registerFixesSnowball(datafixer);
    EntitySpectralArrow.registerFixesSpectralArrow(datafixer);
    EntitySpider.registerFixesSpider(datafixer);
    EntitySquid.registerFixesSquid(datafixer);
    EntityEgg.registerFixesEgg(datafixer);
    EntityEnderPearl.registerFixesEnderPearl(datafixer);
    EntityExpBottle.registerFixesExpBottle(datafixer);
    EntityPotion.registerFixesPotion(datafixer);
    EntityTippedArrow.registerFixesTippedArrow(datafixer);
    EntityVillager.registerFixesVillager(datafixer);
    EntityIronGolem.registerFixesIronGolem(datafixer);
    EntityWitch.registerFixesWitch(datafixer);
    EntityWither.registerFixesWither(datafixer);
    EntityWitherSkull.registerFixesWitherSkull(datafixer);
    EntityWolf.registerFixesWolf(datafixer);
    EntityZombie.registerFixesZombie(datafixer);
    TileEntityPiston.registerFixesPiston(datafixer);
    TileEntityFlowerPot.registerFixesFlowerPot(datafixer);
    TileEntityFurnace.registerFixesFurnace(datafixer);
    TileEntityChest.registerFixesChest(datafixer);
    TileEntityDispenser.registerFixes(datafixer);
    TileEntityDropper.registerFixesDropper(datafixer);
    TileEntityBrewingStand.registerFixesBrewingStand(datafixer);
    TileEntityHopper.registerFixesHopper(datafixer);
    BlockJukebox.registerFixesJukebox(datafixer);
    TileEntityMobSpawner.registerFixesMobSpawner(datafixer);
    registerFixes(datafixer);
    return datafixer;
}
项目:CrystalMod    文件:ClientEventHandler.java   
public void collectEntityData(List<String> lines, RayTraceResult ray, Entity entity){
    String nameLine = entity.getDisplayName().getFormattedText() + " (#"+entity.getEntityId()+")";
lines.add(nameLine);        

    boolean handledRider = false;
if(entity instanceof EntityItemFrame){
    EntityItemFrame frame = (EntityItemFrame)entity;
    ItemStack item = frame.getDisplayedItem();
    if(ItemStackTools.isEmpty(item)){
        lines.add("Item: "+Lang.localize("gui.empty"));
    } else {
        lines.add("Item: "+item.getDisplayName());
    }
}

    if(entity instanceof EntityLivingBase){
    EntityLivingBase living = (EntityLivingBase)entity;
    String health = "Health: "+(living.getHealth()+" / "+ living.getMaxHealth());
    lines.add(health);
}

    if(entity instanceof EntityBoat){
        EntityBoat boat = (EntityBoat)entity;

        if(boat.getControllingPassenger() !=null){
            lines.add("Driver: "+boat.getControllingPassenger().getDisplayName().getFormattedText());
        } else {
            lines.add("Driver: "+Lang.localize("gui.empty"));
        }

        if(!boat.getPassengers().isEmpty() && boat.getPassengers().size() > 1 && boat.getPassengers().get(1) !=null){
            lines.add("Passenger: "+boat.getPassengers().get(1).getDisplayName().getFormattedText());
        } else {
            lines.add("Passenger: "+Lang.localize("gui.empty"));
        }
        handledRider = true;
    }

    if(entity instanceof EntityMinecart){
        EntityMinecart cart = (EntityMinecart)entity;

        if(cart instanceof EntityMinecartEmpty){
        if(cart.getControllingPassenger() !=null){
            lines.add("Rider: "+cart.getControllingPassenger().getDisplayName().getFormattedText());
        } else {
            lines.add("Rider: "+Lang.localize("gui.empty"));
        }
        }
        if(cart instanceof EntityMinecartFurnace){
            EntityMinecartFurnace furnace = (EntityMinecartFurnace)cart;
            int fuel = ObfuscationReflectionHelper.getPrivateValue(EntityMinecartFurnace.class, furnace, 1);
        lines.add("Fuel: "+TimeUtil.getTimeFromTicks(fuel));
        }
        handledRider = true;
    }

    if(entity instanceof IEntityOwnable){
        IEntityOwnable ownable = (IEntityOwnable)entity;
        UUID owner = ownable.getOwnerId();
        if(owner !=null){
            String name = ProfileUtil.getUsername(owner);
            if(name != ProfileUtil.ERROR){
                lines.add("Owner: "+name);
            }
        }
    }

    if(!handledRider && entity.getControllingPassenger() !=null){
        lines.add("Rider: "+entity.getControllingPassenger().getDisplayName().getFormattedText());
    }
  }
项目:Corundum    文件:PassengerMinecart.java   
public PassengerMinecart() {
    super(new EntityMinecartEmpty(null));
}
项目:Corundum    文件:PassengerMinecart.java   
protected PassengerMinecart(EntityMinecartEmpty entityMC) {
    super(entityMC);
}
项目:Corundum    文件:PassengerMinecart.java   
/** This method is used to create a new instance of {@link Entity Corundum Entity} to wrap around the given {@link Minecraft net.minecraft.entity.Entity}.
 * 
 * @param entityMC
 *            is the Minecraft Entity that will wrapped with a new {@link Entity Corundum Entity} <tt>Object</tt>.
 * @return a new Entity created using the given {@link net.minecraft.entity.Entity Minecraft Entity}. */
@Override
public PassengerMinecart fromMC(EntityMinecartEmpty entityMC) {
    return new PassengerMinecart(entityMC);
}