當前位置: 首頁>>代碼示例>>Java>>正文


Java CapabilityAnimation類代碼示例

本文整理匯總了Java中net.minecraftforge.common.model.animation.CapabilityAnimation的典型用法代碼示例。如果您正苦於以下問題:Java CapabilityAnimation類的具體用法?Java CapabilityAnimation怎麽用?Java CapabilityAnimation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CapabilityAnimation類屬於net.minecraftforge.common.model.animation包,在下文中一共展示了CapabilityAnimation類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleItemState

import net.minecraftforge.common.model.animation.CapabilityAnimation; //導入依賴的package包/類
@Override
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity)
{
    if(stack.hasCapability(net.minecraftforge.common.model.animation.CapabilityAnimation.ANIMATION_CAPABILITY, null))
    {
        // TODO: caching?
        IAnimationStateMachine asm = stack.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null);
        if(world == null)
        {
            world = entity.worldObj;
        }
        if(world == null)
        {
            world = Minecraft.getMinecraft().theWorld;
        }
        IModelState state = asm.apply(Animation.getWorldTime(world, Animation.getPartialTickTime())).getLeft();
        return model.bake(new ModelStateComposition(state, this.state), format, bakedTextureGetter);
    }
    return super.handleItemState(originalModel, stack, world, entity);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:21,代碼來源:AnimationItemOverrideList.java

示例2: preInit

import net.minecraftforge.common.model.animation.CapabilityAnimation; //導入依賴的package包/類
@Subscribe
public void preInit(FMLPreInitializationEvent evt)
{
    CapabilityItemHandler.register();
    CapabilityFluidHandler.register();
    CapabilityAnimation.register();
    CapabilityEnergy.register();
    MinecraftForge.EVENT_BUS.register(MinecraftForge.INTERNAL_HANDLER);
    ForgeChunkManager.captureConfig(evt.getModConfigurationDirectory());
    MinecraftForge.EVENT_BUS.register(this);

    if (!ForgeModContainer.disableVersionCheck)
    {
        ForgeVersion.startVersionCheck();
    }

    // Add and register the forge universal bucket, if it's enabled
    if(FluidRegistry.isUniversalBucketEnabled())
    {
        universalBucket = new UniversalBucket();
        universalBucket.setUnlocalizedName("forge.bucketFilled");
        GameRegistry.registerItem(universalBucket, "bucketFilled");
        MinecraftForge.EVENT_BUS.register(universalBucket);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:26,代碼來源:ForgeModContainer.java

示例3: renderTileEntityFast

import net.minecraftforge.common.model.animation.CapabilityAnimation; //導入依賴的package包/類
public void renderTileEntityFast(T te, double x, double y, double z, float partialTick, int breakStage, VertexBuffer renderer)
{
    if(!te.hasCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null))
    {
        return;
    }
    if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
    BlockPos pos = te.getPos();
    IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
    IBlockState state = world.getBlockState(pos);
    if(state.getPropertyNames().contains(Properties.StaticProperty))
    {
        state = state.withProperty(Properties.StaticProperty, false);
    }
    if(state instanceof IExtendedBlockState)
    {
        IExtendedBlockState exState = (IExtendedBlockState)state;
        if(exState.getUnlistedNames().contains(Properties.AnimationProperty))
        {
            float time = Animation.getWorldTime(getWorld(), partialTick);
            Pair<IModelState, Iterable<Event>> pair = te.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null).apply(time);
            handleEvents(te, time, pair.getRight());

            // TODO: caching?
            IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(exState.getClean());
            exState = exState.withProperty(Properties.AnimationProperty, pair.getLeft());

            renderer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ());

            blockRenderer.getBlockModelRenderer().renderModel(world, model, exState, pos, renderer, false);
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:34,代碼來源:AnimationTESR.java

示例4: renderTileEntityFast

import net.minecraftforge.common.model.animation.CapabilityAnimation; //導入依賴的package包/類
@Override
public void renderTileEntityFast(TileEntityPaintMixer te, double x, double y, double z, float partialTick, int breakStage, float alpha, BufferBuilder renderer) {
	if (te.hasPaint()) {
		if (!te.hasCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null)) { return; }
		if (blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();

		final BlockPos pos = te.getPos();
		final IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
		IBlockState state = world.getBlockState(pos);

		if (state.getPropertyKeys().contains(Properties.StaticProperty)) {
			state = state.withProperty(Properties.StaticProperty, false);
		}

		if (state instanceof IExtendedBlockState) {
			state = state.getBlock().getExtendedState(state, world, pos); // difference between this and AnimationTESR

			IExtendedBlockState exState = (IExtendedBlockState)state;
			if (exState.getUnlistedNames().contains(Properties.AnimationProperty)) {
				float time = Animation.getWorldTime(getWorld(), partialTick);
				Pair<IModelState, Iterable<Event>> pair = te.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null).apply(time);

				IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(exState.getClean());
				exState = exState.withProperty(Properties.AnimationProperty, pair.getLeft());

				renderer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ());

				blockRenderer.getBlockModelRenderer().renderModel(world, model, exState, pos, renderer, false);
			}
		}
	}
}
 
