base mod created

This commit is contained in:
Mohammad-Ali Minaie
2018-10-08 09:07:47 -04:00
parent 0a7700c356
commit b86dedad2f
7848 changed files with 584664 additions and 1 deletions

View File

@@ -0,0 +1,130 @@
package net.minecraft.util.datafix;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import java.util.List;
import java.util.Map;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Util;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class DataFixer implements IDataFixer
{
private static final Logger LOGGER = LogManager.getLogger();
private final Map<IFixType, List<IDataWalker>> walkerMap = Maps.<IFixType, List<IDataWalker>>newHashMap();
private final Map<IFixType, List<IFixableData>> fixMap = Maps.<IFixType, List<IFixableData>>newHashMap();
public final int version;
public DataFixer(int versionIn)
{
this.version = versionIn;
}
public NBTTagCompound process(IFixType type, NBTTagCompound compound)
{
int i = compound.hasKey("DataVersion", 99) ? compound.getInteger("DataVersion") : -1;
return i >= 1343 ? compound : this.process(type, compound, i);
}
public NBTTagCompound process(IFixType type, NBTTagCompound compound, int versionIn)
{
if (versionIn < this.version)
{
compound = this.processFixes(type, compound, versionIn);
compound = this.processWalkers(type, compound, versionIn);
}
return compound;
}
private NBTTagCompound processFixes(IFixType type, NBTTagCompound compound, int versionIn)
{
List<IFixableData> list = (List)this.fixMap.get(type);
if (list != null)
{
for (int i = 0; i < list.size(); ++i)
{
IFixableData ifixabledata = list.get(i);
if (ifixabledata.getFixVersion() > versionIn)
{
compound = ifixabledata.fixTagCompound(compound);
}
}
}
return compound;
}
private NBTTagCompound processWalkers(IFixType type, NBTTagCompound compound, int versionIn)
{
List<IDataWalker> list = (List)this.walkerMap.get(type);
if (list != null)
{
for (int i = 0; i < list.size(); ++i)
{
compound = ((IDataWalker)list.get(i)).process(this, compound, versionIn);
}
}
return compound;
}
public void registerWalker(FixTypes type, IDataWalker walker)
{
this.registerVanillaWalker(type, walker);
}
/**
* Do not invoke this method, use registerWalker instead. It is expected to be removed in future versions.
*/
public void registerVanillaWalker(IFixType type, IDataWalker walker)
{
this.getTypeList(this.walkerMap, type).add(walker);
}
public void registerFix(IFixType type, IFixableData fixable)
{
List<IFixableData> list = this.<IFixableData>getTypeList(this.fixMap, type);
int i = fixable.getFixVersion();
if (i > this.version)
{
LOGGER.warn("Ignored fix registered for version: {} as the DataVersion of the game is: {}", Integer.valueOf(i), Integer.valueOf(this.version));
}
else
{
if (!list.isEmpty() && ((IFixableData)Util.getLastElement(list)).getFixVersion() > i)
{
for (int j = 0; j < list.size(); ++j)
{
if (((IFixableData)list.get(j)).getFixVersion() > i)
{
list.add(j, fixable);
break;
}
}
}
else
{
list.add(fixable);
}
}
}
private <V> List<V> getTypeList(Map<IFixType, List<V>> map, IFixType type)
{
List<V> list = (List)map.get(type);
if (list == null)
{
list = Lists.<V>newArrayList();
map.put(type, list);
}
return list;
}
}

View File

@@ -0,0 +1,284 @@
package net.minecraft.util.datafix;
import net.minecraft.block.BlockJukebox;
import net.minecraft.entity.Entity;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.entity.item.EntityEnderPearl;
import net.minecraft.entity.item.EntityExpBottle;
import net.minecraft.entity.item.EntityFallingBlock;
import net.minecraft.entity.item.EntityFireworkRocket;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.item.EntityMinecartChest;
import net.minecraft.entity.item.EntityMinecartCommandBlock;
import net.minecraft.entity.item.EntityMinecartEmpty;
import net.minecraft.entity.item.EntityMinecartFurnace;
import net.minecraft.entity.item.EntityMinecartHopper;
import net.minecraft.entity.item.EntityMinecartMobSpawner;
import net.minecraft.entity.item.EntityMinecartTNT;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.monster.EntityCaveSpider;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityElderGuardian;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntityEndermite;
import net.minecraft.entity.monster.EntityEvoker;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.monster.EntityGiantZombie;
import net.minecraft.entity.monster.EntityGuardian;
import net.minecraft.entity.monster.EntityHusk;
import net.minecraft.entity.monster.EntityIronGolem;
import net.minecraft.entity.monster.EntityMagmaCube;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.entity.monster.EntityShulker;
import net.minecraft.entity.monster.EntitySilverfish;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.monster.EntitySnowman;
import net.minecraft.entity.monster.EntitySpider;
import net.minecraft.entity.monster.EntityStray;
import net.minecraft.entity.monster.EntityVex;
import net.minecraft.entity.monster.EntityVindicator;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.entity.monster.EntityWitherSkeleton;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.monster.EntityZombieVillager;
import net.minecraft.entity.passive.EntityBat;
import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.passive.EntityDonkey;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityMooshroom;
import net.minecraft.entity.passive.EntityMule;
import net.minecraft.entity.passive.EntityOcelot;
import net.minecraft.entity.passive.EntityPig;
import net.minecraft.entity.passive.EntityRabbit;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.passive.EntitySkeletonHorse;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.entity.passive.EntityZombieHorse;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.entity.projectile.EntityDragonFireball;
import net.minecraft.entity.projectile.EntityEgg;
import net.minecraft.entity.projectile.EntityLargeFireball;
import net.minecraft.entity.projectile.EntityPotion;
import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraft.entity.projectile.EntitySnowball;
import net.minecraft.entity.projectile.EntitySpectralArrow;
import net.minecraft.entity.projectile.EntityTippedArrow;
import net.minecraft.entity.projectile.EntityWitherSkull;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntityBrewingStand;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityDispenser;
import net.minecraft.tileentity.TileEntityDropper;
import net.minecraft.tileentity.TileEntityFlowerPot;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.tileentity.TileEntityHopper;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.tileentity.TileEntityPiston;
import net.minecraft.tileentity.TileEntityShulkerBox;
import net.minecraft.util.datafix.fixes.AddBedTileEntity;
import net.minecraft.util.datafix.fixes.ArmorStandSilent;
import net.minecraft.util.datafix.fixes.BannerItemColor;
import net.minecraft.util.datafix.fixes.BedItemColor;
import net.minecraft.util.datafix.fixes.BookPagesStrictJSON;
import net.minecraft.util.datafix.fixes.CookedFishIDTypo;
import net.minecraft.util.datafix.fixes.ElderGuardianSplit;
import net.minecraft.util.datafix.fixes.EntityArmorAndHeld;
import net.minecraft.util.datafix.fixes.EntityHealth;
import net.minecraft.util.datafix.fixes.EntityId;
import net.minecraft.util.datafix.fixes.ForceVBOOn;
import net.minecraft.util.datafix.fixes.HorseSaddle;
import net.minecraft.util.datafix.fixes.HorseSplit;
import net.minecraft.util.datafix.fixes.ItemIntIDToString;
import net.minecraft.util.datafix.fixes.MinecartEntityTypes;
import net.minecraft.util.datafix.fixes.OptionsLowerCaseLanguage;
import net.minecraft.util.datafix.fixes.PaintingDirection;
import net.minecraft.util.datafix.fixes.PotionItems;
import net.minecraft.util.datafix.fixes.PotionWater;
import net.minecraft.util.datafix.fixes.RedundantChanceTags;
import net.minecraft.util.datafix.fixes.RidingToPassengers;
import net.minecraft.util.datafix.fixes.ShulkerBoxEntityColor;
import net.minecraft.util.datafix.fixes.ShulkerBoxItemColor;
import net.minecraft.util.datafix.fixes.ShulkerBoxTileColor;
import net.minecraft.util.datafix.fixes.SignStrictJSON;
import net.minecraft.util.datafix.fixes.SkeletonSplit;
import net.minecraft.util.datafix.fixes.SpawnEggNames;
import net.minecraft.util.datafix.fixes.SpawnerEntityTypes;
import net.minecraft.util.datafix.fixes.StringToUUID;
import net.minecraft.util.datafix.fixes.TileEntityId;
import net.minecraft.util.datafix.fixes.TotemItemRename;
import net.minecraft.util.datafix.fixes.ZombieProfToType;
import net.minecraft.util.datafix.fixes.ZombieSplit;
import net.minecraft.world.chunk.storage.AnvilChunkLoader;
import net.minecraft.world.gen.structure.template.Template;
import net.minecraft.world.storage.WorldInfo;
public class DataFixesManager
{
private static void registerFixes(DataFixer fixer)
{
fixer.registerFix(FixTypes.ENTITY, new EntityArmorAndHeld());
fixer.registerFix(FixTypes.BLOCK_ENTITY, new SignStrictJSON());
fixer.registerFix(FixTypes.ITEM_INSTANCE, new ItemIntIDToString());
fixer.registerFix(FixTypes.ITEM_INSTANCE, new PotionItems());
fixer.registerFix(FixTypes.ITEM_INSTANCE, new SpawnEggNames());
fixer.registerFix(FixTypes.ENTITY, new MinecartEntityTypes());
fixer.registerFix(FixTypes.BLOCK_ENTITY, new SpawnerEntityTypes());
fixer.registerFix(FixTypes.ENTITY, new StringToUUID());
fixer.registerFix(FixTypes.ENTITY, new EntityHealth());
fixer.registerFix(FixTypes.ENTITY, new HorseSaddle());
fixer.registerFix(FixTypes.ENTITY, new PaintingDirection());
fixer.registerFix(FixTypes.ENTITY, new RedundantChanceTags());
fixer.registerFix(FixTypes.ENTITY, new RidingToPassengers());
fixer.registerFix(FixTypes.ENTITY, new ArmorStandSilent());
fixer.registerFix(FixTypes.ITEM_INSTANCE, new BookPagesStrictJSON());
fixer.registerFix(FixTypes.ITEM_INSTANCE, new CookedFishIDTypo());
fixer.registerFix(FixTypes.ENTITY, new ZombieProfToType());
fixer.registerFix(FixTypes.OPTIONS, new ForceVBOOn());
fixer.registerFix(FixTypes.ENTITY, new ElderGuardianSplit());
fixer.registerFix(FixTypes.ENTITY, new SkeletonSplit());
fixer.registerFix(FixTypes.ENTITY, new ZombieSplit());
fixer.registerFix(FixTypes.ENTITY, new HorseSplit());
fixer.registerFix(FixTypes.BLOCK_ENTITY, new TileEntityId());
fixer.registerFix(FixTypes.ENTITY, new EntityId());
fixer.registerFix(FixTypes.ITEM_INSTANCE, new BannerItemColor());
fixer.registerFix(FixTypes.ITEM_INSTANCE, new PotionWater());
fixer.registerFix(FixTypes.ENTITY, new ShulkerBoxEntityColor());
fixer.registerFix(FixTypes.ITEM_INSTANCE, new ShulkerBoxItemColor());
fixer.registerFix(FixTypes.BLOCK_ENTITY, new ShulkerBoxTileColor());
fixer.registerFix(FixTypes.OPTIONS, new OptionsLowerCaseLanguage());
fixer.registerFix(FixTypes.ITEM_INSTANCE, new TotemItemRename());
fixer.registerFix(FixTypes.CHUNK, new AddBedTileEntity());
fixer.registerFix(FixTypes.ITEM_INSTANCE, new BedItemColor());
}
public static DataFixer createFixer()
{
DataFixer datafixer = new DataFixer(1343);
datafixer = new net.minecraftforge.common.util.CompoundDataFixer(datafixer);
WorldInfo.registerFixes(datafixer);
EntityPlayerMP.registerFixesPlayerMP(datafixer);
EntityPlayer.registerFixesPlayer(datafixer);
AnvilChunkLoader.registerFixes(datafixer);
ItemStack.registerFixes(datafixer);
Template.registerFixes(datafixer);
Entity.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);
EntityDonkey.registerFixesDonkey(datafixer);
EntityDragonFireball.registerFixesDragonFireball(datafixer);
EntityElderGuardian.registerFixesElderGuardian(datafixer);
EntityDragon.registerFixesDragon(datafixer);
EntityEnderman.registerFixesEnderman(datafixer);
EntityEndermite.registerFixesEndermite(datafixer);
EntityEvoker.registerFixesEvoker(datafixer);
EntityFallingBlock.registerFixesFallingBlock(datafixer);
EntityFireworkRocket.registerFixesFireworkRocket(datafixer);
EntityGhast.registerFixesGhast(datafixer);
EntityGiantZombie.registerFixesGiantZombie(datafixer);
EntityGuardian.registerFixesGuardian(datafixer);
EntityHorse.registerFixesHorse(datafixer);
EntityHusk.registerFixesHusk(datafixer);
EntityItem.registerFixesItem(datafixer);
EntityItemFrame.registerFixesItemFrame(datafixer);
EntityLargeFireball.registerFixesLargeFireball(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);
EntityMule.registerFixesMule(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);
EntitySkeletonHorse.registerFixesSkeletonHorse(datafixer);
EntitySlime.registerFixesSlime(datafixer);
EntitySmallFireball.registerFixesSmallFireball(datafixer);
EntitySnowman.registerFixesSnowman(datafixer);
EntitySnowball.registerFixesSnowball(datafixer);
EntitySpectralArrow.registerFixesSpectralArrow(datafixer);
EntitySpider.registerFixesSpider(datafixer);
EntitySquid.registerFixesSquid(datafixer);
EntityStray.registerFixesStray(datafixer);
EntityEgg.registerFixesEgg(datafixer);
EntityEnderPearl.registerFixesEnderPearl(datafixer);
EntityExpBottle.registerFixesExpBottle(datafixer);
EntityPotion.registerFixesPotion(datafixer);
EntityTippedArrow.registerFixesTippedArrow(datafixer);
EntityVex.registerFixesVex(datafixer);
EntityVillager.registerFixesVillager(datafixer);
EntityIronGolem.registerFixesIronGolem(datafixer);
EntityVindicator.registerFixesVindicator(datafixer);
EntityWitch.registerFixesWitch(datafixer);
EntityWither.registerFixesWither(datafixer);
EntityWitherSkeleton.registerFixesWitherSkeleton(datafixer);
EntityWitherSkull.registerFixesWitherSkull(datafixer);
EntityWolf.registerFixesWolf(datafixer);
EntityZombie.registerFixesZombie(datafixer);
EntityZombieHorse.registerFixesZombieHorse(datafixer);
EntityZombieVillager.registerFixesZombieVillager(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);
TileEntityShulkerBox.registerFixesShulkerBox(datafixer);
registerFixes(datafixer);
return datafixer;
}
public static NBTTagCompound processItemStack(IDataFixer fixer, NBTTagCompound compound, int version, String key)
{
if (compound.hasKey(key, 10))
{
compound.setTag(key, fixer.process(FixTypes.ITEM_INSTANCE, compound.getCompoundTag(key), version));
}
return compound;
}
public static NBTTagCompound processInventory(IDataFixer fixer, NBTTagCompound compound, int version, String key)
{
if (compound.hasKey(key, 9))
{
NBTTagList nbttaglist = compound.getTagList(key, 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
nbttaglist.set(i, fixer.process(FixTypes.ITEM_INSTANCE, nbttaglist.getCompoundTagAt(i), version));
}
}
return compound;
}
}

