public EntityBlockFalling(Block block, BlockEntity blockEntity, BlockPos initialPos, AssetLocation fallSound, float impactDamageMul, bool canFallSideways, float dustIntensity) { this.impactDamageMul = impactDamageMul; this.fallSound = fallSound; this.canFallSideways = canFallSideways; this.dustIntensity = dustIntensity; WatchedAttributes.SetBool("canFallSideways", canFallSideways); WatchedAttributes.SetFloat("dustIntensity", dustIntensity); if (fallSound != null) { WatchedAttributes.SetString("fallSound", fallSound.ToShortString()); } this.Code = new AssetLocation("blockfalling"); this.blockCode = block.Code; this.removedBlockentity = blockEntity; this.initialPos = initialPos.Copy(); // Must have a Copy() here! ServerPos.SetPos(initialPos); ServerPos.X += 0.5; ServerPos.Z += 0.5; Pos.SetFrom(ServerPos); }
public override void ToBytes(BinaryWriter writer, bool forClient) { if (Inventory != null && Inventory.Count > 0 && WatchedAttributes != null) { WatchedAttributes.SetString("invid", Inventory.InventoryID); Inventory.ToTreeAttributes(WatchedAttributes); } base.ToBytes(writer, forClient); }
public override void ToBytes(BinaryWriter writer, bool forClient) { if (lastRunningHeldUseAnimation != null) { WatchedAttributes.SetString("lrHeldUseAnim", lastRunningHeldUseAnimation); } if (lastRunningHeldHitAnimation != null) { WatchedAttributes.SetString("lrHeldHitAnim", lastRunningHeldHitAnimation); } if (lastRunningRightHeldIdleAnimation != null) { WatchedAttributes.SetString("lrRightHeldIdleAnim", lastRunningRightHeldIdleAnimation); } base.ToBytes(writer, forClient); }