Commits
md_5 authored ff84af45d0e
1 - | From 701131eeaff795c9a7745ee77f668266db96b9f8 Mon Sep 17 00:00:00 2001 |
1 + | From c5edb4cba018e8f72b3bd270afffbceeb3710b1b Mon Sep 17 00:00:00 2001 |
2 2 | From: md_5 <md_5@live.com.au> |
3 3 | Date: Sun, 1 Dec 2013 15:10:48 +1100 |
4 4 | Subject: [PATCH] mc-dev imports |
5 5 | |
6 6 | Imported files which are only modified by Spigot, not upstream. Files here should be completely unmodified aside from trivial changes such as adding throws statements to ensure proper compilation. You may need to add unrelated files in order to ensure a compilable result in the face of synthetic methods. |
7 7 | |
8 8 | diff --git a/src/main/java/net/minecraft/server/AttributeRanged.java b/src/main/java/net/minecraft/server/AttributeRanged.java |
9 9 | new file mode 100644 |
10 10 | index 0000000..130597c |
11 11 | --- /dev/null |
493 493 | + BlockPosition blockposition3 = blockposition.up(); |
494 494 | + boolean flag3 = world.isBlockIndirectlyPowered(blockposition) || world.isBlockIndirectlyPowered(blockposition3); |
495 495 | + IBlockData iblockdata = block.getBlockData().set(BlockDoor.FACING, enumdirection).set(BlockDoor.HINGE, flag ? BlockDoor.EnumDoorHinge.RIGHT : BlockDoor.EnumDoorHinge.LEFT).set(BlockDoor.POWERED, Boolean.valueOf(flag3)).set(BlockDoor.OPEN, Boolean.valueOf(flag3)); |
496 496 | + |
497 497 | + world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2); |
498 498 | + world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2); |
499 499 | + world.applyPhysics(blockposition, block); |
500 500 | + world.applyPhysics(blockposition3, block); |
501 501 | + } |
502 502 | +} |
503 - | diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java |
504 - | new file mode 100644 |
505 - | index 0000000..40338ae |
506 - | --- /dev/null |
507 - | +++ b/src/main/java/net/minecraft/server/ItemSkull.java |
508 - | |
509 - | +package net.minecraft.server; |
510 - | + |
511 - | +import com.mojang.authlib.GameProfile; |
512 - | +import java.util.UUID; |
513 - | + |
514 - | +public class ItemSkull extends Item { |
515 - | + |
516 - | + private static final String[] a = new String[] { "skeleton", "wither", "zombie", "char", "creeper", "dragon"}; |
517 - | + |
518 - | + public ItemSkull() { |
519 - | + this.a(CreativeModeTab.c); |
520 - | + this.setMaxDurability(0); |
521 - | + this.a(true); |
522 - | + } |
523 - | + |
524 - | + public EnumInteractionResult a(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) { |
525 - | + if (enumdirection == EnumDirection.DOWN) { |
526 - | + return EnumInteractionResult.FAIL; |
527 - | + } else { |
528 - | + IBlockData iblockdata = world.getType(blockposition); |
529 - | + Block block = iblockdata.getBlock(); |
530 - | + boolean flag = block.a((IBlockAccess) world, blockposition); |
531 - | + |
532 - | + if (!flag) { |
533 - | + if (!world.getType(blockposition).getMaterial().isBuildable()) { |
534 - | + return EnumInteractionResult.FAIL; |
535 - | + } |
536 - | + |
537 - | + blockposition = blockposition.shift(enumdirection); |
538 - | + } |
539 - | + |
540 - | + if (entityhuman.a(blockposition, enumdirection, itemstack) && Blocks.SKULL.canPlace(world, blockposition)) { |
541 - | + if (world.isClientSide) { |
542 - | + return EnumInteractionResult.SUCCESS; |
543 - | + } else { |
544 - | + world.setTypeAndData(blockposition, Blocks.SKULL.getBlockData().set(BlockSkull.FACING, enumdirection), 11); |
545 - | + int i = 0; |
546 - | + |
547 - | + if (enumdirection == EnumDirection.UP) { |
548 - | + i = MathHelper.floor((double) (entityhuman.yaw * 16.0F / 360.0F) + 0.5D) & 15; |
549 - | + } |
550 - | + |
551 - | + TileEntity tileentity = world.getTileEntity(blockposition); |
552 - | + |
553 - | + if (tileentity instanceof TileEntitySkull) { |
554 - | + TileEntitySkull tileentityskull = (TileEntitySkull) tileentity; |
555 - | + |
556 - | + if (itemstack.getData() == 3) { |
557 - | + GameProfile gameprofile = null; |
558 - | + |
559 - | + if (itemstack.hasTag()) { |
560 - | + NBTTagCompound nbttagcompound = itemstack.getTag(); |
561 - | + |
562 - | + if (nbttagcompound.hasKeyOfType("SkullOwner", 10)) { |
563 - | + gameprofile = GameProfileSerializer.deserialize(nbttagcompound.getCompound("SkullOwner")); |
564 - | + } else if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && !nbttagcompound.getString("SkullOwner").isEmpty()) { |
565 - | + gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); |
566 - | + } |
567 - | + } |
568 - | + |
569 - | + tileentityskull.setGameProfile(gameprofile); |
570 - | + } else { |
571 - | + tileentityskull.setSkullType(itemstack.getData()); |
572 - | + } |
573 - | + |
574 - | + tileentityskull.setRotation(i); |
575 - | + Blocks.SKULL.a(world, blockposition, tileentityskull); |
576 - | + } |
577 - | + |
578 - | + --itemstack.count; |
579 - | + return EnumInteractionResult.SUCCESS; |
580 - | + } |
581 - | + } else { |
582 - | + return EnumInteractionResult.FAIL; |
583 - | + } |
584 - | + } |
585 - | + } |
586 - | + |
587 - | + public int filterData(int i) { |
588 - | + return i; |
589 - | + } |
590 - | + |
591 - | + public String f_(ItemStack itemstack) { |
592 - | + int i = itemstack.getData(); |
593 - | + |
594 - | + if (i < 0 || i >= ItemSkull.a.length) { |
595 - | + i = 0; |
596 - | + } |
597 - | + |
598 - | + return super.getName() + "." + ItemSkull.a[i]; |
599 - | + } |
600 - | + |
601 - | + public String a(ItemStack itemstack) { |
602 - | + if (itemstack.getData() == 3 && itemstack.hasTag()) { |
603 - | + if (itemstack.getTag().hasKeyOfType("SkullOwner", 8)) { |
604 - | + return LocaleI18n.a("item.skull.player.name", new Object[] { itemstack.getTag().getString("SkullOwner")}); |
605 - | + } |
606 - | + |
607 - | + if (itemstack.getTag().hasKeyOfType("SkullOwner", 10)) { |
608 - | + NBTTagCompound nbttagcompound = itemstack.getTag().getCompound("SkullOwner"); |
609 - | + |
610 - | + if (nbttagcompound.hasKeyOfType("Name", 8)) { |
611 - | + return LocaleI18n.a("item.skull.player.name", new Object[] { nbttagcompound.getString("Name")}); |
612 - | + } |
613 - | + } |
614 - | + } |
615 - | + |
616 - | + return super.a(itemstack); |
617 - | + } |
618 - | + |
619 - | + public boolean a(NBTTagCompound nbttagcompound) { |
620 - | + super.a(nbttagcompound); |
621 - | + if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && !nbttagcompound.getString("SkullOwner").isEmpty()) { |
622 - | + GameProfile gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); |
623 - | + |
624 - | + gameprofile = TileEntitySkull.b(gameprofile); |
625 - | + nbttagcompound.set("SkullOwner", GameProfileSerializer.serialize(new NBTTagCompound(), gameprofile)); |
626 - | + return true; |
627 - | + } else { |
628 - | + return false; |
629 - | + } |
630 - | + } |
631 - | +} |
632 503 | diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java |
633 504 | new file mode 100644 |
634 505 | index 0000000..2a04b86 |
635 506 | --- /dev/null |
636 507 | +++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java |
637 508 | |
638 509 | +package net.minecraft.server; |
639 510 | + |
640 511 | +import java.io.BufferedInputStream; |
641 512 | +import java.io.BufferedOutputStream; |
1623 1494 | + } |
1624 1495 | + } |
1625 1496 | + |
1626 1497 | + entityplayer.playerConnection.sendPacket(new PacketPlayOutStatistic(hashmap)); |
1627 1498 | + } |
1628 1499 | + |
1629 1500 | + public boolean e() { |
1630 1501 | + return this.g; |
1631 1502 | + } |
1632 1503 | +} |
1633 - | diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java |
1634 - | new file mode 100644 |
1635 - | index 0000000..4ae6796 |
1636 - | --- /dev/null |
1637 - | +++ b/src/main/java/net/minecraft/server/TileEntitySkull.java |
1638 - | |
1639 - | +package net.minecraft.server; |
1640 - | + |
1641 - | +import com.google.common.collect.Iterables; |
1642 - | +import com.mojang.authlib.GameProfile; |
1643 - | +import com.mojang.authlib.minecraft.MinecraftSessionService; |
1644 - | +import com.mojang.authlib.properties.Property; |
1645 - | +import java.util.UUID; |
1646 - | +import javax.annotation.Nullable; |
1647 - | + |
1648 - | +public class TileEntitySkull extends TileEntity implements ITickable { |
1649 - | + |
1650 - | + private int a; |
1651 - | + public int rotation; |
1652 - | + private GameProfile g; |
1653 - | + private int h; |
1654 - | + private boolean i; |
1655 - | + private static UserCache j; |
1656 - | + private static MinecraftSessionService k; |
1657 - | + |
1658 - | + public TileEntitySkull() {} |
1659 - | + |
1660 - | + public static void a(UserCache usercache) { |
1661 - | + TileEntitySkull.j = usercache; |
1662 - | + } |
1663 - | + |
1664 - | + public static void a(MinecraftSessionService minecraftsessionservice) { |
1665 - | + TileEntitySkull.k = minecraftsessionservice; |
1666 - | + } |
1667 - | + |
1668 - | + public NBTTagCompound save(NBTTagCompound nbttagcompound) { |
1669 - | + super.save(nbttagcompound); |
1670 - | + nbttagcompound.setByte("SkullType", (byte) (this.a & 255)); |
1671 - | + nbttagcompound.setByte("Rot", (byte) (this.rotation & 255)); |
1672 - | + if (this.g != null) { |
1673 - | + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); |
1674 - | + |
1675 - | + GameProfileSerializer.serialize(nbttagcompound1, this.g); |
1676 - | + nbttagcompound.set("Owner", nbttagcompound1); |
1677 - | + } |
1678 - | + |
1679 - | + return nbttagcompound; |
1680 - | + } |
1681 - | + |
1682 - | + public void a(NBTTagCompound nbttagcompound) { |
1683 - | + super.a(nbttagcompound); |
1684 - | + this.a = nbttagcompound.getByte("SkullType"); |
1685 - | + this.rotation = nbttagcompound.getByte("Rot"); |
1686 - | + if (this.a == 3) { |
1687 - | + if (nbttagcompound.hasKeyOfType("Owner", 10)) { |
1688 - | + this.g = GameProfileSerializer.deserialize(nbttagcompound.getCompound("Owner")); |
1689 - | + } else if (nbttagcompound.hasKeyOfType("ExtraType", 8)) { |
1690 - | + String s = nbttagcompound.getString("ExtraType"); |
1691 - | + |
1692 - | + if (!UtilColor.b(s)) { |
1693 - | + this.g = new GameProfile((UUID) null, s); |
1694 - | + this.h(); |
1695 - | + } |
1696 - | + } |
1697 - | + } |
1698 - | + |
1699 - | + } |
1700 - | + |
1701 - | + public void E_() { |
1702 - | + if (this.a == 5) { |
1703 - | + if (this.world.isBlockIndirectlyPowered(this.position)) { |
1704 - | + this.i = true; |
1705 - | + ++this.h; |
1706 - | + } else { |
1707 - | + this.i = false; |
1708 - | + } |
1709 - | + } |
1710 - | + |
1711 - | + } |
1712 - | + |
1713 - | + @Nullable |
1714 - | + public GameProfile getGameProfile() { |
1715 - | + return this.g; |
1716 - | + } |
1717 - | + |
1718 - | + @Nullable |
1719 - | + public PacketPlayOutTileEntityData getUpdatePacket() { |
1720 - | + return new PacketPlayOutTileEntityData(this.position, 4, this.c()); |
1721 - | + } |
1722 - | + |
1723 - | + public NBTTagCompound c() { |
1724 - | + return this.save(new NBTTagCompound()); |
1725 - | + } |
1726 - | + |
1727 - | + public void setSkullType(int i) { |
1728 - | + this.a = i; |
1729 - | + this.g = null; |
1730 - | + } |
1731 - | + |
1732 - | + public void setGameProfile(@Nullable GameProfile gameprofile) { |
1733 - | + this.a = 3; |
1734 - | + this.g = gameprofile; |
1735 - | + this.h(); |
1736 - | + } |
1737 - | + |
1738 - | + private void h() { |
1739 - | + this.g = b(this.g); |
1740 - | + this.update(); |
1741 - | + } |
1742 - | + |
1743 - | + public static GameProfile b(GameProfile gameprofile) { |
1744 - | + if (gameprofile != null && !UtilColor.b(gameprofile.getName())) { |
1745 - | + if (gameprofile.isComplete() && gameprofile.getProperties().containsKey("textures")) { |
1746 - | + return gameprofile; |
1747 - | + } else if (TileEntitySkull.j != null && TileEntitySkull.k != null) { |
1748 - | + GameProfile gameprofile1 = TileEntitySkull.j.getProfile(gameprofile.getName()); |
1749 - | + |
1750 - | + if (gameprofile1 == null) { |
1751 - | + return gameprofile; |
1752 - | + } else { |
1753 - | + Property property = (Property) Iterables.getFirst(gameprofile1.getProperties().get("textures"), (Object) null); |
1754 - | + |
1755 - | + if (property == null) { |
1756 - | + gameprofile1 = TileEntitySkull.k.fillProfileProperties(gameprofile1, true); |
1757 - | + } |
1758 - | + |
1759 - | + return gameprofile1; |
1760 - | + } |
1761 - | + } else { |
1762 - | + return gameprofile; |
1763 - | + } |
1764 - | + } else { |
1765 - | + return gameprofile; |
1766 - | + } |
1767 - | + } |
1768 - | + |
1769 - | + public int getSkullType() { |
1770 - | + return this.a; |
1771 - | + } |
1772 - | + |
1773 - | + public void setRotation(int i) { |
1774 - | + this.rotation = i; |
1775 - | + } |
1776 - | + |
1777 - | + public void a(EnumBlockMirror enumblockmirror) { |
1778 - | + if (this.world != null && this.world.getType(this.getPosition()).get(BlockSkull.FACING) == EnumDirection.UP) { |
1779 - | + this.rotation = enumblockmirror.a(this.rotation, 16); |
1780 - | + } |
1781 - | + |
1782 - | + } |
1783 - | + |
1784 - | + public void a(EnumBlockRotation enumblockrotation) { |
1785 - | + if (this.world != null && this.world.getType(this.getPosition()).get(BlockSkull.FACING) == EnumDirection.UP) { |
1786 - | + this.rotation = enumblockrotation.a(this.rotation, 16); |
1787 - | + } |
1788 - | + |
1789 - | + } |
1790 - | +} |
1791 1504 | diff --git a/src/main/java/net/minecraft/server/WorldGenLargeFeature.java b/src/main/java/net/minecraft/server/WorldGenLargeFeature.java |
1792 1505 | new file mode 100644 |
1793 1506 | index 0000000..8ceac26 |
1794 1507 | --- /dev/null |
1795 1508 | +++ b/src/main/java/net/minecraft/server/WorldGenLargeFeature.java |
1796 1509 | |
1797 1510 | +package net.minecraft.server; |
1798 1511 | + |
1799 1512 | +import com.google.common.collect.Lists; |
1800 1513 | +import java.util.Arrays; |