@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; }
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_); } }
@SubscribeEvent public void onEntityJoinWorld(EntityJoinWorldEvent e) { //Replace Minecart with Furnace with Minecart with Kiln if(BBConfig.moduleFurnaces && e.getEntity().getClass() == EntityMinecartFurnace.class && ((EntityMinecartFurnace) e.getEntity()).getDisplayTile() == Blocks.FURNACE.getDefaultState()) { if(!e.getWorld().isRemote) { e.getEntity().setDead(); EntityMinecartKiln kilnCart = new EntityMinecartKiln(e.getWorld(), e.getEntity().posX, e.getEntity().posY, e.getEntity().posZ); e.getWorld().spawnEntity(kilnCart); } } }
@Override public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if(!world.isRemote) { EntityMinecartFurnace kilnCart = new EntityMinecartFurnace(world, pos.getX(), pos.getY() + 1.0F, pos.getZ()); kilnCart.setDisplayTile(RegisterBlocks.kiln.getDefaultState()); kilnCart.setEntityBoundingBox(kilnCart.getEntityBoundingBox().offset(0.0F, 2.0F, 0.0F)); world.spawnEntity(kilnCart); } return EnumActionResult.SUCCESS; }
@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); }
@SubscribeEvent public void onMinecartEvent(MinecartInteractEvent ev){ if(!Properties.enableMinecartTweaks)return; //ignore if turned off EntityMinecart cart=ev.minecart; if(cart instanceof EntityMinecartFurnace){ EntityPlayer player=ev.player; if(player.isSneaking()){ //invert motion if player is sneaking - allows making furnace cart come EntityMinecartFurnace fc=(EntityMinecartFurnace) cart; fc.pushX = -(fc.posX - player.posX); fc.pushZ = -(fc.posZ - player.posZ); ev.setCanceled(true); //stop normal handling - we took care of it } } }
@Override public void onRender() { if(isEnabled()) { for (Object o : Wrapper.getWorld().loadedTileEntityList) { if (o instanceof TileEntityChest) { TileEntityChest chest = (TileEntityChest) o; this.drawChestESP(chest, chest.getPos().getX(), chest.getPos().getY(), chest.getPos().getZ()); } if (o instanceof TileEntityEnderChest) { TileEntityEnderChest enderChest = (TileEntityEnderChest) o; this.drawEnderChestESP(enderChest, enderChest.getPos().getX(), enderChest.getPos().getY(), enderChest.getPos().getZ()); } if (o instanceof TileEntityFurnace) { TileEntityFurnace furnace = (TileEntityFurnace) o; RenderUtils.blockESP(furnace.getPos(), Color.white, 1.0, 1.0); } if (o instanceof TileEntityDispenser) { TileEntityDispenser dispenser = (TileEntityDispenser) o; RenderUtils.blockESP(dispenser.getPos(), Color.white, 1.0, 1.0); } if (o instanceof TileEntityDropper) { TileEntityDropper dropper = (TileEntityDropper) o; RenderUtils.blockESP(dropper.getPos(), Color.white, 1.0, 1.0); } if (o instanceof TileEntityHopper) { TileEntityHopper hopper = (TileEntityHopper) o; RenderUtils.blockESP(hopper.getPos(), Color.white, 1.0, 1.0); } if (o instanceof TileEntityShulkerBox) { TileEntityShulkerBox shulker = (TileEntityShulkerBox) o; RenderUtils.blockESP(shulker.getPos(), Color.yellow, 1.0, 1.0); } } for (Entity e: Wrapper.getWorld().loadedEntityList) { if (e instanceof EntityMinecartChest) { RenderUtils.blockESP(e.getPosition(), Color.green, 1.0, 1.0); } if (e instanceof EntityMinecartFurnace || e instanceof EntityMinecartHopper) { RenderUtils.blockESP(e.getPosition(), Color.white, 1.0, 1.0); } } } }
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; }
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()); } }
public PoweredMinecart() { super(new EntityMinecartFurnace(null)); }
protected PoweredMinecart(EntityMinecartFurnace entityMC) { super(entityMC); }
/** 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 PoweredMinecart fromMC(EntityMinecartFurnace entityMC) { return new PoweredMinecart(entityMC); }