View File

@@ -0,0 +1,13 @@
package net.minecraft.util.datafix;
public enum FixTypes implements IFixType
{
LEVEL,
PLAYER,
CHUNK,
BLOCK_ENTITY,
ENTITY,
ITEM_INSTANCE,
OPTIONS,
STRUCTURE;
}

View File

@@ -0,0 +1,8 @@
package net.minecraft.util.datafix;
import net.minecraft.nbt.NBTTagCompound;
public interface IDataFixer
{
NBTTagCompound process(IFixType type, NBTTagCompound compound, int versionIn);
}

View File

@@ -0,0 +1,8 @@
package net.minecraft.util.datafix;
import net.minecraft.nbt.NBTTagCompound;
public interface IDataWalker
{
NBTTagCompound process(IDataFixer fixer, NBTTagCompound compound, int versionIn);
}

View File

@@ -0,0 +1,5 @@
package net.minecraft.util.datafix;
public interface IFixType
{
}

View File

@@ -0,0 +1,10 @@
package net.minecraft.util.datafix;
import net.minecraft.nbt.NBTTagCompound;
public interface IFixableData
{
int getFixVersion();
NBTTagCompound fixTagCompound(NBTTagCompound compound);
}

View File

@@ -0,0 +1,60 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.datafix.IFixableData;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class AddBedTileEntity implements IFixableData
{
private static final Logger LOGGER = LogManager.getLogger();
public int getFixVersion()
{
return 1125;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
int i = 416;
try
{
NBTTagCompound nbttagcompound = compound.getCompoundTag("Level");
int j = nbttagcompound.getInteger("xPos");
int k = nbttagcompound.getInteger("zPos");
NBTTagList nbttaglist = nbttagcompound.getTagList("TileEntities", 10);
NBTTagList nbttaglist1 = nbttagcompound.getTagList("Sections", 10);
for (int l = 0; l < nbttaglist1.tagCount(); ++l)
{
NBTTagCompound nbttagcompound1 = nbttaglist1.getCompoundTagAt(l);
int i1 = nbttagcompound1.getByte("Y");
byte[] abyte = nbttagcompound1.getByteArray("Blocks");
for (int j1 = 0; j1 < abyte.length; ++j1)
{
if (416 == (abyte[j1] & 255) << 4)
{
int k1 = j1 & 15;
int l1 = j1 >> 8 & 15;
int i2 = j1 >> 4 & 15;
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
nbttagcompound2.setString("id", "bed");
nbttagcompound2.setInteger("x", k1 + (j << 4));
nbttagcompound2.setInteger("y", l1 + (i1 << 4));
nbttagcompound2.setInteger("z", i2 + (k << 4));
nbttaglist.appendTag(nbttagcompound2);
}
}
}
}
catch (Exception var17)
{
LOGGER.warn("Unable to datafix Bed blocks, level format may be missing tags.");
}
return compound;
}
}

View File

@@ -0,0 +1,22 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class ArmorStandSilent implements IFixableData
{
public int getFixVersion()
{
return 147;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("ArmorStand".equals(compound.getString("id")) && compound.getBoolean("Silent") && !compound.getBoolean("Marker"))
{
compound.removeTag("Silent");
}
return compound;
}
}

View File

@@ -0,0 +1,60 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.datafix.IFixableData;
public class BannerItemColor implements IFixableData
{
public int getFixVersion()
{
return 804;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("minecraft:banner".equals(compound.getString("id")) && compound.hasKey("tag", 10))
{
NBTTagCompound nbttagcompound = compound.getCompoundTag("tag");
if (nbttagcompound.hasKey("BlockEntityTag", 10))
{
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("BlockEntityTag");
if (nbttagcompound1.hasKey("Base", 99))
{
compound.setShort("Damage", (short)(nbttagcompound1.getShort("Base") & 15));
if (nbttagcompound.hasKey("display", 10))
{
NBTTagCompound nbttagcompound2 = nbttagcompound.getCompoundTag("display");
if (nbttagcompound2.hasKey("Lore", 9))
{
NBTTagList nbttaglist = nbttagcompound2.getTagList("Lore", 8);
if (nbttaglist.tagCount() == 1 && "(+NBT)".equals(nbttaglist.getStringTagAt(0)))
{
return compound;
}
}
}
nbttagcompound1.removeTag("Base");
if (nbttagcompound1.hasNoTags())
{
nbttagcompound.removeTag("BlockEntityTag");
}
if (nbttagcompound.hasNoTags())
{
compound.removeTag("tag");
}
}
}
}
return compound;
}
}

View File

@@ -0,0 +1,23 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class BedItemColor implements IFixableData
{
public int getFixVersion()
{
return 1125;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("minecraft:bed".equals(compound.getString("id")) && compound.getShort("Damage") == 0)
{
compound.setShort("Damage", (short)EnumDyeColor.RED.getMetadata());
}
return compound;
}
}

View File

@@ -0,0 +1,101 @@
package net.minecraft.util.datafix.fixes;
import com.google.gson.JsonParseException;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.JsonUtils;
import net.minecraft.util.StringUtils;
import net.minecraft.util.datafix.IFixableData;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
public class BookPagesStrictJSON implements IFixableData
{
public int getFixVersion()
{
return 165;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("minecraft:written_book".equals(compound.getString("id")))
{
NBTTagCompound nbttagcompound = compound.getCompoundTag("tag");
if (nbttagcompound.hasKey("pages", 9))
{
NBTTagList nbttaglist = nbttagcompound.getTagList("pages", 8);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
String s = nbttaglist.getStringTagAt(i);
ITextComponent itextcomponent = null;
if (!"null".equals(s) && !StringUtils.isNullOrEmpty(s))
{
if (s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"' || s.charAt(0) == '{' && s.charAt(s.length() - 1) == '}')
{
try
{
itextcomponent = (ITextComponent)JsonUtils.gsonDeserialize(SignStrictJSON.GSON_INSTANCE, s, ITextComponent.class, true);
if (itextcomponent == null)
{
itextcomponent = new TextComponentString("");
}
}
catch (JsonParseException var10)
{
;
}
if (itextcomponent == null)
{
try
{
itextcomponent = ITextComponent.Serializer.jsonToComponent(s);
}
catch (JsonParseException var9)
{
;
}
}
if (itextcomponent == null)
{
try
{
itextcomponent = ITextComponent.Serializer.fromJsonLenient(s);
}
catch (JsonParseException var8)
{
;
}
}
if (itextcomponent == null)
{
itextcomponent = new TextComponentString(s);
}
}
else
{
itextcomponent = new TextComponentString(s);
}
}
else
{
itextcomponent = new TextComponentString("");
}
nbttaglist.set(i, new NBTTagString(ITextComponent.Serializer.componentToJson(itextcomponent)));
}
nbttagcompound.setTag("pages", nbttaglist);
}
}
return compound;
}
}

View File

@@ -0,0 +1,25 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.datafix.IFixableData;
public class CookedFishIDTypo implements IFixableData
{
private static final ResourceLocation WRONG = new ResourceLocation("cooked_fished");
public int getFixVersion()
{
return 502;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if (compound.hasKey("id", 8) && WRONG.equals(new ResourceLocation(compound.getString("id"))))
{
compound.setString("id", "minecraft:cooked_fish");
}
return compound;
}
}

View File

@@ -0,0 +1,27 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class ElderGuardianSplit implements IFixableData
{
public int getFixVersion()
{
return 700;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("Guardian".equals(compound.getString("id")))
{
if (compound.getBoolean("Elder"))
{
compound.setString("id", "ElderGuardian");
}
compound.removeTag("Elder");
}
return compound;
}
}

View File

