예제 #1
0
        protected MeshData genContentMesh(ICoreClientAPI capi, ItemStack contentStack, Vec3f rotation = null)
        {
            float fillHeight;

            var contentSource = BlockBarrel.getContentTexture(capi, contentStack, out fillHeight);

            if (contentSource != null)
            {
                Shape    shape = capi.Assets.TryGet("shapes/block/wood/crate/contents.json").ToObject <Shape>();
                MeshData contentMesh;
                capi.Tesselator.TesselateShape("cratecontents", shape, out contentMesh, contentSource, rotation);
                contentMesh.Translate(0, fillHeight, 0);
                return(contentMesh);
            }

            return(null);
        }
예제 #2
0
        public override void Initialize(ICoreAPI api)
        {
            base.Initialize(api);

            ownBlock = api.World.BlockAccessor.GetBlock(pos) as BlockBarrel;

            if (api.Side == EnumAppSide.Client && currentMesh == null)
            {
                currentMesh = GenMesh();
                MarkDirty(true);
            }
            if (api.Side == EnumAppSide.Server)
            {
                RegisterGameTickListener(OnEvery3Second, 3000);
            }

            FindMatchingRecipe();
        }
예제 #3
0
        public override void Initialize(ICoreAPI api)
        {
            base.Initialize(api);

            ownBlock = Block as BlockBarrel;

            if (ownBlock?.Attributes?["capacityLitres"].Exists == true)
            {
                CapacityLitres = ownBlock.Attributes["capacityLitres"].AsInt(50);
                (inventory[1] as ItemSlotLiquidOnly).CapacityLitres = CapacityLitres;
            }

            if (api.Side == EnumAppSide.Client && currentMesh == null)
            {
                currentMesh = GenMesh();
                MarkDirty(true);
            }
            if (api.Side == EnumAppSide.Server)
            {
                RegisterGameTickListener(OnEvery3Second, 3000);
            }

            FindMatchingRecipe();
        }