net.minecraft.util.datafix.DataFixer Java Examples

The following examples show how to use net.minecraft.util.datafix.DataFixer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TemplateManager.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static Template getBuiltinTemplate(World world, ResourceLocation templateId) {
    if (templateMap.containsKey(templateId)) {
        return templateMap.get(templateId);
    }
    Template template = new Template();
    String resourcePath = "/assets/" + templateId.getResourceDomain() + "/structures/" + templateId.getResourcePath() + ".nbt";
    InputStream inputStream = TemplateManager.class.getResourceAsStream(resourcePath);
    if (inputStream != null) {
        try {
            NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(inputStream);
            if (!nbttagcompound.hasKey("DataVersion", 99)) {
                nbttagcompound.setInteger("DataVersion", 500);
            }
            DataFixer dataFixer = world.getMinecraftServer().getDataFixer();
            template.read(dataFixer.process(FixTypes.STRUCTURE, nbttagcompound));
        } catch (IOException exception) {
            GTLog.logger.error("Failed to load builtin template {}", templateId, exception);
        } finally {
            IOUtils.closeQuietly(inputStream);
        }
    } else {
        GTLog.logger.warn("Failed to find builtin structure with path {}", resourcePath);
    }
    templateMap.put(templateId, template);
    return template;
}
 
Example #2
Source File: CommonProxy.java    From ToroQuest with GNU General Public License v3.0 6 votes vote down vote up
public void preInit(FMLPreInitializationEvent e) {
	//configDirectory = new File(e.getModConfigurationDirectory(), ToroQuest.MODID);
	ToolMaterials.init();
	initConfig(e.getSuggestedConfigurationFile());

	MinecraftForge.EVENT_BUS.register(new CivilizationGeneratorHandlers());
	MinecraftForge.EVENT_BUS.register(new EventHandlers());
	MinecraftForge.EVENT_BUS.register(new CivilizationHandlers());
	MinecraftForge.EVENT_BUS.register(new EntitySpawning());
	VillageHandlerKeep.init();
	// VillageHandlerTrophy.init();
	VillageHandlerShop.init();
	VillageHandlerGuardTower.init();
	VillageHandlerBarracks.init();
	ToroQuestPacketHandler.init();
	NetworkRegistry.INSTANCE.registerGuiHandler(ToroQuest.INSTANCE, new VillageLordGuiHandler());

	DataFixer datafixer = new DataFixer(922);
	EntityVillageLord.registerFixesVillageLord(datafixer);

	Quests.init();

}
 
Example #3
Source File: TemplateManagerEU.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
public TemplateManagerEU(File directory, DataFixer dataFixer)
{
    this.server = FMLCommonHandler.instance().getMinecraftServerInstance();
    this.templates = Maps.<String, TemplateEnderUtilities>newHashMap();
    this.templateMetas = Maps.<String, TemplateMetadata>newHashMap();
    this.directory = directory;
    this.fixer = dataFixer;
}
 
Example #4
Source File: EntityBlock.java    From OpenModsLib with MIT License 5 votes vote down vote up
public static void registerFixes(DataFixer fixers, final Class<? extends EntityBlock> cls) {
	fixers.registerWalker(FixTypes.ENTITY, (fixer, compound, versionIn) -> {
		if (EntityList.getKey(cls).equals(new ResourceLocation(compound.getString("id")))) {
			if (compound.hasKey(TAG_TILE_ENTITY, Constants.NBT.TAG_COMPOUND)) {
				final NBTTagCompound teTag = compound.getCompoundTag(TAG_TILE_ENTITY);
				final NBTTagCompound fixedTeTag = fixer.process(FixTypes.BLOCK_ENTITY, teTag, versionIn);
				compound.setTag(TAG_TILE_ENTITY, fixedTeTag);
			}
		}

		return compound;
	});
}
 
Example #5
Source File: EntityTippedChingerArrow.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public static void registerFixesTippedArrow(DataFixer fixer) {
    EntityArrow.registerFixesArrow(fixer, "TippedArrow");
}
 
Example #6
Source File: TileEntitySaltFurnace.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public static void registerFixesFurnace(DataFixer fixer) {
    fixer.registerWalker(FixTypes.BLOCK_ENTITY, new ItemStackDataLists(TileEntitySaltFurnace.class, new String[]{"Items"}));
}
 
Example #7
Source File: EntityExplodingChicken.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void registerFixesChicken(DataFixer fixer)
{
    EntityLiving.registerFixesMob(fixer, EntityChicken.class);
}
 
Example #8
Source File: DummySaveHandler.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TemplateManager getStructureTemplateManager() {
    return new TemplateManager("", new DataFixer(0));
}
 
Example #9
Source File: MixinIntegratedServer.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
private MixinIntegratedServer(File anvilFileIn, Proxy proxyIn, DataFixer dataFixerIn,
        YggdrasilAuthenticationService authServiceIn, MinecraftSessionService sessionServiceIn,
        GameProfileRepository profileRepoIn, PlayerProfileCache profileCacheIn)
{
    super(anvilFileIn, proxyIn, dataFixerIn, authServiceIn, sessionServiceIn, profileRepoIn, profileCacheIn);
}
 
Example #10
Source File: EntityVillageLord.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public static void registerFixesVillageLord(DataFixer fixer) {
	EntityLiving.registerFixesMob(fixer, EntityVillageLord.class);
	fixer.registerWalker(FixTypes.ENTITY, new ItemStackDataLists(EntityVillageLord.class, new String[] { "Items" }));
}
 
Example #11
Source File: EntityVampireBat.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public static void registerFixesBat(DataFixer fixer) {
	EntityLiving.registerFixesMob(fixer, EntityVampireBat.class);
}
 
Example #12
Source File: GenericInventoryTeFixerWalker.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public void register(DataFixer registry, Class<?> registeringClass) {
	registry.registerWalker(FixTypes.BLOCK_ENTITY, new ItemStackDataLists(registeringClass, GenericInventory.TAG_ITEMS));
}
 
Example #13
Source File: IFixerFactory.java    From OpenModsLib with MIT License votes vote down vote up
public void register(DataFixer registry, Class<?> registeringClass);