@@ -0,0 +1,66 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagFloat;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.datafix.IFixableData;
public class EntityArmorAndHeld implements IFixableData
{
public int getFixVersion()
{
return 100;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
NBTTagList nbttaglist = compound.getTagList("Equipment", 10);
if (!nbttaglist.hasNoTags() && !compound.hasKey("HandItems", 10))
{
NBTTagList nbttaglist1 = new NBTTagList();
nbttaglist1.appendTag(nbttaglist.get(0));
nbttaglist1.appendTag(new NBTTagCompound());
compound.setTag("HandItems", nbttaglist1);
}
if (nbttaglist.tagCount() > 1 && !compound.hasKey("ArmorItem", 10))
{
NBTTagList nbttaglist3 = new NBTTagList();
nbttaglist3.appendTag(nbttaglist.getCompoundTagAt(1));
nbttaglist3.appendTag(nbttaglist.getCompoundTagAt(2));
nbttaglist3.appendTag(nbttaglist.getCompoundTagAt(3));
nbttaglist3.appendTag(nbttaglist.getCompoundTagAt(4));
compound.setTag("ArmorItems", nbttaglist3);
}
compound.removeTag("Equipment");
if (compound.hasKey("DropChances", 9))
{
NBTTagList nbttaglist4 = compound.getTagList("DropChances", 5);
if (!compound.hasKey("HandDropChances", 10))
{
NBTTagList nbttaglist2 = new NBTTagList();
nbttaglist2.appendTag(new NBTTagFloat(nbttaglist4.getFloatAt(0)));
nbttaglist2.appendTag(new NBTTagFloat(0.0F));
compound.setTag("HandDropChances", nbttaglist2);
}
if (!compound.hasKey("ArmorDropChances", 10))
{
NBTTagList nbttaglist5 = new NBTTagList();
nbttaglist5.appendTag(new NBTTagFloat(nbttaglist4.getFloatAt(1)));
nbttaglist5.appendTag(new NBTTagFloat(nbttaglist4.getFloatAt(2)));
nbttaglist5.appendTag(new NBTTagFloat(nbttaglist4.getFloatAt(3)));
nbttaglist5.appendTag(new NBTTagFloat(nbttaglist4.getFloatAt(4)));
compound.setTag("ArmorDropChances", nbttaglist5);
}
compound.removeTag("DropChances");
}
return compound;
}
}

View File

@@ -0,0 +1,43 @@
package net.minecraft.util.datafix.fixes;
import com.google.common.collect.Sets;
import java.util.Set;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class EntityHealth implements IFixableData
{
private static final Set<String> ENTITY_LIST = Sets.newHashSet("ArmorStand", "Bat", "Blaze", "CaveSpider", "Chicken", "Cow", "Creeper", "EnderDragon", "Enderman", "Endermite", "EntityHorse", "Ghast", "Giant", "Guardian", "LavaSlime", "MushroomCow", "Ozelot", "Pig", "PigZombie", "Rabbit", "Sheep", "Shulker", "Silverfish", "Skeleton", "Slime", "SnowMan", "Spider", "Squid", "Villager", "VillagerGolem", "Witch", "WitherBoss", "Wolf", "Zombie");
public int getFixVersion()
{
return 109;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if (ENTITY_LIST.contains(compound.getString("id")))
{
float f;
if (compound.hasKey("HealF", 99))
{
f = compound.getFloat("HealF");
compound.removeTag("HealF");
}
else
{
if (!compound.hasKey("Health", 99))
{
return compound;
}
f = compound.getFloat("Health");
}
compound.setFloat("Health", f);
}
return compound;
}
}

View File

@@ -0,0 +1,107 @@
package net.minecraft.util.datafix.fixes;
import com.google.common.collect.Maps;
import java.util.Map;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class EntityId implements IFixableData
{
private static final Map<String, String> OLD_TO_NEW_ID_MAP = Maps.<String, String>newHashMap();
public int getFixVersion()
{
return 704;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
String s = OLD_TO_NEW_ID_MAP.get(compound.getString("id"));
if (s != null)
{
compound.setString("id", s);
}
return compound;
}
static
{
OLD_TO_NEW_ID_MAP.put("AreaEffectCloud", "minecraft:area_effect_cloud");
OLD_TO_NEW_ID_MAP.put("ArmorStand", "minecraft:armor_stand");
OLD_TO_NEW_ID_MAP.put("Arrow", "minecraft:arrow");
OLD_TO_NEW_ID_MAP.put("Bat", "minecraft:bat");
OLD_TO_NEW_ID_MAP.put("Blaze", "minecraft:blaze");
OLD_TO_NEW_ID_MAP.put("Boat", "minecraft:boat");
OLD_TO_NEW_ID_MAP.put("CaveSpider", "minecraft:cave_spider");
OLD_TO_NEW_ID_MAP.put("Chicken", "minecraft:chicken");
OLD_TO_NEW_ID_MAP.put("Cow", "minecraft:cow");
OLD_TO_NEW_ID_MAP.put("Creeper", "minecraft:creeper");
OLD_TO_NEW_ID_MAP.put("Donkey", "minecraft:donkey");
OLD_TO_NEW_ID_MAP.put("DragonFireball", "minecraft:dragon_fireball");
OLD_TO_NEW_ID_MAP.put("ElderGuardian", "minecraft:elder_guardian");
OLD_TO_NEW_ID_MAP.put("EnderCrystal", "minecraft:ender_crystal");
OLD_TO_NEW_ID_MAP.put("EnderDragon", "minecraft:ender_dragon");
OLD_TO_NEW_ID_MAP.put("Enderman", "minecraft:enderman");
OLD_TO_NEW_ID_MAP.put("Endermite", "minecraft:endermite");
OLD_TO_NEW_ID_MAP.put("EyeOfEnderSignal", "minecraft:eye_of_ender_signal");
OLD_TO_NEW_ID_MAP.put("FallingSand", "minecraft:falling_block");
OLD_TO_NEW_ID_MAP.put("Fireball", "minecraft:fireball");
OLD_TO_NEW_ID_MAP.put("FireworksRocketEntity", "minecraft:fireworks_rocket");
OLD_TO_NEW_ID_MAP.put("Ghast", "minecraft:ghast");
OLD_TO_NEW_ID_MAP.put("Giant", "minecraft:giant");
OLD_TO_NEW_ID_MAP.put("Guardian", "minecraft:guardian");
OLD_TO_NEW_ID_MAP.put("Horse", "minecraft:horse");
OLD_TO_NEW_ID_MAP.put("Husk", "minecraft:husk");
OLD_TO_NEW_ID_MAP.put("Item", "minecraft:item");
OLD_TO_NEW_ID_MAP.put("ItemFrame", "minecraft:item_frame");
OLD_TO_NEW_ID_MAP.put("LavaSlime", "minecraft:magma_cube");
OLD_TO_NEW_ID_MAP.put("LeashKnot", "minecraft:leash_knot");
OLD_TO_NEW_ID_MAP.put("MinecartChest", "minecraft:chest_minecart");
OLD_TO_NEW_ID_MAP.put("MinecartCommandBlock", "minecraft:commandblock_minecart");
OLD_TO_NEW_ID_MAP.put("MinecartFurnace", "minecraft:furnace_minecart");
OLD_TO_NEW_ID_MAP.put("MinecartHopper", "minecraft:hopper_minecart");
OLD_TO_NEW_ID_MAP.put("MinecartRideable", "minecraft:minecart");
OLD_TO_NEW_ID_MAP.put("MinecartSpawner", "minecraft:spawner_minecart");
OLD_TO_NEW_ID_MAP.put("MinecartTNT", "minecraft:tnt_minecart");
OLD_TO_NEW_ID_MAP.put("Mule", "minecraft:mule");
OLD_TO_NEW_ID_MAP.put("MushroomCow", "minecraft:mooshroom");
OLD_TO_NEW_ID_MAP.put("Ozelot", "minecraft:ocelot");
OLD_TO_NEW_ID_MAP.put("Painting", "minecraft:painting");
OLD_TO_NEW_ID_MAP.put("Pig", "minecraft:pig");
OLD_TO_NEW_ID_MAP.put("PigZombie", "minecraft:zombie_pigman");
OLD_TO_NEW_ID_MAP.put("PolarBear", "minecraft:polar_bear");
OLD_TO_NEW_ID_MAP.put("PrimedTnt", "minecraft:tnt");
OLD_TO_NEW_ID_MAP.put("Rabbit", "minecraft:rabbit");
OLD_TO_NEW_ID_MAP.put("Sheep", "minecraft:sheep");
OLD_TO_NEW_ID_MAP.put("Shulker", "minecraft:shulker");
OLD_TO_NEW_ID_MAP.put("ShulkerBullet", "minecraft:shulker_bullet");
OLD_TO_NEW_ID_MAP.put("Silverfish", "minecraft:silverfish");
OLD_TO_NEW_ID_MAP.put("Skeleton", "minecraft:skeleton");
OLD_TO_NEW_ID_MAP.put("SkeletonHorse", "minecraft:skeleton_horse");
OLD_TO_NEW_ID_MAP.put("Slime", "minecraft:slime");
OLD_TO_NEW_ID_MAP.put("SmallFireball", "minecraft:small_fireball");
OLD_TO_NEW_ID_MAP.put("SnowMan", "minecraft:snowman");
OLD_TO_NEW_ID_MAP.put("Snowball", "minecraft:snowball");
OLD_TO_NEW_ID_MAP.put("SpectralArrow", "minecraft:spectral_arrow");
OLD_TO_NEW_ID_MAP.put("Spider", "minecraft:spider");
OLD_TO_NEW_ID_MAP.put("Squid", "minecraft:squid");
OLD_TO_NEW_ID_MAP.put("Stray", "minecraft:stray");
OLD_TO_NEW_ID_MAP.put("ThrownEgg", "minecraft:egg");
OLD_TO_NEW_ID_MAP.put("ThrownEnderpearl", "minecraft:ender_pearl");
OLD_TO_NEW_ID_MAP.put("ThrownExpBottle", "minecraft:xp_bottle");
OLD_TO_NEW_ID_MAP.put("ThrownPotion", "minecraft:potion");
OLD_TO_NEW_ID_MAP.put("Villager", "minecraft:villager");
OLD_TO_NEW_ID_MAP.put("VillagerGolem", "minecraft:villager_golem");
OLD_TO_NEW_ID_MAP.put("Witch", "minecraft:witch");
OLD_TO_NEW_ID_MAP.put("WitherBoss", "minecraft:wither");
OLD_TO_NEW_ID_MAP.put("WitherSkeleton", "minecraft:wither_skeleton");
OLD_TO_NEW_ID_MAP.put("WitherSkull", "minecraft:wither_skull");
OLD_TO_NEW_ID_MAP.put("Wolf", "minecraft:wolf");
OLD_TO_NEW_ID_MAP.put("XPOrb", "minecraft:xp_orb");
OLD_TO_NEW_ID_MAP.put("Zombie", "minecraft:zombie");
OLD_TO_NEW_ID_MAP.put("ZombieHorse", "minecraft:zombie_horse");
OLD_TO_NEW_ID_MAP.put("ZombieVillager", "minecraft:zombie_villager");
}
}

View File

@@ -0,0 +1,18 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class ForceVBOOn implements IFixableData
{
public int getFixVersion()
{
return 505;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
compound.setString("useVbo", "true");
return compound;
}
}

View File

@@ -0,0 +1,27 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class HorseSaddle implements IFixableData
{
public int getFixVersion()
{
return 110;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("EntityHorse".equals(compound.getString("id")) && !compound.hasKey("SaddleItem", 10) && compound.getBoolean("Saddle"))
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setString("id", "minecraft:saddle");
nbttagcompound.setByte("Count", (byte)1);
nbttagcompound.setShort("Damage", (short)0);
compound.setTag("SaddleItem", nbttagcompound);
compound.removeTag("Saddle");
}
return compound;
}
}

