Search in sources :

Example 1 with SpongeGameRegistry

use of org.spongepowered.common.registry.SpongeGameRegistry in project SpongeCommon by SpongePowered.

the class MixinTileEntityBanner method updatePatterns.

private void updatePatterns() {
    this.patternLayers.clear();
    if (this.patterns != null) {
        SpongeGameRegistry registry = SpongeImpl.getRegistry();
        for (int i = 0; i < this.patterns.tagCount(); i++) {
            NBTTagCompound tagCompound = this.patterns.getCompoundTagAt(i);
            String patternId = tagCompound.getString(NbtDataUtil.BANNER_PATTERN_ID);
            this.patternLayers.add(new SpongePatternLayer(SpongeImpl.getRegistry().getType(BannerPatternShape.class, patternId).get(), registry.getType(DyeColor.class, EnumDyeColor.byDyeDamage(tagCompound.getInteger(NbtDataUtil.BANNER_PATTERN_COLOR)).getName()).get()));
        }
    }
    this.markDirtyAndUpdate();
}
Also used : SpongeGameRegistry(org.spongepowered.common.registry.SpongeGameRegistry) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) BannerPatternShape(org.spongepowered.api.data.type.BannerPatternShape) DyeColor(org.spongepowered.api.data.type.DyeColor) EnumDyeColor(net.minecraft.item.EnumDyeColor) SpongePatternLayer(org.spongepowered.common.data.meta.SpongePatternLayer)

Example 2 with SpongeGameRegistry

use of org.spongepowered.common.registry.SpongeGameRegistry in project SpongeCommon by SpongePowered.

the class TestMain method main.

public static void main(String[] args) {
    Bootstrap.register();
    SpongeGameRegistry registry = Guice.createInjector(new SpongeModule(), new TestImplementationModule()).getInstance(SpongeGameRegistry.class);
    registry.preRegistryInit();
    registry.preInit();
    registry.init();
// registry.postInit();
}
Also used : SpongeGameRegistry(org.spongepowered.common.registry.SpongeGameRegistry) SpongeModule(org.spongepowered.common.inject.SpongeModule) TestImplementationModule(org.spongepowered.common.test.inject.TestImplementationModule)

Aggregations

SpongeGameRegistry (org.spongepowered.common.registry.SpongeGameRegistry)2 EnumDyeColor (net.minecraft.item.EnumDyeColor)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 BannerPatternShape (org.spongepowered.api.data.type.BannerPatternShape)1 DyeColor (org.spongepowered.api.data.type.DyeColor)1 SpongePatternLayer (org.spongepowered.common.data.meta.SpongePatternLayer)1 SpongeModule (org.spongepowered.common.inject.SpongeModule)1 TestImplementationModule (org.spongepowered.common.test.inject.TestImplementationModule)1