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); }
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(); }
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(); }