类net.minecraft.util.datafix.DataFixer源码实例Demo

下面列出了怎么用net.minecraft.util.datafix.DataFixer的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: GregTech   文件: TemplateManager.java
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;
}
 
源代码2 项目: ToroQuest   文件: CommonProxy.java
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();

}
 
源代码3 项目: enderutilities   文件: TemplateManagerEU.java
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;
}
 
源代码4 项目: OpenModsLib   文件: EntityBlock.java
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;
	});
}
 
public static void registerFixesTippedArrow(DataFixer fixer) {
    EntityArrow.registerFixesArrow(fixer, "TippedArrow");
}
 
源代码6 项目: TofuCraftReload   文件: TileEntitySaltFurnace.java
public static void registerFixesFurnace(DataFixer fixer) {
    fixer.registerWalker(FixTypes.BLOCK_ENTITY, new ItemStackDataLists(TileEntitySaltFurnace.class, new String[]{"Items"}));
}
 
源代码7 项目: CommunityMod   文件: EntityExplodingChicken.java
public static void registerFixesChicken(DataFixer fixer)
{
    EntityLiving.registerFixesMob(fixer, EntityChicken.class);
}
 
源代码8 项目: GregTech   文件: DummySaveHandler.java
@Override
public TemplateManager getStructureTemplateManager() {
    return new TemplateManager("", new DataFixer(0));
}
 
源代码9 项目: litematica   文件: MixinIntegratedServer.java
private MixinIntegratedServer(File anvilFileIn, Proxy proxyIn, DataFixer dataFixerIn,
        YggdrasilAuthenticationService authServiceIn, MinecraftSessionService sessionServiceIn,
        GameProfileRepository profileRepoIn, PlayerProfileCache profileCacheIn)
{
    super(anvilFileIn, proxyIn, dataFixerIn, authServiceIn, sessionServiceIn, profileRepoIn, profileCacheIn);
}
 
源代码10 项目: ToroQuest   文件: EntityVillageLord.java
public static void registerFixesVillageLord(DataFixer fixer) {
	EntityLiving.registerFixesMob(fixer, EntityVillageLord.class);
	fixer.registerWalker(FixTypes.ENTITY, new ItemStackDataLists(EntityVillageLord.class, new String[] { "Items" }));
}
 
源代码11 项目: ToroQuest   文件: EntityVampireBat.java
public static void registerFixesBat(DataFixer fixer) {
	EntityLiving.registerFixesMob(fixer, EntityVampireBat.class);
}
 
@Override
public void register(DataFixer registry, Class<?> registeringClass) {
	registry.registerWalker(FixTypes.BLOCK_ENTITY, new ItemStackDataLists(registeringClass, GenericInventory.TAG_ITEMS));
}
 
源代码13 项目: OpenModsLib   文件: IFixerFactory.java
public void register(DataFixer registry, Class<?> registeringClass); 
 类所在包
 类方法
 同包方法