View File

@@ -0,0 +1,43 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class HorseSplit implements IFixableData
{
public int getFixVersion()
{
return 703;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("EntityHorse".equals(compound.getString("id")))
{
int i = compound.getInteger("Type");
switch (i)
{
case 0:
default:
compound.setString("id", "Horse");
break;
case 1:
compound.setString("id", "Donkey");
break;
case 2:
compound.setString("id", "Mule");
break;
case 3:
compound.setString("id", "ZombieHorse");
break;
case 4:
compound.setString("id", "SkeletonHorse");
}
compound.removeTag("Type");
}
return compound;
}
}

View File

@@ -0,0 +1,348 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class ItemIntIDToString implements IFixableData
{
private static final String[] ID_MAP = new String[2268];
public int getFixVersion()
{
return 102;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if (compound.hasKey("id", 99))
{
short short1 = compound.getShort("id");
if (short1 > 0 && short1 < ID_MAP.length && ID_MAP[short1] != null)
{
compound.setString("id", ID_MAP[short1]);
}
}
return compound;
}
static
{
ID_MAP[1] = "minecraft:stone";
ID_MAP[2] = "minecraft:grass";
ID_MAP[3] = "minecraft:dirt";
ID_MAP[4] = "minecraft:cobblestone";
ID_MAP[5] = "minecraft:planks";
ID_MAP[6] = "minecraft:sapling";
ID_MAP[7] = "minecraft:bedrock";
ID_MAP[8] = "minecraft:flowing_water";
ID_MAP[9] = "minecraft:water";
ID_MAP[10] = "minecraft:flowing_lava";
ID_MAP[11] = "minecraft:lava";
ID_MAP[12] = "minecraft:sand";
ID_MAP[13] = "minecraft:gravel";
ID_MAP[14] = "minecraft:gold_ore";
ID_MAP[15] = "minecraft:iron_ore";
ID_MAP[16] = "minecraft:coal_ore";
ID_MAP[17] = "minecraft:log";
ID_MAP[18] = "minecraft:leaves";
ID_MAP[19] = "minecraft:sponge";
ID_MAP[20] = "minecraft:glass";
ID_MAP[21] = "minecraft:lapis_ore";
ID_MAP[22] = "minecraft:lapis_block";
ID_MAP[23] = "minecraft:dispenser";
ID_MAP[24] = "minecraft:sandstone";
ID_MAP[25] = "minecraft:noteblock";
ID_MAP[27] = "minecraft:golden_rail";
ID_MAP[28] = "minecraft:detector_rail";
ID_MAP[29] = "minecraft:sticky_piston";
ID_MAP[30] = "minecraft:web";
ID_MAP[31] = "minecraft:tallgrass";
ID_MAP[32] = "minecraft:deadbush";
ID_MAP[33] = "minecraft:piston";
ID_MAP[35] = "minecraft:wool";
ID_MAP[37] = "minecraft:yellow_flower";
ID_MAP[38] = "minecraft:red_flower";
ID_MAP[39] = "minecraft:brown_mushroom";
ID_MAP[40] = "minecraft:red_mushroom";
ID_MAP[41] = "minecraft:gold_block";
ID_MAP[42] = "minecraft:iron_block";
ID_MAP[43] = "minecraft:double_stone_slab";
ID_MAP[44] = "minecraft:stone_slab";
ID_MAP[45] = "minecraft:brick_block";
ID_MAP[46] = "minecraft:tnt";
ID_MAP[47] = "minecraft:bookshelf";
ID_MAP[48] = "minecraft:mossy_cobblestone";
ID_MAP[49] = "minecraft:obsidian";
ID_MAP[50] = "minecraft:torch";
ID_MAP[51] = "minecraft:fire";
ID_MAP[52] = "minecraft:mob_spawner";
ID_MAP[53] = "minecraft:oak_stairs";
ID_MAP[54] = "minecraft:chest";
ID_MAP[56] = "minecraft:diamond_ore";
ID_MAP[57] = "minecraft:diamond_block";
ID_MAP[58] = "minecraft:crafting_table";
ID_MAP[60] = "minecraft:farmland";
ID_MAP[61] = "minecraft:furnace";
ID_MAP[62] = "minecraft:lit_furnace";
ID_MAP[65] = "minecraft:ladder";
ID_MAP[66] = "minecraft:rail";
ID_MAP[67] = "minecraft:stone_stairs";
ID_MAP[69] = "minecraft:lever";
ID_MAP[70] = "minecraft:stone_pressure_plate";
ID_MAP[72] = "minecraft:wooden_pressure_plate";
ID_MAP[73] = "minecraft:redstone_ore";
ID_MAP[76] = "minecraft:redstone_torch";
ID_MAP[77] = "minecraft:stone_button";
ID_MAP[78] = "minecraft:snow_layer";
ID_MAP[79] = "minecraft:ice";
ID_MAP[80] = "minecraft:snow";
ID_MAP[81] = "minecraft:cactus";
ID_MAP[82] = "minecraft:clay";
ID_MAP[84] = "minecraft:jukebox";
ID_MAP[85] = "minecraft:fence";
ID_MAP[86] = "minecraft:pumpkin";
ID_MAP[87] = "minecraft:netherrack";
ID_MAP[88] = "minecraft:soul_sand";
ID_MAP[89] = "minecraft:glowstone";
ID_MAP[90] = "minecraft:portal";
ID_MAP[91] = "minecraft:lit_pumpkin";
ID_MAP[95] = "minecraft:stained_glass";
ID_MAP[96] = "minecraft:trapdoor";
ID_MAP[97] = "minecraft:monster_egg";
ID_MAP[98] = "minecraft:stonebrick";
ID_MAP[99] = "minecraft:brown_mushroom_block";
ID_MAP[100] = "minecraft:red_mushroom_block";
ID_MAP[101] = "minecraft:iron_bars";
ID_MAP[102] = "minecraft:glass_pane";
ID_MAP[103] = "minecraft:melon_block";
ID_MAP[106] = "minecraft:vine";
ID_MAP[107] = "minecraft:fence_gate";
ID_MAP[108] = "minecraft:brick_stairs";
ID_MAP[109] = "minecraft:stone_brick_stairs";
ID_MAP[110] = "minecraft:mycelium";
ID_MAP[111] = "minecraft:waterlily";
ID_MAP[112] = "minecraft:nether_brick";
ID_MAP[113] = "minecraft:nether_brick_fence";
ID_MAP[114] = "minecraft:nether_brick_stairs";
ID_MAP[116] = "minecraft:enchanting_table";
ID_MAP[119] = "minecraft:end_portal";
ID_MAP[120] = "minecraft:end_portal_frame";
ID_MAP[121] = "minecraft:end_stone";
ID_MAP[122] = "minecraft:dragon_egg";
ID_MAP[123] = "minecraft:redstone_lamp";
ID_MAP[125] = "minecraft:double_wooden_slab";
ID_MAP[126] = "minecraft:wooden_slab";
ID_MAP[127] = "minecraft:cocoa";
ID_MAP[128] = "minecraft:sandstone_stairs";
ID_MAP[129] = "minecraft:emerald_ore";
ID_MAP[130] = "minecraft:ender_chest";
ID_MAP[131] = "minecraft:tripwire_hook";
ID_MAP[133] = "minecraft:emerald_block";
ID_MAP[134] = "minecraft:spruce_stairs";
ID_MAP[135] = "minecraft:birch_stairs";
ID_MAP[136] = "minecraft:jungle_stairs";
ID_MAP[137] = "minecraft:command_block";
ID_MAP[138] = "minecraft:beacon";
ID_MAP[139] = "minecraft:cobblestone_wall";
ID_MAP[141] = "minecraft:carrots";
ID_MAP[142] = "minecraft:potatoes";
ID_MAP[143] = "minecraft:wooden_button";
ID_MAP[145] = "minecraft:anvil";
ID_MAP[146] = "minecraft:trapped_chest";
ID_MAP[147] = "minecraft:light_weighted_pressure_plate";
ID_MAP[148] = "minecraft:heavy_weighted_pressure_plate";
ID_MAP[151] = "minecraft:daylight_detector";
ID_MAP[152] = "minecraft:redstone_block";
ID_MAP[153] = "minecraft:quartz_ore";
ID_MAP[154] = "minecraft:hopper";
ID_MAP[155] = "minecraft:quartz_block";
ID_MAP[156] = "minecraft:quartz_stairs";
ID_MAP[157] = "minecraft:activator_rail";
ID_MAP[158] = "minecraft:dropper";
ID_MAP[159] = "minecraft:stained_hardened_clay";
ID_MAP[160] = "minecraft:stained_glass_pane";
ID_MAP[161] = "minecraft:leaves2";
ID_MAP[162] = "minecraft:log2";
ID_MAP[163] = "minecraft:acacia_stairs";
ID_MAP[164] = "minecraft:dark_oak_stairs";
ID_MAP[170] = "minecraft:hay_block";
ID_MAP[171] = "minecraft:carpet";
ID_MAP[172] = "minecraft:hardened_clay";
ID_MAP[173] = "minecraft:coal_block";
ID_MAP[174] = "minecraft:packed_ice";
ID_MAP[175] = "minecraft:double_plant";
ID_MAP[256] = "minecraft:iron_shovel";
ID_MAP[257] = "minecraft:iron_pickaxe";
ID_MAP[258] = "minecraft:iron_axe";
ID_MAP[259] = "minecraft:flint_and_steel";
ID_MAP[260] = "minecraft:apple";
ID_MAP[261] = "minecraft:bow";
ID_MAP[262] = "minecraft:arrow";
ID_MAP[263] = "minecraft:coal";
ID_MAP[264] = "minecraft:diamond";
ID_MAP[265] = "minecraft:iron_ingot";
ID_MAP[266] = "minecraft:gold_ingot";
ID_MAP[267] = "minecraft:iron_sword";
ID_MAP[268] = "minecraft:wooden_sword";
ID_MAP[269] = "minecraft:wooden_shovel";
ID_MAP[270] = "minecraft:wooden_pickaxe";
ID_MAP[271] = "minecraft:wooden_axe";
ID_MAP[272] = "minecraft:stone_sword";
ID_MAP[273] = "minecraft:stone_shovel";
ID_MAP[274] = "minecraft:stone_pickaxe";
ID_MAP[275] = "minecraft:stone_axe";
ID_MAP[276] = "minecraft:diamond_sword";
ID_MAP[277] = "minecraft:diamond_shovel";
ID_MAP[278] = "minecraft:diamond_pickaxe";
ID_MAP[279] = "minecraft:diamond_axe";
ID_MAP[280] = "minecraft:stick";
ID_MAP[281] = "minecraft:bowl";
ID_MAP[282] = "minecraft:mushroom_stew";
ID_MAP[283] = "minecraft:golden_sword";
ID_MAP[284] = "minecraft:golden_shovel";
ID_MAP[285] = "minecraft:golden_pickaxe";
ID_MAP[286] = "minecraft:golden_axe";
ID_MAP[287] = "minecraft:string";
ID_MAP[288] = "minecraft:feather";
ID_MAP[289] = "minecraft:gunpowder";
ID_MAP[290] = "minecraft:wooden_hoe";
ID_MAP[291] = "minecraft:stone_hoe";
ID_MAP[292] = "minecraft:iron_hoe";
ID_MAP[293] = "minecraft:diamond_hoe";
ID_MAP[294] = "minecraft:golden_hoe";
ID_MAP[295] = "minecraft:wheat_seeds";
ID_MAP[296] = "minecraft:wheat";
ID_MAP[297] = "minecraft:bread";
ID_MAP[298] = "minecraft:leather_helmet";
ID_MAP[299] = "minecraft:leather_chestplate";
ID_MAP[300] = "minecraft:leather_leggings";
ID_MAP[301] = "minecraft:leather_boots";
ID_MAP[302] = "minecraft:chainmail_helmet";
ID_MAP[303] = "minecraft:chainmail_chestplate";
ID_MAP[304] = "minecraft:chainmail_leggings";
ID_MAP[305] = "minecraft:chainmail_boots";
ID_MAP[306] = "minecraft:iron_helmet";
ID_MAP[307] = "minecraft:iron_chestplate";
ID_MAP[308] = "minecraft:iron_leggings";
ID_MAP[309] = "minecraft:iron_boots";
ID_MAP[310] = "minecraft:diamond_helmet";
ID_MAP[311] = "minecraft:diamond_chestplate";
ID_MAP[312] = "minecraft:diamond_leggings";
ID_MAP[313] = "minecraft:diamond_boots";
ID_MAP[314] = "minecraft:golden_helmet";
ID_MAP[315] = "minecraft:golden_chestplate";
ID_MAP[316] = "minecraft:golden_leggings";
ID_MAP[317] = "minecraft:golden_boots";
ID_MAP[318] = "minecraft:flint";
ID_MAP[319] = "minecraft:porkchop";
ID_MAP[320] = "minecraft:cooked_porkchop";
ID_MAP[321] = "minecraft:painting";
ID_MAP[322] = "minecraft:golden_apple";
ID_MAP[323] = "minecraft:sign";
ID_MAP[324] = "minecraft:wooden_door";
ID_MAP[325] = "minecraft:bucket";
ID_MAP[326] = "minecraft:water_bucket";
ID_MAP[327] = "minecraft:lava_bucket";
ID_MAP[328] = "minecraft:minecart";
ID_MAP[329] = "minecraft:saddle";
ID_MAP[330] = "minecraft:iron_door";
ID_MAP[331] = "minecraft:redstone";
ID_MAP[332] = "minecraft:snowball";
ID_MAP[333] = "minecraft:boat";
ID_MAP[334] = "minecraft:leather";
ID_MAP[335] = "minecraft:milk_bucket";
ID_MAP[336] = "minecraft:brick";
ID_MAP[337] = "minecraft:clay_ball";
ID_MAP[338] = "minecraft:reeds";
ID_MAP[339] = "minecraft:paper";
ID_MAP[340] = "minecraft:book";
ID_MAP[341] = "minecraft:slime_ball";
ID_MAP[342] = "minecraft:chest_minecart";
ID_MAP[343] = "minecraft:furnace_minecart";
ID_MAP[344] = "minecraft:egg";
ID_MAP[345] = "minecraft:compass";
ID_MAP[346] = "minecraft:fishing_rod";
ID_MAP[347] = "minecraft:clock";
ID_MAP[348] = "minecraft:glowstone_dust";
ID_MAP[349] = "minecraft:fish";
ID_MAP[350] = "minecraft:cooked_fished";
ID_MAP[351] = "minecraft:dye";
ID_MAP[352] = "minecraft:bone";
ID_MAP[353] = "minecraft:sugar";
ID_MAP[354] = "minecraft:cake";
ID_MAP[355] = "minecraft:bed";
ID_MAP[356] = "minecraft:repeater";
ID_MAP[357] = "minecraft:cookie";
ID_MAP[358] = "minecraft:filled_map";
ID_MAP[359] = "minecraft:shears";
ID_MAP[360] = "minecraft:melon";
ID_MAP[361] = "minecraft:pumpkin_seeds";
ID_MAP[362] = "minecraft:melon_seeds";
ID_MAP[363] = "minecraft:beef";
ID_MAP[364] = "minecraft:cooked_beef";
ID_MAP[365] = "minecraft:chicken";
ID_MAP[366] = "minecraft:cooked_chicken";
ID_MAP[367] = "minecraft:rotten_flesh";
ID_MAP[368] = "minecraft:ender_pearl";
ID_MAP[369] = "minecraft:blaze_rod";
ID_MAP[370] = "minecraft:ghast_tear";
ID_MAP[371] = "minecraft:gold_nugget";
ID_MAP[372] = "minecraft:nether_wart";
ID_MAP[373] = "minecraft:potion";
ID_MAP[374] = "minecraft:glass_bottle";
ID_MAP[375] = "minecraft:spider_eye";
ID_MAP[376] = "minecraft:fermented_spider_eye";
ID_MAP[377] = "minecraft:blaze_powder";
ID_MAP[378] = "minecraft:magma_cream";
ID_MAP[379] = "minecraft:brewing_stand";
ID_MAP[380] = "minecraft:cauldron";
ID_MAP[381] = "minecraft:ender_eye";
ID_MAP[382] = "minecraft:speckled_melon";
ID_MAP[383] = "minecraft:spawn_egg";
ID_MAP[384] = "minecraft:experience_bottle";
ID_MAP[385] = "minecraft:fire_charge";
ID_MAP[386] = "minecraft:writable_book";
ID_MAP[387] = "minecraft:written_book";
ID_MAP[388] = "minecraft:emerald";
ID_MAP[389] = "minecraft:item_frame";
ID_MAP[390] = "minecraft:flower_pot";
ID_MAP[391] = "minecraft:carrot";
ID_MAP[392] = "minecraft:potato";
ID_MAP[393] = "minecraft:baked_potato";
ID_MAP[394] = "minecraft:poisonous_potato";
ID_MAP[395] = "minecraft:map";
ID_MAP[396] = "minecraft:golden_carrot";
ID_MAP[397] = "minecraft:skull";
ID_MAP[398] = "minecraft:carrot_on_a_stick";
ID_MAP[399] = "minecraft:nether_star";
ID_MAP[400] = "minecraft:pumpkin_pie";
ID_MAP[401] = "minecraft:fireworks";
ID_MAP[402] = "minecraft:firework_charge";
ID_MAP[403] = "minecraft:enchanted_book";
ID_MAP[404] = "minecraft:comparator";
ID_MAP[405] = "minecraft:netherbrick";
ID_MAP[406] = "minecraft:quartz";
ID_MAP[407] = "minecraft:tnt_minecart";
ID_MAP[408] = "minecraft:hopper_minecart";
ID_MAP[417] = "minecraft:iron_horse_armor";
ID_MAP[418] = "minecraft:golden_horse_armor";
ID_MAP[419] = "minecraft:diamond_horse_armor";
ID_MAP[420] = "minecraft:lead";
ID_MAP[421] = "minecraft:name_tag";
ID_MAP[422] = "minecraft:command_block_minecart";
ID_MAP[2256] = "minecraft:record_13";
ID_MAP[2257] = "minecraft:record_cat";
ID_MAP[2258] = "minecraft:record_blocks";
ID_MAP[2259] = "minecraft:record_chirp";
ID_MAP[2260] = "minecraft:record_far";
ID_MAP[2261] = "minecraft:record_mall";
ID_MAP[2262] = "minecraft:record_mellohi";
ID_MAP[2263] = "minecraft:record_stal";
ID_MAP[2264] = "minecraft:record_strad";
ID_MAP[2265] = "minecraft:record_ward";
ID_MAP[2266] = "minecraft:record_11";
ID_MAP[2267] = "minecraft:record_wait";
}
}