開發者ID:OpenMods,項目名稱:OpenBlocks,代碼行數:33,代碼來源:TileEntityPaintMixerRenderer.java

示例5: getCapability

import net.minecraftforge.common.model.animation.CapabilityAnimation; //導入依賴的package包/類
@Override
@SuppressWarnings("unchecked")
public <T> T getCapability(Capability<T> capability, EnumFacing side) {
	if (capability == CapabilityAnimation.ANIMATION_CAPABILITY)
		return (T)asm;

	if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
		return (T)inventory.getHandler();

	return super.getCapability(capability, side);
}
 
開發者ID:OpenMods,項目名稱:OpenBlocks,代碼行數:12,代碼來源:TileEntityPaintMixer.java

示例6: hasCapability

import net.minecraftforge.common.model.animation.CapabilityAnimation; //導入依賴的package包/類
@Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
	return capability == CapabilityAnimation.ANIMATION_CAPABILITY;
}
 
開發者ID:ArekkuusuJerii,項目名稱:Solar,代碼行數:5,代碼來源:TilePhenomena.java

示例7: getCapability

import net.minecraftforge.common.model.animation.CapabilityAnimation; //導入依賴的package包/類
@Nullable
@Override
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
	return capability == CapabilityAnimation.ANIMATION_CAPABILITY ? CapabilityAnimation.ANIMATION_CAPABILITY.cast(animation) : null;
}
 
開發者ID:ArekkuusuJerii,項目名稱:Solar,代碼行數:6,代碼來源:TilePhenomena.java

示例8: renderProjector

import net.minecraftforge.common.model.animation.CapabilityAnimation; //導入依賴的package包/類
private void renderProjector(TileEntityProjector projector, float partialTickTime, double x, double y, double z) {
	if (bakedSpinnerModel == null) return;
	if (!projector.hasCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null)) return;

	if (blockModelRenderer == null) {
		blockModelRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer();
	}

	final BlockPos pos = projector.getPos();
	final IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(projector.getWorld(), pos);
	final IBlockState state = world.getBlockState(pos);

	if (state instanceof IExtendedBlockState) {
		IExtendedBlockState exState = (IExtendedBlockState)state;
		if (exState.getUnlistedNames().contains(Properties.AnimationProperty)) {
			Tessellator tessellator = Tessellator.getInstance();
			BufferBuilder vb = tessellator.getBuffer();
			bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
			RenderHelper.disableStandardItemLighting();
			GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
			GlStateManager.enableBlend();
			GlStateManager.disableCull();

			if (Minecraft.isAmbientOcclusionEnabled()) {
				GlStateManager.shadeModel(GL11.GL_SMOOTH);
			} else {
				GlStateManager.shadeModel(GL11.GL_FLAT);
			}

			vb.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);

			float time = Animation.getWorldTime(getWorld(), partialTickTime);
			final Pair<IModelState, Iterable<Event>> pair = projector.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null).apply(time);
			exState = exState.withProperty(Properties.AnimationProperty, pair.getLeft());

			vb.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ());

			blockModelRenderer.renderModel(world, bakedSpinnerModel, exState, pos, vb, false);

			vb.setTranslation(0, 0, 0);

			tessellator.draw();

			RenderHelper.enableStandardItemLighting();
		}
	}
}
 
開發者ID:OpenMods,項目名稱:OpenBlocks,代碼行數:48,代碼來源:TileEntityProjectorRenderer.java

示例9: hasCapability

import net.minecraftforge.common.model.animation.CapabilityAnimation; //導入依賴的package包/類
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing side) {
	return capability == CapabilityAnimation.ANIMATION_CAPABILITY ||
			capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ||
			super.hasCapability(capability, side);
}
 
開發者ID:OpenMods,項目名稱:OpenBlocks,代碼行數:7,代碼來源:TileEntityPaintMixer.java


注:本文中的net.minecraftforge.common.model.animation.CapabilityAnimation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。