View File

@@ -0,0 +1,35 @@
package net.minecraft.util.datafix.fixes;
import com.google.common.collect.Lists;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class MinecartEntityTypes implements IFixableData
{
private static final List<String> MINECART_TYPE_LIST = Lists.newArrayList("MinecartRideable", "MinecartChest", "MinecartFurnace", "MinecartTNT", "MinecartSpawner", "MinecartHopper", "MinecartCommandBlock");
public int getFixVersion()
{
return 106;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("Minecart".equals(compound.getString("id")))
{
String s = "MinecartRideable";
int i = compound.getInteger("Type");
if (i > 0 && i < MINECART_TYPE_LIST.size())
{
s = MINECART_TYPE_LIST.get(i);
}
compound.setString("id", s);
compound.removeTag("Type");
}
return compound;
}
}

View File

@@ -0,0 +1,23 @@
package net.minecraft.util.datafix.fixes;
import java.util.Locale;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class OptionsLowerCaseLanguage implements IFixableData
{
public int getFixVersion()
{
return 816;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if (compound.hasKey("lang", 8))
{
compound.setString("lang", compound.getString("lang").toLowerCase(Locale.ROOT));
}
return compound;
}
}

View File

@@ -0,0 +1,48 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.datafix.IFixableData;
public class PaintingDirection implements IFixableData
{
public int getFixVersion()
{
return 111;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
String s = compound.getString("id");
boolean flag = "Painting".equals(s);
boolean flag1 = "ItemFrame".equals(s);
if ((flag || flag1) && !compound.hasKey("Facing", 99))
{
EnumFacing enumfacing;
if (compound.hasKey("Direction", 99))
{
enumfacing = EnumFacing.getHorizontal(compound.getByte("Direction"));
compound.setInteger("TileX", compound.getInteger("TileX") + enumfacing.getFrontOffsetX());
compound.setInteger("TileY", compound.getInteger("TileY") + enumfacing.getFrontOffsetY());
compound.setInteger("TileZ", compound.getInteger("TileZ") + enumfacing.getFrontOffsetZ());
compound.removeTag("Direction");
if (flag1 && compound.hasKey("ItemRotation", 99))
{
compound.setByte("ItemRotation", (byte)(compound.getByte("ItemRotation") * 2));
}
}
else
{
enumfacing = EnumFacing.getHorizontal(compound.getByte("Dir"));
compound.removeTag("Dir");
}
compound.setByte("Facing", (byte)enumfacing.getHorizontalIndex());
}
return compound;
}
}

View File

@@ -0,0 +1,174 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class PotionItems implements IFixableData
{
private static final String[] POTION_IDS = new String[128];
public int getFixVersion()
{
return 102;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("minecraft:potion".equals(compound.getString("id")))
{
NBTTagCompound nbttagcompound = compound.getCompoundTag("tag");
short short1 = compound.getShort("Damage");
if (!nbttagcompound.hasKey("Potion", 8))
{
String s = POTION_IDS[short1 & 127];
nbttagcompound.setString("Potion", s == null ? "minecraft:water" : s);
compound.setTag("tag", nbttagcompound);
if ((short1 & 16384) == 16384)
{
compound.setString("id", "minecraft:splash_potion");
}
}
if (short1 != 0)
{
compound.setShort("Damage", (short)0);
}
}
return compound;
}
static
{
POTION_IDS[0] = "minecraft:water";
POTION_IDS[1] = "minecraft:regeneration";
POTION_IDS[2] = "minecraft:swiftness";
POTION_IDS[3] = "minecraft:fire_resistance";
POTION_IDS[4] = "minecraft:poison";
POTION_IDS[5] = "minecraft:healing";
POTION_IDS[6] = "minecraft:night_vision";
POTION_IDS[7] = null;
POTION_IDS[8] = "minecraft:weakness";
POTION_IDS[9] = "minecraft:strength";
POTION_IDS[10] = "minecraft:slowness";
POTION_IDS[11] = "minecraft:leaping";
POTION_IDS[12] = "minecraft:harming";
POTION_IDS[13] = "minecraft:water_breathing";
POTION_IDS[14] = "minecraft:invisibility";
POTION_IDS[15] = null;
POTION_IDS[16] = "minecraft:awkward";
POTION_IDS[17] = "minecraft:regeneration";
POTION_IDS[18] = "minecraft:swiftness";
POTION_IDS[19] = "minecraft:fire_resistance";
POTION_IDS[20] = "minecraft:poison";
POTION_IDS[21] = "minecraft:healing";
POTION_IDS[22] = "minecraft:night_vision";
POTION_IDS[23] = null;
POTION_IDS[24] = "minecraft:weakness";
POTION_IDS[25] = "minecraft:strength";
POTION_IDS[26] = "minecraft:slowness";
POTION_IDS[27] = "minecraft:leaping";
POTION_IDS[28] = "minecraft:harming";
POTION_IDS[29] = "minecraft:water_breathing";
POTION_IDS[30] = "minecraft:invisibility";
POTION_IDS[31] = null;
POTION_IDS[32] = "minecraft:thick";
POTION_IDS[33] = "minecraft:strong_regeneration";
POTION_IDS[34] = "minecraft:strong_swiftness";
POTION_IDS[35] = "minecraft:fire_resistance";
POTION_IDS[36] = "minecraft:strong_poison";
POTION_IDS[37] = "minecraft:strong_healing";
POTION_IDS[38] = "minecraft:night_vision";
POTION_IDS[39] = null;
POTION_IDS[40] = "minecraft:weakness";
POTION_IDS[41] = "minecraft:strong_strength";
POTION_IDS[42] = "minecraft:slowness";
POTION_IDS[43] = "minecraft:strong_leaping";
POTION_IDS[44] = "minecraft:strong_harming";
POTION_IDS[45] = "minecraft:water_breathing";
POTION_IDS[46] = "minecraft:invisibility";
POTION_IDS[47] = null;
POTION_IDS[48] = null;
POTION_IDS[49] = "minecraft:strong_regeneration";
POTION_IDS[50] = "minecraft:strong_swiftness";
POTION_IDS[51] = "minecraft:fire_resistance";
POTION_IDS[52] = "minecraft:strong_poison";
POTION_IDS[53] = "minecraft:strong_healing";
POTION_IDS[54] = "minecraft:night_vision";
POTION_IDS[55] = null;
POTION_IDS[56] = "minecraft:weakness";
POTION_IDS[57] = "minecraft:strong_strength";
POTION_IDS[58] = "minecraft:slowness";
POTION_IDS[59] = "minecraft:strong_leaping";
POTION_IDS[60] = "minecraft:strong_harming";
POTION_IDS[61] = "minecraft:water_breathing";
POTION_IDS[62] = "minecraft:invisibility";
POTION_IDS[63] = null;
POTION_IDS[64] = "minecraft:mundane";
POTION_IDS[65] = "minecraft:long_regeneration";
POTION_IDS[66] = "minecraft:long_swiftness";
POTION_IDS[67] = "minecraft:long_fire_resistance";
POTION_IDS[68] = "minecraft:long_poison";
POTION_IDS[69] = "minecraft:healing";
POTION_IDS[70] = "minecraft:long_night_vision";
POTION_IDS[71] = null;
POTION_IDS[72] = "minecraft:long_weakness";
POTION_IDS[73] = "minecraft:long_strength";
POTION_IDS[74] = "minecraft:long_slowness";
POTION_IDS[75] = "minecraft:long_leaping";
POTION_IDS[76] = "minecraft:harming";
POTION_IDS[77] = "minecraft:long_water_breathing";
POTION_IDS[78] = "minecraft:long_invisibility";
POTION_IDS[79] = null;
POTION_IDS[80] = "minecraft:awkward";
POTION_IDS[81] = "minecraft:long_regeneration";
POTION_IDS[82] = "minecraft:long_swiftness";
POTION_IDS[83] = "minecraft:long_fire_resistance";
POTION_IDS[84] = "minecraft:long_poison";
POTION_IDS[85] = "minecraft:healing";
POTION_IDS[86] = "minecraft:long_night_vision";
POTION_IDS[87] = null;
POTION_IDS[88] = "minecraft:long_weakness";
POTION_IDS[89] = "minecraft:long_strength";
POTION_IDS[90] = "minecraft:long_slowness";
POTION_IDS[91] = "minecraft:long_leaping";
POTION_IDS[92] = "minecraft:harming";
POTION_IDS[93] = "minecraft:long_water_breathing";
POTION_IDS[94] = "minecraft:long_invisibility";
POTION_IDS[95] = null;
POTION_IDS[96] = "minecraft:thick";
POTION_IDS[97] = "minecraft:regeneration";
POTION_IDS[98] = "minecraft:swiftness";
POTION_IDS[99] = "minecraft:long_fire_resistance";
POTION_IDS[100] = "minecraft:poison";
POTION_IDS[101] = "minecraft:strong_healing";
POTION_IDS[102] = "minecraft:long_night_vision";
POTION_IDS[103] = null;
POTION_IDS[104] = "minecraft:long_weakness";
POTION_IDS[105] = "minecraft:strength";
POTION_IDS[106] = "minecraft:long_slowness";
POTION_IDS[107] = "minecraft:leaping";
POTION_IDS[108] = "minecraft:strong_harming";
POTION_IDS[109] = "minecraft:long_water_breathing";
POTION_IDS[110] = "minecraft:long_invisibility";
POTION_IDS[111] = null;
POTION_IDS[112] = null;
POTION_IDS[113] = "minecraft:regeneration";
POTION_IDS[114] = "minecraft:swiftness";
POTION_IDS[115] = "minecraft:long_fire_resistance";
POTION_IDS[116] = "minecraft:poison";
POTION_IDS[117] = "minecraft:strong_healing";
POTION_IDS[118] = "minecraft:long_night_vision";
POTION_IDS[119] = null;
POTION_IDS[120] = "minecraft:long_weakness";
POTION_IDS[121] = "minecraft:strength";
POTION_IDS[122] = "minecraft:long_slowness";
POTION_IDS[123] = "minecraft:leaping";
POTION_IDS[124] = "minecraft:strong_harming";
POTION_IDS[125] = "minecraft:long_water_breathing";
POTION_IDS[126] = "minecraft:long_invisibility";
POTION_IDS[127] = null;
}
}

View File

@@ -0,0 +1,34 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class PotionWater implements IFixableData
{
public int getFixVersion()
{
return 806;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
String s = compound.getString("id");
if ("minecraft:potion".equals(s) || "minecraft:splash_potion".equals(s) || "minecraft:lingering_potion".equals(s) || "minecraft:tipped_arrow".equals(s))
{
NBTTagCompound nbttagcompound = compound.getCompoundTag("tag");
if (!nbttagcompound.hasKey("Potion", 8))
{
nbttagcompound.setString("Potion", "minecraft:water");
}
if (!compound.hasKey("tag", 10))
{
compound.setTag("tag", nbttagcompound);
}
}
return compound;
}
}

View File

@@ -0,0 +1,38 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.datafix.IFixableData;
public class RedundantChanceTags implements IFixableData
{
public int getFixVersion()
{
return 113;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if (compound.hasKey("HandDropChances", 9))
{
NBTTagList nbttaglist = compound.getTagList("HandDropChances", 5);
if (nbttaglist.tagCount() == 2 && nbttaglist.getFloatAt(0) == 0.0F && nbttaglist.getFloatAt(1) == 0.0F)
{
compound.removeTag("HandDropChances");
}
}
if (compound.hasKey("ArmorDropChances", 9))
{
NBTTagList nbttaglist1 = compound.getTagList("ArmorDropChances", 5);
if (nbttaglist1.tagCount() == 4 && nbttaglist1.getFloatAt(0) == 0.0F && nbttaglist1.getFloatAt(1) == 0.0F && nbttaglist1.getFloatAt(2) == 0.0F && nbttaglist1.getFloatAt(3) == 0.0F)
{
compound.removeTag("ArmorDropChances");
}
}
return compound;
}
}

View File

@@ -0,0 +1,39 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.datafix.IFixableData;
public class RidingToPassengers implements IFixableData
{
public int getFixVersion()
{
return 135;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
while (compound.hasKey("Riding", 10))
{
NBTTagCompound nbttagcompound = this.extractVehicle(compound);
this.addPassengerToVehicle(compound, nbttagcompound);
compound = nbttagcompound;
}
return compound;
}
protected void addPassengerToVehicle(NBTTagCompound p_188219_1_, NBTTagCompound p_188219_2_)
{
NBTTagList nbttaglist = new NBTTagList();
nbttaglist.appendTag(p_188219_1_);
p_188219_2_.setTag("Passengers", nbttaglist);
}
protected NBTTagCompound extractVehicle(NBTTagCompound p_188220_1_)
{
NBTTagCompound nbttagcompound = p_188220_1_.getCompoundTag("Riding");
p_188220_1_.removeTag("Riding");
return nbttagcompound;
}
}

View File

@@ -0,0 +1,22 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class ShulkerBoxEntityColor implements IFixableData
{
public int getFixVersion()
{
return 808;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("minecraft:shulker".equals(compound.getString("id")) && !compound.hasKey("Color", 99))
{
compound.setByte("Color", (byte)10);
}
return compound;
}
}

View File

@@ -0,0 +1,49 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class ShulkerBoxItemColor implements IFixableData
{
public static final String[] NAMES_BY_COLOR = new String[] {"minecraft:white_shulker_box", "minecraft:orange_shulker_box", "minecraft:magenta_shulker_box", "minecraft:light_blue_shulker_box", "minecraft:yellow_shulker_box", "minecraft:lime_shulker_box", "minecraft:pink_shulker_box", "minecraft:gray_shulker_box", "minecraft:silver_shulker_box", "minecraft:cyan_shulker_box", "minecraft:purple_shulker_box", "minecraft:blue_shulker_box", "minecraft:brown_shulker_box", "minecraft:green_shulker_box", "minecraft:red_shulker_box", "minecraft:black_shulker_box"};
public int getFixVersion()
{
return 813;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("minecraft:shulker_box".equals(compound.getString("id")) && compound.hasKey("tag", 10))
{
NBTTagCompound nbttagcompound = compound.getCompoundTag("tag");
if (nbttagcompound.hasKey("BlockEntityTag", 10))
{
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("BlockEntityTag");
if (nbttagcompound1.getTagList("Items", 10).hasNoTags())
{
nbttagcompound1.removeTag("Items");
}
int i = nbttagcompound1.getInteger("Color");
nbttagcompound1.removeTag("Color");
if (nbttagcompound1.hasNoTags())
{
nbttagcompound.removeTag("BlockEntityTag");
}
if (nbttagcompound.hasNoTags())
{
compound.removeTag("tag");
}
compound.setString("id", NAMES_BY_COLOR[i % 16]);
}
}
return compound;
}
}

View File

@@ -0,0 +1,22 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class ShulkerBoxTileColor implements IFixableData
{
public int getFixVersion()
{
return 813;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("minecraft:shulker".equals(compound.getString("id")))
{
compound.removeTag("Color");
}
return compound;
}
}

View File

@@ -0,0 +1,138 @@
package net.minecraft.util.datafix.fixes;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import java.lang.reflect.Type;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.JsonUtils;
import net.minecraft.util.StringUtils;
import net.minecraft.util.datafix.IFixableData;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
public class SignStrictJSON implements IFixableData
{
public static final Gson GSON_INSTANCE = (new GsonBuilder()).registerTypeAdapter(ITextComponent.class, new JsonDeserializer<ITextComponent>()
{
public ITextComponent deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
if (p_deserialize_1_.isJsonPrimitive())
{
return new TextComponentString(p_deserialize_1_.getAsString());
}
else if (p_deserialize_1_.isJsonArray())
{
JsonArray jsonarray = p_deserialize_1_.getAsJsonArray();
ITextComponent itextcomponent = null;
for (JsonElement jsonelement : jsonarray)
{
ITextComponent itextcomponent1 = this.deserialize(jsonelement, jsonelement.getClass(), p_deserialize_3_);
if (itextcomponent == null)
{
itextcomponent = itextcomponent1;
}
else
{
itextcomponent.appendSibling(itextcomponent1);
}
}
return itextcomponent;
}
else
{
throw new JsonParseException("Don't know how to turn " + p_deserialize_1_ + " into a Component");
}
}
}).create();
public int getFixVersion()
{
return 101;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("Sign".equals(compound.getString("id")))
{
this.updateLine(compound, "Text1");
this.updateLine(compound, "Text2");
this.updateLine(compound, "Text3");
this.updateLine(compound, "Text4");
}
return compound;
}
private void updateLine(NBTTagCompound compound, String key)
{
String s = compound.getString(key);
ITextComponent itextcomponent = null;
if (!"null".equals(s) && !StringUtils.isNullOrEmpty(s))
{
if (s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"' || s.charAt(0) == '{' && s.charAt(s.length() - 1) == '}')
{
try
{
itextcomponent = (ITextComponent)JsonUtils.gsonDeserialize(GSON_INSTANCE, s, ITextComponent.class, true);
if (itextcomponent == null)
{
itextcomponent = new TextComponentString("");
}
}
catch (JsonParseException var8)
{
;
}
if (itextcomponent == null)
{
try
{
itextcomponent = ITextComponent.Serializer.jsonToComponent(s);
}
catch (JsonParseException var7)
{
;
}
}
if (itextcomponent == null)
{
try
{
itextcomponent = ITextComponent.Serializer.fromJsonLenient(s);
}
catch (JsonParseException var6)
{
;
}
}
if (itextcomponent == null)
{
itextcomponent = new TextComponentString(s);
}
}
else
{
itextcomponent = new TextComponentString(s);
}
}
else
{
itextcomponent = new TextComponentString("");
}
compound.setString(key, ITextComponent.Serializer.componentToJson(itextcomponent));
}
}

View File

@@ -0,0 +1,35 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class SkeletonSplit implements IFixableData
{
public int getFixVersion()
{
return 701;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
String s = compound.getString("id");
if ("Skeleton".equals(s))
{
int i = compound.getInteger("SkeletonType");
if (i == 1)
{
compound.setString("id", "WitherSkeleton");
}
else if (i == 2)
{
compound.setString("id", "Stray");
}
compound.removeTag("SkeletonType");
}
return compound;
}
}

View File

@@ -0,0 +1,115 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class SpawnEggNames implements IFixableData
{
private static final String[] ENTITY_IDS = new String[256];
public int getFixVersion()
{
return 105;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("minecraft:spawn_egg".equals(compound.getString("id")))
{
NBTTagCompound nbttagcompound = compound.getCompoundTag("tag");
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("EntityTag");
short short1 = compound.getShort("Damage");
if (!nbttagcompound1.hasKey("id", 8))
{
String s = ENTITY_IDS[short1 & 255];
if (s != null)
{
nbttagcompound1.setString("id", s);
nbttagcompound.setTag("EntityTag", nbttagcompound1);
compound.setTag("tag", nbttagcompound);
}
}
if (short1 != 0)
{
compound.setShort("Damage", (short)0);
}
}
return compound;
}
static
{
String[] astring = ENTITY_IDS;
astring[1] = "Item";
astring[2] = "XPOrb";
astring[7] = "ThrownEgg";
astring[8] = "LeashKnot";
astring[9] = "Painting";
astring[10] = "Arrow";
astring[11] = "Snowball";
astring[12] = "Fireball";
astring[13] = "SmallFireball";
astring[14] = "ThrownEnderpearl";
astring[15] = "EyeOfEnderSignal";
astring[16] = "ThrownPotion";
astring[17] = "ThrownExpBottle";
astring[18] = "ItemFrame";
astring[19] = "WitherSkull";
astring[20] = "PrimedTnt";
astring[21] = "FallingSand";
astring[22] = "FireworksRocketEntity";
astring[23] = "TippedArrow";
astring[24] = "SpectralArrow";
astring[25] = "ShulkerBullet";
astring[26] = "DragonFireball";
astring[30] = "ArmorStand";
astring[41] = "Boat";
astring[42] = "MinecartRideable";
astring[43] = "MinecartChest";
astring[44] = "MinecartFurnace";
astring[45] = "MinecartTNT";
astring[46] = "MinecartHopper";
astring[47] = "MinecartSpawner";
astring[40] = "MinecartCommandBlock";
astring[48] = "Mob";
astring[49] = "Monster";
astring[50] = "Creeper";
astring[51] = "Skeleton";
astring[52] = "Spider";
astring[53] = "Giant";
astring[54] = "Zombie";
astring[55] = "Slime";
astring[56] = "Ghast";
astring[57] = "PigZombie";
astring[58] = "Enderman";
astring[59] = "CaveSpider";
astring[60] = "Silverfish";
astring[61] = "Blaze";
astring[62] = "LavaSlime";
astring[63] = "EnderDragon";
astring[64] = "WitherBoss";
astring[65] = "Bat";
astring[66] = "Witch";
astring[67] = "Endermite";
astring[68] = "Guardian";
astring[69] = "Shulker";
astring[90] = "Pig";
astring[91] = "Sheep";
astring[92] = "Cow";
astring[93] = "Chicken";
astring[94] = "Squid";
astring[95] = "Wolf";
astring[96] = "MushroomCow";
astring[97] = "SnowMan";
astring[98] = "Ozelot";
astring[99] = "VillagerGolem";
astring[100] = "EntityHorse";
astring[101] = "Rabbit";
astring[120] = "Villager";
astring[200] = "EnderCrystal";
}
}

View File

@@ -0,0 +1,53 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.datafix.IFixableData;
public class SpawnerEntityTypes implements IFixableData
{
public int getFixVersion()
{
return 107;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if (!"MobSpawner".equals(compound.getString("id")))
{
return compound;
}
else
{
if (compound.hasKey("EntityId", 8))
{
String s = compound.getString("EntityId");
NBTTagCompound nbttagcompound = compound.getCompoundTag("SpawnData");
nbttagcompound.setString("id", s.isEmpty() ? "Pig" : s);
compound.setTag("SpawnData", nbttagcompound);
compound.removeTag("EntityId");
}
if (compound.hasKey("SpawnPotentials", 9))
{
NBTTagList nbttaglist = compound.getTagList("SpawnPotentials", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
if (nbttagcompound1.hasKey("Type", 8))
{
NBTTagCompound nbttagcompound2 = nbttagcompound1.getCompoundTag("Properties");
nbttagcompound2.setString("id", nbttagcompound1.getString("Type"));
nbttagcompound1.setTag("Entity", nbttagcompound2);
nbttagcompound1.removeTag("Type");
nbttagcompound1.removeTag("Properties");
}
}
}
return compound;
}
}
}

View File

@@ -0,0 +1,23 @@
package net.minecraft.util.datafix.fixes;
import java.util.UUID;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class StringToUUID implements IFixableData
{
public int getFixVersion()
{
return 108;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if (compound.hasKey("UUID", 8))
{
compound.setUniqueId("UUID", UUID.fromString(compound.getString("UUID")));
}
return compound;
}
}

View File

@@ -0,0 +1,55 @@
package net.minecraft.util.datafix.fixes;
import com.google.common.collect.Maps;
import java.util.Map;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class TileEntityId implements IFixableData
{
private static final Map<String, String> OLD_TO_NEW_ID_MAP = Maps.<String, String>newHashMap();
public int getFixVersion()
{
return 704;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
String s = OLD_TO_NEW_ID_MAP.get(compound.getString("id"));
if (s != null)
{
compound.setString("id", s);
}
return compound;
}
static
{
OLD_TO_NEW_ID_MAP.put("Airportal", "minecraft:end_portal");
OLD_TO_NEW_ID_MAP.put("Banner", "minecraft:banner");
OLD_TO_NEW_ID_MAP.put("Beacon", "minecraft:beacon");
OLD_TO_NEW_ID_MAP.put("Cauldron", "minecraft:brewing_stand");
OLD_TO_NEW_ID_MAP.put("Chest", "minecraft:chest");
OLD_TO_NEW_ID_MAP.put("Comparator", "minecraft:comparator");
OLD_TO_NEW_ID_MAP.put("Control", "minecraft:command_block");
OLD_TO_NEW_ID_MAP.put("DLDetector", "minecraft:daylight_detector");
OLD_TO_NEW_ID_MAP.put("Dropper", "minecraft:dropper");
OLD_TO_NEW_ID_MAP.put("EnchantTable", "minecraft:enchanting_table");
OLD_TO_NEW_ID_MAP.put("EndGateway", "minecraft:end_gateway");
OLD_TO_NEW_ID_MAP.put("EnderChest", "minecraft:ender_chest");
OLD_TO_NEW_ID_MAP.put("FlowerPot", "minecraft:flower_pot");
OLD_TO_NEW_ID_MAP.put("Furnace", "minecraft:furnace");
OLD_TO_NEW_ID_MAP.put("Hopper", "minecraft:hopper");
OLD_TO_NEW_ID_MAP.put("MobSpawner", "minecraft:mob_spawner");
OLD_TO_NEW_ID_MAP.put("Music", "minecraft:noteblock");
OLD_TO_NEW_ID_MAP.put("Piston", "minecraft:piston");
OLD_TO_NEW_ID_MAP.put("RecordPlayer", "minecraft:jukebox");
OLD_TO_NEW_ID_MAP.put("Sign", "minecraft:sign");
OLD_TO_NEW_ID_MAP.put("Skull", "minecraft:skull");
OLD_TO_NEW_ID_MAP.put("Structure", "minecraft:structure_block");
OLD_TO_NEW_ID_MAP.put("Trap", "minecraft:dispenser");
}
}

View File

@@ -0,0 +1,22 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class TotemItemRename implements IFixableData
{
public int getFixVersion()
{
return 820;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("minecraft:totem".equals(compound.getString("id")))
{
compound.setString("id", "minecraft:totem_of_undying");
}
return compound;
}
}

View File

@@ -0,0 +1,54 @@
package net.minecraft.util.datafix.fixes;
import java.util.Random;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class ZombieProfToType implements IFixableData
{
private static final Random RANDOM = new Random();
public int getFixVersion()
{
return 502;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("Zombie".equals(compound.getString("id")) && compound.getBoolean("IsVillager"))
{
if (!compound.hasKey("ZombieType", 99))
{
int i = -1;
if (compound.hasKey("VillagerProfession", 99))
{
try
{
i = this.getVillagerProfession(compound.getInteger("VillagerProfession"));
}
catch (RuntimeException var4)
{
;
}
}
if (i == -1)
{
i = this.getVillagerProfession(RANDOM.nextInt(6));
}
compound.setInteger("ZombieType", i);
}
compound.removeTag("IsVillager");
}
return compound;
}
private int getVillagerProfession(int p_191277_1_)
{
return p_191277_1_ >= 0 && p_191277_1_ < 6 ? p_191277_1_ : -1;
}
}

View File

@@ -0,0 +1,41 @@
package net.minecraft.util.datafix.fixes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.IFixableData;
public class ZombieSplit implements IFixableData
{
public int getFixVersion()
{
return 702;
}
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
if ("Zombie".equals(compound.getString("id")))
{
int i = compound.getInteger("ZombieType");
switch (i)
{
case 0:
default:
break;
case 1:
case 2:
case 3:
case 4:
case 5:
compound.setString("id", "ZombieVillager");
compound.setInteger("Profession", i - 1);
break;
case 6:
compound.setString("id", "Husk");
}
compound.removeTag("ZombieType");
}
return compound;
}
}

View File

@@ -0,0 +1,7 @@
// Auto generated package-info by MCP
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package net.minecraft.util.datafix.fixes;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View File

@@ -0,0 +1,7 @@
// Auto generated package-info by MCP
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package net.minecraft.util.datafix;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View File

@@ -0,0 +1,157 @@
package net.minecraft.util.datafix.walkers;
import com.google.common.collect.Maps;
import java.util.Map;
import javax.annotation.Nullable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.datafix.FixTypes;
import net.minecraft.util.datafix.IDataFixer;
import net.minecraft.util.datafix.IDataWalker;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class BlockEntityTag implements IDataWalker
{
private static final Logger LOGGER = LogManager.getLogger();
private static final Map<String, String> NEW_TO_OLD_ID_MAP = Maps.<String, String>newHashMap();
private static final Map<String, String> ITEM_ID_TO_BLOCK_ENTITY_ID = Maps.<String, String>newHashMap();
@Nullable
private static String getBlockEntityID(int blockID, String p_188267_1_)
{
return blockID < 515 ? (String)NEW_TO_OLD_ID_MAP.get((new ResourceLocation(p_188267_1_)).toString()) : (String)ITEM_ID_TO_BLOCK_ENTITY_ID.get((new ResourceLocation(p_188267_1_)).toString());
}
public NBTTagCompound process(IDataFixer fixer, NBTTagCompound compound, int versionIn)
{
if (!compound.hasKey("tag", 10))
{
return compound;
}
else
{
NBTTagCompound nbttagcompound = compound.getCompoundTag("tag");
if (nbttagcompound.hasKey("BlockEntityTag", 10))
{
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("BlockEntityTag");
String s = compound.getString("id");
String s1 = getBlockEntityID(versionIn, s);
boolean flag;
if (s1 == null)
{
LOGGER.warn("Unable to resolve BlockEntity for ItemInstance: {}", (Object)s);
flag = false;
}
else
{
flag = !nbttagcompound1.hasKey("id");
nbttagcompound1.setString("id", s1);
}
fixer.process(FixTypes.BLOCK_ENTITY, nbttagcompound1, versionIn);
if (flag)
{
nbttagcompound1.removeTag("id");
}
}
return compound;
}
}
static
{
Map<String, String> map = NEW_TO_OLD_ID_MAP;
map.put("minecraft:furnace", "Furnace");
map.put("minecraft:lit_furnace", "Furnace");
map.put("minecraft:chest", "Chest");
map.put("minecraft:trapped_chest", "Chest");
map.put("minecraft:ender_chest", "EnderChest");
map.put("minecraft:jukebox", "RecordPlayer");
map.put("minecraft:dispenser", "Trap");
map.put("minecraft:dropper", "Dropper");
map.put("minecraft:sign", "Sign");
map.put("minecraft:mob_spawner", "MobSpawner");
map.put("minecraft:noteblock", "Music");
map.put("minecraft:brewing_stand", "Cauldron");
map.put("minecraft:enhanting_table", "EnchantTable");
map.put("minecraft:command_block", "CommandBlock");
map.put("minecraft:beacon", "Beacon");
map.put("minecraft:skull", "Skull");
map.put("minecraft:daylight_detector", "DLDetector");
map.put("minecraft:hopper", "Hopper");
map.put("minecraft:banner", "Banner");
map.put("minecraft:flower_pot", "FlowerPot");
map.put("minecraft:repeating_command_block", "CommandBlock");
map.put("minecraft:chain_command_block", "CommandBlock");
map.put("minecraft:standing_sign", "Sign");
map.put("minecraft:wall_sign", "Sign");
map.put("minecraft:piston_head", "Piston");
map.put("minecraft:daylight_detector_inverted", "DLDetector");
map.put("minecraft:unpowered_comparator", "Comparator");
map.put("minecraft:powered_comparator", "Comparator");
map.put("minecraft:wall_banner", "Banner");
map.put("minecraft:standing_banner", "Banner");
map.put("minecraft:structure_block", "Structure");
map.put("minecraft:end_portal", "Airportal");
map.put("minecraft:end_gateway", "EndGateway");
map.put("minecraft:shield", "Shield");
map = ITEM_ID_TO_BLOCK_ENTITY_ID;
map.put("minecraft:furnace", "minecraft:furnace");
map.put("minecraft:lit_furnace", "minecraft:furnace");
map.put("minecraft:chest", "minecraft:chest");
map.put("minecraft:trapped_chest", "minecraft:chest");
map.put("minecraft:ender_chest", "minecraft:enderchest");
map.put("minecraft:jukebox", "minecraft:jukebox");
map.put("minecraft:dispenser", "minecraft:dispenser");
map.put("minecraft:dropper", "minecraft:dropper");
map.put("minecraft:sign", "minecraft:sign");
map.put("minecraft:mob_spawner", "minecraft:mob_spawner");
map.put("minecraft:noteblock", "minecraft:noteblock");
map.put("minecraft:brewing_stand", "minecraft:brewing_stand");
map.put("minecraft:enhanting_table", "minecraft:enchanting_table");
map.put("minecraft:command_block", "minecraft:command_block");
map.put("minecraft:beacon", "minecraft:beacon");
map.put("minecraft:skull", "minecraft:skull");
map.put("minecraft:daylight_detector", "minecraft:daylight_detector");
map.put("minecraft:hopper", "minecraft:hopper");
map.put("minecraft:banner", "minecraft:banner");
map.put("minecraft:flower_pot", "minecraft:flower_pot");
map.put("minecraft:repeating_command_block", "minecraft:command_block");
map.put("minecraft:chain_command_block", "minecraft:command_block");
map.put("minecraft:shulker_box", "minecraft:shulker_box");
map.put("minecraft:white_shulker_box", "minecraft:shulker_box");
map.put("minecraft:orange_shulker_box", "minecraft:shulker_box");
map.put("minecraft:magenta_shulker_box", "minecraft:shulker_box");
map.put("minecraft:light_blue_shulker_box", "minecraft:shulker_box");
map.put("minecraft:yellow_shulker_box", "minecraft:shulker_box");
map.put("minecraft:lime_shulker_box", "minecraft:shulker_box");
map.put("minecraft:pink_shulker_box", "minecraft:shulker_box");
map.put("minecraft:gray_shulker_box", "minecraft:shulker_box");
map.put("minecraft:silver_shulker_box", "minecraft:shulker_box");
map.put("minecraft:cyan_shulker_box", "minecraft:shulker_box");
map.put("minecraft:purple_shulker_box", "minecraft:shulker_box");
map.put("minecraft:blue_shulker_box", "minecraft:shulker_box");
map.put("minecraft:brown_shulker_box", "minecraft:shulker_box");
map.put("minecraft:green_shulker_box", "minecraft:shulker_box");
map.put("minecraft:red_shulker_box", "minecraft:shulker_box");
map.put("minecraft:black_shulker_box", "minecraft:shulker_box");
map.put("minecraft:bed", "minecraft:bed");
map.put("minecraft:standing_sign", "minecraft:sign");
map.put("minecraft:wall_sign", "minecraft:sign");
map.put("minecraft:piston_head", "minecraft:piston");
map.put("minecraft:daylight_detector_inverted", "minecraft:daylight_detector");
map.put("minecraft:unpowered_comparator", "minecraft:comparator");
map.put("minecraft:powered_comparator", "minecraft:comparator");
map.put("minecraft:wall_banner", "minecraft:banner");
map.put("minecraft:standing_banner", "minecraft:banner");
map.put("minecraft:structure_block", "minecraft:structure_block");
map.put("minecraft:end_portal", "minecraft:end_portal");
map.put("minecraft:end_gateway", "minecraft:end_gateway");
map.put("minecraft:shield", "minecraft:shield");
}
}

View File

@@ -0,0 +1,61 @@
package net.minecraft.util.datafix.walkers;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.FixTypes;
import net.minecraft.util.datafix.IDataFixer;
import net.minecraft.util.datafix.IDataWalker;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class EntityTag implements IDataWalker
{
private static final Logger LOGGER = LogManager.getLogger();
public NBTTagCompound process(IDataFixer fixer, NBTTagCompound compound, int versionIn)
{
NBTTagCompound nbttagcompound = compound.getCompoundTag("tag");
if (nbttagcompound.hasKey("EntityTag", 10))
{
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("EntityTag");
String s = compound.getString("id");
String s1;
if ("minecraft:armor_stand".equals(s))
{
s1 = versionIn < 515 ? "ArmorStand" : "minecraft:armor_stand";
}
else
{
if (!"minecraft:spawn_egg".equals(s))
{
return compound;
}
s1 = nbttagcompound1.getString("id");
}
boolean flag;
if (s1 == null)
{
LOGGER.warn("Unable to resolve Entity for ItemInstance: {}", (Object)s);
flag = false;
}
else
{
flag = !nbttagcompound1.hasKey("id", 8);
nbttagcompound1.setString("id", s1);
}
fixer.process(FixTypes.ENTITY, nbttagcompound1, versionIn);
if (flag)
{
nbttagcompound1.removeTag("id");
}
}
return compound;
}
}

View File

@@ -0,0 +1,42 @@
package net.minecraft.util.datafix.walkers;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.datafix.IDataFixer;
import net.minecraft.util.datafix.IDataWalker;
public abstract class Filtered implements IDataWalker
{
private final ResourceLocation key;
public Filtered(Class<?> p_i47309_1_)
{
if (Entity.class.isAssignableFrom(p_i47309_1_))
{
this.key = EntityList.getKey((Class<Entity>)p_i47309_1_);
}
else if (TileEntity.class.isAssignableFrom(p_i47309_1_))
{
this.key = TileEntity.getKey((Class<TileEntity>)p_i47309_1_);
}
else
{
this.key = null;
}
}
public NBTTagCompound process(IDataFixer fixer, NBTTagCompound compound, int versionIn)
{
if ((new ResourceLocation(compound.getString("id"))).equals(this.key))
{
compound = this.filteredProcess(fixer, compound, versionIn);
}
return compound;
}
abstract NBTTagCompound filteredProcess(IDataFixer fixer, NBTTagCompound compound, int versionIn);
}

View File

@@ -0,0 +1,26 @@
package net.minecraft.util.datafix.walkers;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.DataFixesManager;
import net.minecraft.util.datafix.IDataFixer;
public class ItemStackData extends Filtered
{
private final String[] matchingTags;
public ItemStackData(Class<?> p_i47311_1_, String... matchingTagsIn)
{
super(p_i47311_1_);
this.matchingTags = matchingTagsIn;
}
NBTTagCompound filteredProcess(IDataFixer fixer, NBTTagCompound compound, int versionIn)
{
for (String s : this.matchingTags)
{
compound = DataFixesManager.processItemStack(fixer, compound, versionIn, s);
}
return compound;
}
}

View File

@@ -0,0 +1,26 @@
package net.minecraft.util.datafix.walkers;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.datafix.DataFixesManager;
import net.minecraft.util.datafix.IDataFixer;
public class ItemStackDataLists extends Filtered
{
private final String[] matchingTags;
public ItemStackDataLists(Class<?> p_i47310_1_, String... matchingTagsIn)
{
super(p_i47310_1_);
this.matchingTags = matchingTagsIn;
}
NBTTagCompound filteredProcess(IDataFixer fixer, NBTTagCompound compound, int versionIn)
{
for (String s : this.matchingTags)
{
compound = DataFixesManager.processInventory(fixer, compound, versionIn, s);
}
return compound;
}
}

View File

@@ -0,0 +1,7 @@
// Auto generated package-info by MCP
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package net.minecraft.util.datafix.walkers;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;